Skip to content

Commit

Permalink
work on un-complete past-due confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Nov 20, 2024
1 parent 0deaf5c commit 5334620
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Use `pnpm verify` to check that code changes are valid.
- Pending: Can edit, complete, uncle, copy
- Complete: Can mark incomplete, copy
- Expired: Can copy
- Completing tasks requires careful handling:
- Marking tasks complete is a critical action
- Reversing completed tasks requires support intervention
- UI should prevent accidental completion

## Future Improvements

Expand Down
12 changes: 12 additions & 0 deletions src/components/task.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
async function toggleComplete() {
if (!task.id) return;
const taskDue = new Date(task.due);
const now = new Date();
const isPastDue = taskDue < now;
if (isPastDue && !task.complete) {
const confirmed = confirm(
'This task is past due. Marking it complete will require contacting support to undo. Continue?'
);
if (!confirmed) return;
}
await updateTask(task.id, { complete: !task.complete });
task.complete = !task.complete;
task.status = task.complete ? 'complete' : 'pending';
Expand Down

0 comments on commit 5334620

Please sign in to comment.