Dark Mode and Final Features
8 min read
Finish Progress and Clear Actions
Make sure the final task actions work with the complete task model.
The progress section should be calculated from the current tasks rather than hard-coded values. For example:
const completedCount = tasks.filter((task) => task.completed).length;
const totalCount = tasks.length;
const progress = totalCount === 0
? 0
: Math.round((completedCount / totalCount) * 100);
Update the prepared progress elements from these values whenever renderTasks() runs.
Then verify the clear-completed and clear-all controls use the custom confirmation workflow from Module 6 before changing the task array.
Checkpoint
Create a mixture of active and completed tasks. Confirm that progress updates after completion, reopening, deletion, and clearing tasks.