Skip to content

Commit

Permalink
feat: [skip ci] show overdue in today, show DONE status
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenull committed Mar 5, 2022
1 parent 4d89085 commit f793eb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const App: React.FC<{ env: string }> = ({ env }) => {
// category: 'time',
// dueDateClass: '',
// start: day().format(),
// // isAllDay: true,
// isAllDay: true,
// body: 'Daily Log test detail\n123',
// }, {
// id: '1',
Expand All @@ -93,6 +93,7 @@ const App: React.FC<{ env: string }> = ({ env }) => {
// start: day().format(),
// // isAllDay: true,
// body: 'Daily Log test detail\n123',
// customStyle: 'opacity: 0.6;',
// }])

calendar.render()
Expand Down
21 changes: 16 additions & 5 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,27 @@ export const getSchedules = async () => {

let _category: ICategory = hasTime ? 'time' : 'allday'
if (isMilestone) _category = 'milestone'
if (!isMilestone && isOverdue(block, end || start)) _category = 'task'
const _isOverdue = isOverdue(block, end || start)
if (!isMilestone && _isOverdue) _category = 'task'


return genSchedule({
const schedule = genSchedule({
blockData: block,
category: _category,
start: _start,
end: _end,
calendarConfig,
})

// show overdue tasks in today
return _isOverdue
? [
schedule,
genSchedule({
blockData: block,
category: _category,
calendarConfig,
})
]
: schedule
})
})

Expand Down Expand Up @@ -371,7 +381,7 @@ function genSchedule(params: {
?.replace(new RegExp(`^${blockData.marker}`), '')
?.replace(/^\d{2}:\d{2}/, '')
?.trim?.()

const isDone = blockData.marker === 'DONE'
return {
id: blockData.id,
calendarId: calendarConfig.id,
Expand All @@ -386,6 +396,7 @@ function genSchedule(params: {
bgColor: calendarConfig?.bgColor,
borderColor: calendarConfig?.borderColor,
isAllDay,
customStyle: isDone ? 'opacity: 0.65;' : '',
}
}

Expand Down

0 comments on commit f793eb1

Please sign in to comment.