diff --git a/knowledge.md b/knowledge.md index 9443e7b..e83de43 100644 --- a/knowledge.md +++ b/knowledge.md @@ -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 diff --git a/src/components/task.svelte b/src/components/task.svelte index e4705a2..4c73bc7 100644 --- a/src/components/task.svelte +++ b/src/components/task.svelte @@ -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';