Skip to content

Commit 4762758

Browse files
committed
fix: Cursor for DueDates, new disabled popup syntax
1 parent 758392b commit 4762758

File tree

6 files changed

+25
-36
lines changed

6 files changed

+25
-36
lines changed

client/src/components/Board/ListView/DueDateCell/DueDateCell.jsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ const DueDateCell = React.memo(({ dueDate, cellClassName, canEdit, onUpdate }) =
3737

3838
return (
3939
<div className={cellClassName}>
40-
{canEdit ? (
41-
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
42-
<DueDate value={dueDate} />
43-
</DueDateEditPopup>
44-
) : (
45-
<DueDate value={dueDate} />
46-
)}
40+
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate} disabled={!canEdit}>
41+
<DueDate value={dueDate} isClickable={canEdit} />
42+
</DueDateEditPopup>
4743
</div>
4844
);
4945
});

client/src/components/Card/Card.jsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,9 @@ const Card = React.memo(
237237
)}
238238
{dueDate && (
239239
<span className={classNames(s.attachment, s.attachmentLeft)}>
240-
{canEdit ? (
241-
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
242-
<DueDate value={dueDate} variant="card" />
243-
</DueDateEditPopup>
244-
) : (
245-
<DueDate value={dueDate} variant="card" />
246-
)}
240+
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate} disabled={!canEdit}>
241+
<DueDate value={dueDate} variant="card" isClickable={canEdit} />
242+
</DueDateEditPopup>
247243
</span>
248244
)}
249245
{timer && (

client/src/components/CardModal/CardModal.jsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,9 @@ const CardModal = React.memo(
501501
)}
502502
</div>
503503
<span className={s.headerItem}>
504-
{canEdit ? (
505-
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
506-
<DueDate value={dueDate} />
507-
</DueDateEditPopup>
508-
) : (
509-
<DueDate value={dueDate} />
510-
)}
504+
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate} disabled={!canEdit}>
505+
<DueDate value={dueDate} isClickable={canEdit} />
506+
</DueDateEditPopup>
511507
</span>
512508
</div>
513509
);

client/src/components/DueDate/DueDate.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const getDueStyle = (value) => {
3333
};
3434

3535
// TODO remove old onClick and Button variant
36-
const DueDate = React.memo(({ value, variant, isDisabled, titlePrefix, iconSize, className, onClick }) => {
36+
const DueDate = React.memo(({ value, variant, isDisabled, titlePrefix, iconSize, isClickable, className, onClick }) => {
3737
const [t] = useTranslation();
3838
const [dueStyle, setDueStyle] = useState('Normal');
3939

@@ -51,7 +51,7 @@ const DueDate = React.memo(({ value, variant, isDisabled, titlePrefix, iconSize,
5151

5252
const contentNode = value && (
5353
<span
54-
className={classNames(s.wrapper, s[`wrapper${upperFirst(variant)}`], s[`due${dueStyle}`], className)}
54+
className={classNames(s.wrapper, s[`wrapper${upperFirst(variant)}`], s[`due${dueStyle}`], (onClick || isClickable) && s.dueDateHoverable, className)}
5555
title={`${titlePrefixString}${t(variant === VARIANTS.LIST_VIEW ? `format:dateTime` : `format:date`, { value, postProcess: 'formatDate' })}`}
5656
>
5757
{variant !== VARIANTS.TASKS_CARD && variant !== VARIANTS.LIST_VIEW && t(`format:date`, { value, postProcess: 'formatDate' })}
@@ -75,6 +75,7 @@ DueDate.propTypes = {
7575
isDisabled: PropTypes.bool,
7676
titlePrefix: PropTypes.string,
7777
iconSize: PropTypes.oneOf(Object.values(IconSize)),
78+
isClickable: PropTypes.bool,
7879
className: PropTypes.string,
7980
onClick: PropTypes.func,
8081
};
@@ -85,6 +86,7 @@ DueDate.defaultProps = {
8586
isDisabled: false,
8687
titlePrefix: undefined,
8788
iconSize: IconSize.Size13,
89+
isClickable: false,
8890
className: undefined,
8991
onClick: undefined,
9092
};

client/src/components/DueDate/DueDate.module.scss

+8-5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
fill: var(--textColor1);
4040
}
4141

42+
.dueDateHoverable {
43+
cursor: pointer;
44+
45+
&:hover {
46+
filter: brightness(85%);
47+
}
48+
}
49+
4250
/* Variants */
4351

4452
.wrapperCard {
@@ -51,11 +59,6 @@
5159
font-size: 14px;
5260
font-weight: bold;
5361
line-height: 28px;
54-
cursor: pointer;
55-
56-
&:hover {
57-
filter: brightness(85%);
58-
}
5962
}
6063

6164
.wrapperTasksCard {

client/src/components/Tasks/Item.jsx

+4-8
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,10 @@ const Item = React.memo(({ variant, id, index, name, dueDate, boardMemberships,
140140
membersNode
141141
))}
142142
{dueDate && (
143-
<div className={classNames(s.dueDate, gs.cursorPointer, isCompleted && s.itemCompleted, variant !== VARIANTS.CARDMODAL && s.dueDateCard)}>
144-
{isPersisted && canEdit ? (
145-
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate}>
146-
<DueDate variant={dueDateVariant} value={dueDate} />
147-
</DueDateEditPopup>
148-
) : (
149-
<DueDate variant={dueDateVariant} value={dueDate} />
150-
)}
143+
<div className={classNames(s.dueDate, canEdit && gs.cursorGrab, isCompleted && s.itemCompleted, variant !== VARIANTS.CARDMODAL && s.dueDateCard)}>
144+
<DueDateEditPopup defaultValue={dueDate} onUpdate={handleDueDateUpdate} disabled={!(canEdit && isPersisted)}>
145+
<DueDate variant={dueDateVariant} value={dueDate} isClickable={canEdit && isPersisted} />
146+
</DueDateEditPopup>
151147
</div>
152148
)}
153149
{isPersisted && canEdit && (

0 commit comments

Comments
 (0)