Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visual cue for overdue headers when displaying headers #970

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/components/OrgFile/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,19 @@ ${header.get('rawDescription')}`;
headerDeadlineMap.get('year')
: '';

const today = new Date();
const headerDate =
headerDeadlineMap !== undefined
? new Date(
headerDeadlineMap.get('year'),
headerDeadlineMap.get('month'),
headerDeadlineMap.get('day')
)
: today;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how you construct this new Date().
When I enter this weird order of arguments in node:

> Date('01-05-2022')
'Wed Nov 29 2023 21:54:27 GMT+0100 (Central European Standard Time)'

I'd suggest to pass a date in ISO format.


const headerSecondsToDue =
new Date(headerDate).setHours(0, 0, 0, 0) - new Date(today).setHours(0, 0, 0, 0);

const {
dragStartX,
currentDragX,
Expand Down Expand Up @@ -517,7 +530,11 @@ ${header.get('rawDescription')}`;
// Spacing between 'clock display' and 'deadline
// display' overlays
(showClockDisplay && showDeadlineDisplay ? ' ' : '') +
(showDeadlineDisplay && headerDeadline !== undefined ? headerDeadline : '')
(showDeadlineDisplay && headerDeadline !== undefined
? (headerSecondsToDue < 0 ? '**' : '') +
headerDeadline +
(headerSecondsToDue < 0 ? '**' : '')
: '')
}
/>

Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions src/components/OrgFile/components/TitleLine/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@
display: flex;
justify-content: space-between;
}

.title-line-overdue {
color: var(--red);
}