feat: Integrate KanbanBoard component with drag-and-drop functionality using @hello-pangea/dnd

This commit is contained in:
Roberto Musso
2026-02-21 01:10:16 +01:00
parent c75788503f
commit 40ac075633
10 changed files with 350 additions and 79 deletions

View File

@@ -226,3 +226,26 @@
- GanttChart is designed for reuse: the `defaultProjectId` prop on AddCheckpointDialog pre-selects the project and hides the dropdown (for per-project timeline in US-015)
- `trpc.projects.listAll.useQuery(undefined, { enabled: showProjectSelect })` prevents unnecessary queries when project is already known
---
## 2026-02-21 - US-014
- What was implemented:
- Installed `@hello-pangea/dnd` for drag-and-drop support
- Created `KanbanBoard` component at `src/renderer/components/projects/KanbanBoard.tsx`
- `DragDropContext` wraps 3 `Droppable` columns: To Do (`todo`), In Progress (`in_progress`), Completed (`done`)
- Each task is a `Draggable` wrapping the shared `TaskRow` component (same UI as global Tasks view)
- Drag-and-drop between columns calls `tasks.update({ id, status })` via tRPC mutation
- Each column header shows: status label, `Badge` (variant=secondary) with task count, `Button` (variant=ghost, size=sm) with "+ Add"
- "+ Add" opens `NewTaskDialog` with `defaultProjectId` and `defaultStatus` pre-set to the column's status
- `EditTaskDialog` integrated for right-click context menu editing
- `tasks.delete` integrated for right-click context menu deletion
- Added "Tasks" section with `KanbanBoard` to `ProjectDetail.tsx` below the AI summary card
- Tasks with unknown status values fall back to the "To Do" column
- Drop zones highlight with `bg-muted/50` when dragging over
- Files changed: `src/renderer/components/projects/KanbanBoard.tsx` (new), `src/renderer/components/projects/ProjectDetail.tsx`, `prd.json`, `progress.txt`, `package.json`, `package-lock.json`
- **Learnings for future iterations:**
- `@hello-pangea/dnd` ships its own TypeScript declarations — no `@types/` package needed
- `TaskRow` component from the global Tasks view is fully reusable inside Kanban `Draggable` wrappers — its `ContextMenu` (Edit/Delete) still works correctly inside drag-and-drop contexts
- `NewTaskDialog` accepts `defaultStatus` prop which resets correctly on close via `resetAndClose()` — ideal for column-specific "+ Add" buttons
- When grouping tasks by status for Kanban columns, always handle unknown/null status values with a fallback to prevent tasks from disappearing
- `DragDropContext.onDragEnd` provides `draggableId` which maps directly to `task.id` — no need to look up the task object for status updates
---