feat(HAI-100): add columnMovedAt timestamp and sort board tasks by move order

- Add columnMovedAt field to task types
- Set columnMovedAt on task creation and column moves in store
- Sort tasks by columnMovedAt descending in Board component
- Add store tests for columnMovedAt behavior
This commit is contained in:
Dustin Byrne
2026-03-26 20:12:30 -04:00
parent a8b767d6fc
commit 57e380bb0f
4 changed files with 58 additions and 3 deletions

View File

@@ -24,7 +24,18 @@ export function Board({ tasks, maxConcurrent, onMoveTask, onOpenDetail, addToast
<Column
key={col}
column={col}
tasks={tasks.filter((t) => t.column === col)}
tasks={tasks
.filter((t) => t.column === col)
.sort((a, b) => {
// Tasks with columnMovedAt sort descending (most recent first)
// Tasks without it (legacy) fall to the bottom, sorted by createdAt ascending
if (a.columnMovedAt && b.columnMovedAt) {
return b.columnMovedAt.localeCompare(a.columnMovedAt);
}
if (a.columnMovedAt && !b.columnMovedAt) return -1;
if (!a.columnMovedAt && b.columnMovedAt) return 1;
return a.createdAt.localeCompare(b.createdAt);
})}
allTasks={tasks}
maxConcurrent={maxConcurrent}
onMoveTask={onMoveTask}