feat: collapse subtasks from parent rows
ci / docker (push) Successful in 4m16s

This commit is contained in:
2026-09-08 10:31:31 +08:00
parent 3528e880f6
commit c8abb75cf4
4 changed files with 31 additions and 4 deletions
+5 -1
View File
@@ -5,6 +5,7 @@ export type MinimalTask = {
parent_id?: string | null
completed?: boolean
list_name?: string
subtasks?: MinimalTask[]
}
const escapeHtml = (value: string) =>
@@ -85,7 +86,10 @@ export function groupTaskTree<T extends MinimalTask>(tasks: T[]) {
if (!task.parent_id) continue
children.set(task.parent_id, [...(children.get(task.parent_id) ?? []), task])
}
return tasks.filter((task) => !task.parent_id).map((task) => ({ task, subtasks: children.get(task.id) ?? [] }))
return tasks.filter((task) => !task.parent_id).map((task) => ({
task,
subtasks: children.get(task.id) ?? (task.subtasks as T[] | undefined) ?? [],
}))
}
export function moveItemWithinScope<T extends { id: string; parent_id?: string | null }>(items: T[], sourceId: string, targetId: string, placement: 'before' | 'after') {