2022-06-20 18:27:39 +02:00
|
|
|
import React, { useCallback, useRef } from 'react';
|
2019-08-31 04:07:25 +05:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
2020-02-03 18:42:31 +05:00
|
|
|
import { Button, Grid, Icon, Modal } from 'semantic-ui-react';
|
2020-04-28 19:46:55 +05:00
|
|
|
import { Markdown } from '../../lib/custom-ui';
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
import NameField from './NameField';
|
2020-08-04 01:32:46 +05:00
|
|
|
import DescriptionEdit from './DescriptionEdit';
|
2019-08-31 04:07:25 +05:00
|
|
|
import Tasks from './Tasks';
|
2020-04-21 05:04:34 +05:00
|
|
|
import Attachments from './Attachments';
|
2020-08-04 01:32:46 +05:00
|
|
|
import AttachmentAddZone from './AttachmentAddZone';
|
|
|
|
import AttachmentAddPopup from './AttachmentAddPopup';
|
2022-08-04 13:31:14 +02:00
|
|
|
import Activities from './Activities';
|
2019-08-31 04:07:25 +05:00
|
|
|
import User from '../User';
|
|
|
|
import Label from '../Label';
|
2019-10-05 06:12:36 +05:00
|
|
|
import DueDate from '../DueDate';
|
2019-08-31 04:07:25 +05:00
|
|
|
import Timer from '../Timer';
|
2021-06-24 01:05:22 +05:00
|
|
|
import BoardMembershipsPopup from '../BoardMembershipsPopup';
|
2019-08-31 04:07:25 +05:00
|
|
|
import LabelsPopup from '../LabelsPopup';
|
2020-08-04 01:32:46 +05:00
|
|
|
import DueDateEditPopup from '../DueDateEditPopup';
|
|
|
|
import TimerEditPopup from '../TimerEditPopup';
|
|
|
|
import CardMovePopup from '../CardMovePopup';
|
2019-08-31 04:07:25 +05:00
|
|
|
import DeletePopup from '../DeletePopup';
|
|
|
|
|
2020-05-29 19:31:19 +05:00
|
|
|
import styles from './CardModal.module.scss';
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
const CardModal = React.memo(
|
|
|
|
({
|
|
|
|
name,
|
|
|
|
description,
|
2019-10-05 06:12:36 +05:00
|
|
|
dueDate,
|
2019-08-31 04:07:25 +05:00
|
|
|
timer,
|
|
|
|
isSubscribed,
|
2022-08-04 13:31:14 +02:00
|
|
|
isActivitiesFetching,
|
|
|
|
isAllActivitiesFetched,
|
|
|
|
isActivitiesDetailsVisible,
|
|
|
|
isActivitiesDetailsFetching,
|
2020-05-05 01:30:06 +05:00
|
|
|
listId,
|
|
|
|
boardId,
|
|
|
|
projectId,
|
2019-08-31 04:07:25 +05:00
|
|
|
users,
|
|
|
|
labels,
|
|
|
|
tasks,
|
2020-04-21 05:04:34 +05:00
|
|
|
attachments,
|
2022-08-04 13:31:14 +02:00
|
|
|
activities,
|
2020-05-05 01:30:06 +05:00
|
|
|
allProjectsToLists,
|
2021-06-24 01:05:22 +05:00
|
|
|
allBoardMemberships,
|
2019-08-31 04:07:25 +05:00
|
|
|
allLabels,
|
2021-06-24 01:05:22 +05:00
|
|
|
canEdit,
|
2022-08-19 14:00:40 +02:00
|
|
|
canEditCommentActivities,
|
2022-08-04 13:31:14 +02:00
|
|
|
canEditAllCommentActivities,
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate,
|
2020-05-05 01:30:06 +05:00
|
|
|
onMove,
|
|
|
|
onTransfer,
|
2019-08-31 04:07:25 +05:00
|
|
|
onDelete,
|
|
|
|
onUserAdd,
|
|
|
|
onUserRemove,
|
2020-05-05 01:30:06 +05:00
|
|
|
onBoardFetch,
|
2019-08-31 04:07:25 +05:00
|
|
|
onLabelAdd,
|
|
|
|
onLabelRemove,
|
|
|
|
onLabelCreate,
|
|
|
|
onLabelUpdate,
|
|
|
|
onLabelDelete,
|
|
|
|
onTaskCreate,
|
|
|
|
onTaskUpdate,
|
2022-07-21 11:31:05 +02:00
|
|
|
onTaskMove,
|
2019-08-31 04:07:25 +05:00
|
|
|
onTaskDelete,
|
2020-04-21 05:04:34 +05:00
|
|
|
onAttachmentCreate,
|
|
|
|
onAttachmentUpdate,
|
|
|
|
onAttachmentDelete,
|
2022-08-04 13:31:14 +02:00
|
|
|
onActivitiesFetch,
|
|
|
|
onActivitiesDetailsToggle,
|
|
|
|
onCommentActivityCreate,
|
|
|
|
onCommentActivityUpdate,
|
|
|
|
onCommentActivityDelete,
|
2019-08-31 04:07:25 +05:00
|
|
|
onClose,
|
|
|
|
}) => {
|
|
|
|
const [t] = useTranslation();
|
|
|
|
|
2022-06-20 18:27:39 +02:00
|
|
|
const isGalleryOpened = useRef(false);
|
|
|
|
|
2019-08-31 04:07:25 +05:00
|
|
|
const handleNameUpdate = useCallback(
|
2020-03-25 00:15:47 +05:00
|
|
|
(newName) => {
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate({
|
|
|
|
name: newName,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[onUpdate],
|
|
|
|
);
|
|
|
|
|
|
|
|
const handleDescriptionUpdate = useCallback(
|
2020-03-25 00:15:47 +05:00
|
|
|
(newDescription) => {
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate({
|
|
|
|
description: newDescription,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[onUpdate],
|
|
|
|
);
|
|
|
|
|
2019-10-05 06:12:36 +05:00
|
|
|
const handleDueDateUpdate = useCallback(
|
2020-03-25 00:15:47 +05:00
|
|
|
(newDueDate) => {
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate({
|
2019-10-05 06:12:36 +05:00
|
|
|
dueDate: newDueDate,
|
2019-08-31 04:07:25 +05:00
|
|
|
});
|
|
|
|
},
|
|
|
|
[onUpdate],
|
|
|
|
);
|
|
|
|
|
|
|
|
const handleTimerUpdate = useCallback(
|
2020-03-25 00:15:47 +05:00
|
|
|
(newTimer) => {
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate({
|
|
|
|
timer: newTimer,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[onUpdate],
|
|
|
|
);
|
|
|
|
|
2020-04-23 03:02:53 +05:00
|
|
|
const handleCoverUpdate = useCallback(
|
|
|
|
(newCoverAttachmentId) => {
|
|
|
|
onUpdate({
|
|
|
|
coverAttachmentId: newCoverAttachmentId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[onUpdate],
|
|
|
|
);
|
|
|
|
|
2020-05-16 04:09:46 +05:00
|
|
|
const handleToggleSubscriptionClick = useCallback(() => {
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate({
|
|
|
|
isSubscribed: !isSubscribed,
|
|
|
|
});
|
|
|
|
}, [isSubscribed, onUpdate]);
|
|
|
|
|
2022-06-20 18:27:39 +02:00
|
|
|
const handleGalleryOpen = useCallback(() => {
|
|
|
|
isGalleryOpened.current = true;
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const handleGalleryClose = useCallback(() => {
|
|
|
|
isGalleryOpened.current = false;
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const handleClose = useCallback(() => {
|
|
|
|
if (isGalleryOpened.current) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
onClose();
|
|
|
|
}, [onClose]);
|
|
|
|
|
2020-03-25 00:15:47 +05:00
|
|
|
const userIds = users.map((user) => user.id);
|
|
|
|
const labelIds = labels.map((label) => label.id);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
const contentNode = (
|
|
|
|
<Grid className={styles.grid}>
|
|
|
|
<Grid.Row className={styles.headerPadding}>
|
|
|
|
<Grid.Column width={16} className={styles.headerPadding}>
|
|
|
|
<div className={styles.headerWrapper}>
|
|
|
|
<Icon name="list alternate outline" className={styles.moduleIcon} />
|
|
|
|
<div className={styles.headerTitleWrapper}>
|
|
|
|
{canEdit ? (
|
|
|
|
<NameField defaultValue={name} onUpdate={handleNameUpdate} />
|
|
|
|
) : (
|
|
|
|
<div className={styles.headerTitle}>{name}</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Grid.Column>
|
|
|
|
</Grid.Row>
|
|
|
|
<Grid.Row className={styles.modalPadding}>
|
|
|
|
<Grid.Column width={canEdit ? 12 : 16} className={styles.contentPadding}>
|
|
|
|
{(users.length > 0 || labels.length > 0 || dueDate || timer) && (
|
|
|
|
<div className={styles.moduleWrapper}>
|
|
|
|
{users.length > 0 && (
|
|
|
|
<div className={styles.attachments}>
|
|
|
|
<div className={styles.text}>
|
|
|
|
{t('common.members', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
{users.map((user) => (
|
|
|
|
<span key={user.id} className={styles.attachment}>
|
|
|
|
{canEdit ? (
|
|
|
|
<BoardMembershipsPopup
|
|
|
|
items={allBoardMemberships}
|
|
|
|
currentUserIds={userIds}
|
|
|
|
onUserSelect={onUserAdd}
|
|
|
|
onUserDeselect={onUserRemove}
|
2019-08-31 04:07:25 +05:00
|
|
|
>
|
2021-06-24 01:05:22 +05:00
|
|
|
<User name={user.name} avatarUrl={user.avatarUrl} />
|
|
|
|
</BoardMembershipsPopup>
|
|
|
|
) : (
|
|
|
|
<User name={user.name} avatarUrl={user.avatarUrl} />
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
))}
|
|
|
|
{canEdit && (
|
|
|
|
<BoardMembershipsPopup
|
|
|
|
items={allBoardMemberships}
|
|
|
|
currentUserIds={userIds}
|
|
|
|
onUserSelect={onUserAdd}
|
|
|
|
onUserDeselect={onUserRemove}
|
|
|
|
>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className={classNames(styles.attachment, styles.dueDate)}
|
2019-08-31 04:07:25 +05:00
|
|
|
>
|
2021-06-24 01:05:22 +05:00
|
|
|
<Icon name="add" size="small" className={styles.addAttachment} />
|
|
|
|
</button>
|
|
|
|
</BoardMembershipsPopup>
|
2020-04-28 19:46:55 +05:00
|
|
|
)}
|
2021-06-24 01:05:22 +05:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{labels.length > 0 && (
|
|
|
|
<div className={styles.attachments}>
|
|
|
|
<div className={styles.text}>
|
|
|
|
{t('common.labels', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
{labels.map((label) => (
|
|
|
|
<span key={label.id} className={styles.attachment}>
|
|
|
|
{canEdit ? (
|
|
|
|
<LabelsPopup
|
|
|
|
key={label.id}
|
|
|
|
items={allLabels}
|
|
|
|
currentIds={labelIds}
|
|
|
|
onSelect={onLabelAdd}
|
|
|
|
onDeselect={onLabelRemove}
|
|
|
|
onCreate={onLabelCreate}
|
|
|
|
onUpdate={onLabelUpdate}
|
|
|
|
onDelete={onLabelDelete}
|
|
|
|
>
|
|
|
|
<Label name={label.name} color={label.color} />
|
|
|
|
</LabelsPopup>
|
|
|
|
) : (
|
|
|
|
<Label name={label.name} color={label.color} />
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
))}
|
|
|
|
{canEdit && (
|
|
|
|
<LabelsPopup
|
|
|
|
items={allLabels}
|
|
|
|
currentIds={labelIds}
|
|
|
|
onSelect={onLabelAdd}
|
|
|
|
onDeselect={onLabelRemove}
|
|
|
|
onCreate={onLabelCreate}
|
|
|
|
onUpdate={onLabelUpdate}
|
|
|
|
onDelete={onLabelDelete}
|
|
|
|
>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className={classNames(styles.attachment, styles.dueDate)}
|
|
|
|
>
|
|
|
|
<Icon name="add" size="small" className={styles.addAttachment} />
|
|
|
|
</button>
|
|
|
|
</LabelsPopup>
|
2019-08-31 04:07:25 +05:00
|
|
|
)}
|
2020-04-28 19:46:55 +05:00
|
|
|
</div>
|
|
|
|
)}
|
2021-06-24 01:05:22 +05:00
|
|
|
{dueDate && (
|
|
|
|
<div className={styles.attachments}>
|
|
|
|
<div className={styles.text}>
|
|
|
|
{t('common.dueDate', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
<span className={styles.attachment}>
|
|
|
|
{canEdit ? (
|
|
|
|
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
|
|
|
|
<DueDate value={dueDate} />
|
|
|
|
</DueDateEditPopup>
|
|
|
|
) : (
|
|
|
|
<DueDate value={dueDate} />
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{timer && (
|
|
|
|
<div className={styles.attachments}>
|
|
|
|
<div className={styles.text}>
|
|
|
|
{t('common.timer', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
<span className={styles.attachment}>
|
|
|
|
{canEdit ? (
|
|
|
|
<TimerEditPopup defaultValue={timer} onUpdate={handleTimerUpdate}>
|
|
|
|
<Timer startedAt={timer.startedAt} total={timer.total} />
|
|
|
|
</TimerEditPopup>
|
|
|
|
) : (
|
|
|
|
<Timer startedAt={timer.startedAt} total={timer.total} />
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{(description || canEdit) && (
|
|
|
|
<div className={styles.contentModule}>
|
|
|
|
<div className={styles.moduleWrapper}>
|
|
|
|
<Icon name="align justify" className={styles.moduleIcon} />
|
|
|
|
<div className={styles.moduleHeader}>{t('common.description')}</div>
|
|
|
|
{canEdit ? (
|
2020-08-04 01:32:46 +05:00
|
|
|
<DescriptionEdit defaultValue={description} onUpdate={handleDescriptionUpdate}>
|
2020-04-28 19:46:55 +05:00
|
|
|
{description ? (
|
2022-08-19 14:00:40 +02:00
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className={classNames(styles.descriptionText, styles.cursorPointer)}
|
|
|
|
>
|
2021-06-24 01:05:22 +05:00
|
|
|
<Markdown linkStopPropagation linkTarget="_blank">
|
|
|
|
{description}
|
|
|
|
</Markdown>
|
2020-04-28 19:46:55 +05:00
|
|
|
</button>
|
|
|
|
) : (
|
|
|
|
<button type="button" className={styles.descriptionButton}>
|
|
|
|
<span className={styles.descriptionButtonText}>
|
|
|
|
{t('action.addMoreDetailedDescription')}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
)}
|
2020-08-04 01:32:46 +05:00
|
|
|
</DescriptionEdit>
|
2021-06-24 01:05:22 +05:00
|
|
|
) : (
|
|
|
|
<div className={styles.descriptionText}>
|
|
|
|
<Markdown linkStopPropagation linkTarget="_blank">
|
|
|
|
{description}
|
|
|
|
</Markdown>
|
|
|
|
</div>
|
|
|
|
)}
|
2019-08-31 04:07:25 +05:00
|
|
|
</div>
|
2021-06-24 01:05:22 +05:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{(tasks.length > 0 || canEdit) && (
|
|
|
|
<div className={styles.contentModule}>
|
|
|
|
<div className={styles.moduleWrapper}>
|
|
|
|
<Icon name="check square outline" className={styles.moduleIcon} />
|
|
|
|
<div className={styles.moduleHeader}>{t('common.tasks')}</div>
|
|
|
|
<Tasks
|
|
|
|
items={tasks}
|
|
|
|
canEdit={canEdit}
|
|
|
|
onCreate={onTaskCreate}
|
|
|
|
onUpdate={onTaskUpdate}
|
2022-07-21 11:31:05 +02:00
|
|
|
onMove={onTaskMove}
|
2021-06-24 01:05:22 +05:00
|
|
|
onDelete={onTaskDelete}
|
|
|
|
/>
|
2020-04-21 05:04:34 +05:00
|
|
|
</div>
|
2021-06-24 01:05:22 +05:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
{attachments.length > 0 && (
|
|
|
|
<div className={styles.contentModule}>
|
|
|
|
<div className={styles.moduleWrapper}>
|
|
|
|
<Icon name="attach" className={styles.moduleIcon} />
|
|
|
|
<div className={styles.moduleHeader}>{t('common.attachments')}</div>
|
|
|
|
<Attachments
|
|
|
|
items={attachments}
|
2022-08-19 14:00:40 +02:00
|
|
|
canEdit={canEdit}
|
2021-06-24 01:05:22 +05:00
|
|
|
onUpdate={onAttachmentUpdate}
|
|
|
|
onDelete={onAttachmentDelete}
|
|
|
|
onCoverUpdate={handleCoverUpdate}
|
2022-06-20 18:27:39 +02:00
|
|
|
onGalleryOpen={handleGalleryOpen}
|
|
|
|
onGalleryClose={handleGalleryClose}
|
2021-06-24 01:05:22 +05:00
|
|
|
/>
|
2020-04-28 19:46:55 +05:00
|
|
|
</div>
|
2021-06-24 01:05:22 +05:00
|
|
|
</div>
|
|
|
|
)}
|
2022-08-04 13:31:14 +02:00
|
|
|
<Activities
|
|
|
|
items={activities}
|
|
|
|
isFetching={isActivitiesFetching}
|
|
|
|
isAllFetched={isAllActivitiesFetched}
|
|
|
|
isDetailsVisible={isActivitiesDetailsVisible}
|
|
|
|
isDetailsFetching={isActivitiesDetailsFetching}
|
2022-08-19 14:00:40 +02:00
|
|
|
canEdit={canEditCommentActivities}
|
2022-08-04 13:31:14 +02:00
|
|
|
canEditAllComments={canEditAllCommentActivities}
|
|
|
|
onFetch={onActivitiesFetch}
|
|
|
|
onDetailsToggle={onActivitiesDetailsToggle}
|
|
|
|
onCommentCreate={onCommentActivityCreate}
|
|
|
|
onCommentUpdate={onCommentActivityUpdate}
|
|
|
|
onCommentDelete={onCommentActivityDelete}
|
2021-06-24 01:05:22 +05:00
|
|
|
/>
|
|
|
|
</Grid.Column>
|
|
|
|
{canEdit && (
|
|
|
|
<Grid.Column width={4} className={styles.sidebarPadding}>
|
|
|
|
<div className={styles.actions}>
|
|
|
|
<span className={styles.actionsTitle}>{t('action.addToCard')}</span>
|
|
|
|
<BoardMembershipsPopup
|
|
|
|
items={allBoardMemberships}
|
|
|
|
currentUserIds={userIds}
|
|
|
|
onUserSelect={onUserAdd}
|
|
|
|
onUserDeselect={onUserRemove}
|
|
|
|
>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="user outline" className={styles.actionIcon} />
|
|
|
|
{t('common.members')}
|
|
|
|
</Button>
|
|
|
|
</BoardMembershipsPopup>
|
|
|
|
<LabelsPopup
|
|
|
|
items={allLabels}
|
|
|
|
currentIds={labelIds}
|
|
|
|
onSelect={onLabelAdd}
|
|
|
|
onDeselect={onLabelRemove}
|
|
|
|
onCreate={onLabelCreate}
|
|
|
|
onUpdate={onLabelUpdate}
|
|
|
|
onDelete={onLabelDelete}
|
|
|
|
>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="bookmark outline" className={styles.actionIcon} />
|
|
|
|
{t('common.labels')}
|
|
|
|
</Button>
|
|
|
|
</LabelsPopup>
|
|
|
|
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="calendar check outline" className={styles.actionIcon} />
|
|
|
|
{t('common.dueDate', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
</Button>
|
|
|
|
</DueDateEditPopup>
|
|
|
|
<TimerEditPopup defaultValue={timer} onUpdate={handleTimerUpdate}>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="clock outline" className={styles.actionIcon} />
|
|
|
|
{t('common.timer')}
|
|
|
|
</Button>
|
|
|
|
</TimerEditPopup>
|
|
|
|
<AttachmentAddPopup onCreate={onAttachmentCreate}>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="attach" className={styles.actionIcon} />
|
|
|
|
{t('common.attachment')}
|
|
|
|
</Button>
|
|
|
|
</AttachmentAddPopup>
|
|
|
|
</div>
|
|
|
|
<div className={styles.actions}>
|
|
|
|
<span className={styles.actionsTitle}>{t('common.actions')}</span>
|
|
|
|
<Button
|
|
|
|
fluid
|
|
|
|
className={styles.actionButton}
|
|
|
|
onClick={handleToggleSubscriptionClick}
|
|
|
|
>
|
|
|
|
<Icon name="paper plane outline" className={styles.actionIcon} />
|
|
|
|
{isSubscribed ? t('action.unsubscribe') : t('action.subscribe')}
|
|
|
|
</Button>
|
|
|
|
<CardMovePopup
|
|
|
|
projectsToLists={allProjectsToLists}
|
|
|
|
defaultPath={{
|
|
|
|
projectId,
|
|
|
|
boardId,
|
|
|
|
listId,
|
|
|
|
}}
|
|
|
|
onMove={onMove}
|
|
|
|
onTransfer={onTransfer}
|
|
|
|
onBoardFetch={onBoardFetch}
|
|
|
|
>
|
2020-04-28 19:46:55 +05:00
|
|
|
<Button
|
|
|
|
fluid
|
|
|
|
className={styles.actionButton}
|
2020-05-16 04:09:46 +05:00
|
|
|
onClick={handleToggleSubscriptionClick}
|
2020-04-28 19:46:55 +05:00
|
|
|
>
|
2021-06-24 01:05:22 +05:00
|
|
|
<Icon name="share square outline" className={styles.actionIcon} />
|
|
|
|
{t('action.move')}
|
2019-08-31 04:07:25 +05:00
|
|
|
</Button>
|
2021-06-24 01:05:22 +05:00
|
|
|
</CardMovePopup>
|
|
|
|
<DeletePopup
|
|
|
|
title={t('common.deleteCard', {
|
|
|
|
context: 'title',
|
|
|
|
})}
|
|
|
|
content={t('common.areYouSureYouWantToDeleteThisCard')}
|
|
|
|
buttonContent={t('action.deleteCard')}
|
|
|
|
onConfirm={onDelete}
|
|
|
|
>
|
|
|
|
<Button fluid className={styles.actionButton}>
|
|
|
|
<Icon name="trash alternate outline" className={styles.actionIcon} />
|
|
|
|
{t('action.delete')}
|
|
|
|
</Button>
|
|
|
|
</DeletePopup>
|
|
|
|
</div>
|
|
|
|
</Grid.Column>
|
|
|
|
)}
|
|
|
|
</Grid.Row>
|
|
|
|
</Grid>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2022-07-26 13:53:30 +02:00
|
|
|
<Modal open closeIcon centered={false} onClose={handleClose} className={styles.wrapper}>
|
2021-06-24 01:05:22 +05:00
|
|
|
{canEdit ? (
|
|
|
|
<AttachmentAddZone onCreate={onAttachmentCreate}>{contentNode}</AttachmentAddZone>
|
|
|
|
) : (
|
|
|
|
contentNode
|
|
|
|
)}
|
2019-08-31 04:07:25 +05:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
CardModal.propTypes = {
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
description: PropTypes.string,
|
2019-10-05 06:12:36 +05:00
|
|
|
dueDate: PropTypes.instanceOf(Date),
|
2019-08-31 04:07:25 +05:00
|
|
|
timer: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
|
|
|
isSubscribed: PropTypes.bool.isRequired,
|
2022-08-04 13:31:14 +02:00
|
|
|
isActivitiesFetching: PropTypes.bool.isRequired,
|
|
|
|
isAllActivitiesFetched: PropTypes.bool.isRequired,
|
|
|
|
isActivitiesDetailsVisible: PropTypes.bool.isRequired,
|
|
|
|
isActivitiesDetailsFetching: PropTypes.bool.isRequired,
|
2020-05-05 01:30:06 +05:00
|
|
|
listId: PropTypes.string.isRequired,
|
|
|
|
boardId: PropTypes.string.isRequired,
|
|
|
|
projectId: PropTypes.string.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
/* eslint-disable react/forbid-prop-types */
|
|
|
|
users: PropTypes.array.isRequired,
|
|
|
|
labels: PropTypes.array.isRequired,
|
|
|
|
tasks: PropTypes.array.isRequired,
|
2020-04-21 05:04:34 +05:00
|
|
|
attachments: PropTypes.array.isRequired,
|
2022-08-04 13:31:14 +02:00
|
|
|
activities: PropTypes.array.isRequired,
|
2020-05-05 01:30:06 +05:00
|
|
|
allProjectsToLists: PropTypes.array.isRequired,
|
2021-06-24 01:05:22 +05:00
|
|
|
allBoardMemberships: PropTypes.array.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
allLabels: PropTypes.array.isRequired,
|
|
|
|
/* eslint-enable react/forbid-prop-types */
|
2021-06-24 01:05:22 +05:00
|
|
|
canEdit: PropTypes.bool.isRequired,
|
2022-08-19 14:00:40 +02:00
|
|
|
canEditCommentActivities: PropTypes.bool.isRequired,
|
2022-08-04 13:31:14 +02:00
|
|
|
canEditAllCommentActivities: PropTypes.bool.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
onUpdate: PropTypes.func.isRequired,
|
2020-05-05 01:30:06 +05:00
|
|
|
onMove: PropTypes.func.isRequired,
|
|
|
|
onTransfer: PropTypes.func.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
onDelete: PropTypes.func.isRequired,
|
|
|
|
onUserAdd: PropTypes.func.isRequired,
|
|
|
|
onUserRemove: PropTypes.func.isRequired,
|
2020-05-05 01:30:06 +05:00
|
|
|
onBoardFetch: PropTypes.func.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
onLabelAdd: PropTypes.func.isRequired,
|
|
|
|
onLabelRemove: PropTypes.func.isRequired,
|
|
|
|
onLabelCreate: PropTypes.func.isRequired,
|
|
|
|
onLabelUpdate: PropTypes.func.isRequired,
|
|
|
|
onLabelDelete: PropTypes.func.isRequired,
|
|
|
|
onTaskCreate: PropTypes.func.isRequired,
|
|
|
|
onTaskUpdate: PropTypes.func.isRequired,
|
2022-07-21 11:31:05 +02:00
|
|
|
onTaskMove: PropTypes.func.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
onTaskDelete: PropTypes.func.isRequired,
|
2020-04-21 05:04:34 +05:00
|
|
|
onAttachmentCreate: PropTypes.func.isRequired,
|
|
|
|
onAttachmentUpdate: PropTypes.func.isRequired,
|
|
|
|
onAttachmentDelete: PropTypes.func.isRequired,
|
2022-08-04 13:31:14 +02:00
|
|
|
onActivitiesFetch: PropTypes.func.isRequired,
|
|
|
|
onActivitiesDetailsToggle: PropTypes.func.isRequired,
|
|
|
|
onCommentActivityCreate: PropTypes.func.isRequired,
|
|
|
|
onCommentActivityUpdate: PropTypes.func.isRequired,
|
|
|
|
onCommentActivityDelete: PropTypes.func.isRequired,
|
2019-08-31 04:07:25 +05:00
|
|
|
onClose: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
CardModal.defaultProps = {
|
|
|
|
description: undefined,
|
2019-10-05 06:12:36 +05:00
|
|
|
dueDate: undefined,
|
2019-08-31 04:07:25 +05:00
|
|
|
timer: undefined,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CardModal;
|