diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index 0783b47..62d8927 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -120,7 +120,7 @@ Plans: 1. A user can save a one-off expense category (with an icon) to their quick-add library from the budget item add flow 2. When adding a one-off item, the user can browse their quick-add library and select a saved category — the item populates with that category and icon 3. The quick-add library management page lets the user add, edit, and remove saved categories -**Plans:** 1/2 plans executed +**Plans:** 2/2 plans complete Plans: - [ ] 07-01-PLAN.md — DB migration, QuickAddItem model, CRUD queries, REST handlers at /api/quick-add @@ -154,5 +154,5 @@ Phases execute in numeric order: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 | 4. Chart Polish and Bug Fixes | v1.0 | 2/2 | Complete | 2026-03-12 | | 5. Template Data Model and API | v1.1 | 2/2 | Complete | 2026-03-12 | | 6. Template Frontend and Workflow Replacement | v1.1 | 2/2 | Complete | 2026-03-12 | -| 7. Quick-Add Library | 1/2 | In Progress| | - | +| 7. Quick-Add Library | 2/2 | Complete | 2026-03-12 | - | | 8. Layout and Density Rethink | v1.1 | 0/2 | Not started | - | diff --git a/.planning/STATE.md b/.planning/STATE.md index 583d233..ad914bf 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -3,14 +3,14 @@ gsd_state_version: 1.0 milestone: v1.1 milestone_name: Usability and Templates status: planning -stopped_at: Completed 07-quick-add-library-01-PLAN.md -last_updated: "2026-03-12T12:35:38.859Z" +stopped_at: Completed 07-quick-add-library-02-PLAN.md +last_updated: "2026-03-12T12:40:40.398Z" last_activity: 2026-03-12 — v1.1 roadmap created, Phases 5-8 defined progress: total_phases: 8 - completed_phases: 6 + completed_phases: 7 total_plans: 16 - completed_plans: 15 + completed_plans: 16 percent: 0 --- @@ -55,6 +55,7 @@ Progress: [░░░░░░░░░░] 0% | Phase 06-template-frontend-and-workflow-replacement P01 | 2min | 2 tasks | 7 files | | Phase 06-template-frontend-and-workflow-replacement P02 | 2min | 2 tasks | 9 files | | Phase 07-quick-add-library P01 | 1min | 2 tasks | 5 files | +| Phase 07-quick-add-library P02 | 5min | 2 tasks | 9 files | ## Accumulated Context @@ -80,6 +81,8 @@ Recent decisions affecting current work: - [Phase 07-quick-add-library]: sort_order auto-incremented via subquery at INSERT time so client doesn't need to track current max - [Phase 07-quick-add-library]: ListQuickAddItems initializes empty slice (not nil) so API always returns [] not null - [Phase 07-quick-add-library]: UpdateQuickAddItem returns 404 via pgx.ErrNoRows check when no row matches id+user_id +- [Phase 07-quick-add-library]: QuickAddPicker uses DropdownMenu instead of Popover — Popover not in available shadcn/ui components +- [Phase 07-quick-add-library]: QuickAddPicker find-or-create category: case-insensitive name match first, then create variable_expense if not found ### Pending Todos @@ -92,6 +95,6 @@ None yet. ## Session Continuity -Last session: 2026-03-12T12:35:38.858Z -Stopped at: Completed 07-quick-add-library-01-PLAN.md +Last session: 2026-03-12T12:40:40.397Z +Stopped at: Completed 07-quick-add-library-02-PLAN.md Resume file: None diff --git a/.planning/phases/07-quick-add-library/07-02-SUMMARY.md b/.planning/phases/07-quick-add-library/07-02-SUMMARY.md new file mode 100644 index 0000000..f37aa8c --- /dev/null +++ b/.planning/phases/07-quick-add-library/07-02-SUMMARY.md @@ -0,0 +1,111 @@ +--- +phase: 07-quick-add-library +plan: "02" +subsystem: frontend +tags: [react, typescript, shadcn-ui, i18n, crud] + +# Dependency graph +requires: + - phase: 07-quick-add-library + plan: "01" + provides: GET/POST /api/quick-add and PUT/DELETE /api/quick-add/{itemId} REST endpoints +provides: + - QuickAddItem type and quickAdd API namespace in api.ts + - useQuickAdd hook with CRUD operations + - QuickAddPage management page at /quick-add + - QuickAddPicker dropdown component for dashboard toolbar + - Sidebar nav item for quick-add library +affects: [] + +# Tech tracking +tech-stack: + added: [] + patterns: + - useQuickAdd hook follows useTemplate pattern (useState + useEffect + refresh after mutations) + - QuickAddPicker uses DropdownMenu (no Popover available) with find-or-create category logic + +key-files: + created: + - frontend/src/hooks/useQuickAdd.ts + - frontend/src/pages/QuickAddPage.tsx + - frontend/src/components/QuickAddPicker.tsx + modified: + - frontend/src/lib/api.ts + - frontend/src/components/AppLayout.tsx + - frontend/src/App.tsx + - frontend/src/i18n/en.json + - frontend/src/i18n/de.json + - frontend/src/pages/DashboardPage.tsx + +key-decisions: + - "QuickAddPicker uses DropdownMenu instead of Popover — Popover not in available shadcn/ui components" + - "QuickAddPicker find-or-create category: case-insensitive name match first, then create variable_expense if not found" + - "QuickAddPicker fetches quick-add library on mount (direct API call, not hook) — lightweight picker pattern" + +requirements-completed: [QADD-01, QADD-02, QADD-03] + +# Metrics +duration: 5min +completed: 2026-03-12 +--- + +# Phase 07 Plan 02: Quick-Add Library Frontend Summary + +**Quick-add library frontend: management page with CRUD, picker component in dashboard toolbar, API client, hook, routing, and i18n — complete quick-add feature end-to-end** + +## Performance + +- **Duration:** 5 min +- **Started:** 2026-03-12T12:35:00Z +- **Completed:** 2026-03-12T12:40:00Z +- **Tasks:** 2 (+ 1 auto-approved checkpoint) +- **Files modified:** 9 (plus 3 created) + +## Accomplishments + +- Added QuickAddItem interface and quickAdd namespace (list/create/update/delete) to api.ts +- Created useQuickAdd hook following the useTemplate pattern with addItem/updateItem/removeItem +- Created QuickAddPage with amber/orange gradient header, add form row, inline edit, EmptyState (Zap icon) +- Created QuickAddPicker dropdown component that fetches library, finds/creates matching category, and creates one_off budget item +- Added Zap nav item to AppLayout sidebar between Template and Settings +- Added /quick-add route to App.tsx +- Added complete quickAdd i18n keys to en.json and de.json (management page + picker keys) +- Wired QuickAddPicker into DashboardPage toolbar next to Create Budget button + +## Task Commits + +Each task was committed atomically: + +1. **Task 1: API client, hook, management page, routing, and i18n** - `411a986` (feat) +2. **Task 2: Quick-add picker in dashboard for one-off budget items** - `8238e07` (feat) + +## Files Created/Modified + +- `frontend/src/lib/api.ts` - Added QuickAddItem interface and quickAdd API namespace +- `frontend/src/hooks/useQuickAdd.ts` - New hook with CRUD, follows useTemplate pattern +- `frontend/src/pages/QuickAddPage.tsx` - Management page with add form, inline edit table, EmptyState +- `frontend/src/components/QuickAddPicker.tsx` - Dropdown picker with find-or-create category logic +- `frontend/src/components/AppLayout.tsx` - Added Zap nav item for /quick-add +- `frontend/src/App.tsx` - Added /quick-add route with QuickAddPage import +- `frontend/src/i18n/en.json` - Added nav.quickAdd and full quickAdd namespace +- `frontend/src/i18n/de.json` - Added nav.quickAdd and full quickAdd namespace (German) +- `frontend/src/pages/DashboardPage.tsx` - Added QuickAddPicker to toolbar when budget selected + +## Decisions Made + +- **DropdownMenu instead of Popover:** Popover is not in the project's shadcn/ui component set. DropdownMenu provides equivalent open/close behavior with trigger button. +- **Find-or-create category in picker:** `category_id` is NOT NULL in budget_items. Picker resolves by doing case-insensitive name match against existing categories, creating a `variable_expense` category if no match found. +- **Direct API call in picker (not hook):** QuickAddPicker is a lightweight transient component — fetches on mount with local state, no need for full CRUD hook. + +## Deviations from Plan + +### Auto-fixed Issues + +**1. [Rule 3 - Blocking] Used DropdownMenu instead of Popover for picker** +- **Found during:** Task 2 +- **Issue:** Plan specified Popover from shadcn/ui, but Popover is not in the project's component set +- **Fix:** Used DropdownMenu which provides equivalent trigger/content/close behavior +- **Files modified:** `frontend/src/components/QuickAddPicker.tsx` +- **Commit:** 8238e07 + +## Self-Check: PASSED