diff --git a/package.json b/package.json index 5ceb677..7d2e1e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.108.4", + "version": "1.109.0", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index cc66825..e48d783 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -8530,13 +8530,17 @@ export default function WeeklyView() { }} > {(() => { - const slotCount = getSomedaySlotCount(list.tasks); - const indexedTasks = list.tasks.filter(t => t.somedaySlotIndex !== null && t.somedaySlotIndex !== undefined && t.somedaySlotIndex < slotCount); - const unindexedTasks = list.tasks.filter(t => t.somedaySlotIndex === null || t.somedaySlotIndex === undefined || t.somedaySlotIndex >= slotCount); - + // Separate complete from active so done tasks always render at bottom + const activeTasks = list.tasks.filter(t => !t.completed); + const doneTasks = list.tasks.filter(t => t.completed); + + const slotCount = getSomedaySlotCount(activeTasks); + const indexedTasks = activeTasks.filter(t => t.somedaySlotIndex !== null && t.somedaySlotIndex !== undefined && t.somedaySlotIndex < slotCount); + const unindexedTasks = activeTasks.filter(t => t.somedaySlotIndex === null || t.somedaySlotIndex === undefined || t.somedaySlotIndex >= slotCount); + // Fill indexed slots and put unindexed tasks in empty slots starting from top const slots = Array.from({ length: slotCount }, (_, i) => ({ index: i, task: indexedTasks.find(t => t.somedaySlotIndex === i) || null })); - + let unindexedIdx = 0; const finalSlots = slots.map(slot => { if (!slot.task && unindexedIdx < unindexedTasks.length) { @@ -8545,7 +8549,7 @@ export default function WeeklyView() { return slot; }); - // Any remaining unindexed tasks that didn't fit in slots + // Any remaining unindexed active tasks that didn't fit in slots const remainingTasks = unindexedTasks.slice(unindexedIdx); return ( @@ -8718,6 +8722,41 @@ export default function WeeklyView() { /> ))} + {/* Completed tasks always rendered at bottom */} + {doneTasks.map((task) => ( +