docs(07-02): complete weight unit UI wiring plan

- Created 07-02-SUMMARY.md with task commits and deviations
- Updated STATE.md: Phase 7 complete, progress 100%
- Updated ROADMAP.md: Phase 07 marked complete
- Marked UNIT-01 requirement complete in REQUIREMENTS.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 12:25:22 +01:00
parent faa437896f
commit a9f802ab68
3 changed files with 133 additions and 16 deletions

View File

@@ -17,7 +17,7 @@ Requirements for this milestone. Each maps to roadmap phases.
### Weight Units ### Weight Units
- [ ] **UNIT-01**: User can select preferred weight unit (g, oz, lb, kg) from settings - [x] **UNIT-01**: User can select preferred weight unit (g, oz, lb, kg) from settings
- [x] **UNIT-02**: All weight displays across the app reflect the selected unit - [x] **UNIT-02**: All weight displays across the app reflect the selected unit
- [x] **UNIT-03**: Weight unit preference persists across sessions - [x] **UNIT-03**: Weight unit preference persists across sessions
@@ -94,7 +94,7 @@ Which phases cover which requirements. Updated during roadmap creation.
| SRCH-03 | Phase 8 | Pending | | SRCH-03 | Phase 8 | Pending |
| SRCH-04 | Phase 8 | Pending | | SRCH-04 | Phase 8 | Pending |
| SRCH-05 | Phase 8 | Pending | | SRCH-05 | Phase 8 | Pending |
| UNIT-01 | Phase 7 | Pending | | UNIT-01 | Phase 7 | Complete |
| UNIT-02 | Phase 7 | Complete | | UNIT-02 | Phase 7 | Complete |
| UNIT-03 | Phase 7 | Complete | | UNIT-03 | Phase 7 | Complete |
| CLAS-01 | Phase 9 | Pending | | CLAS-01 | Phase 9 | Pending |

View File

@@ -3,15 +3,15 @@ gsd_state_version: 1.0
milestone: v1.2 milestone: v1.2
milestone_name: Collection Power-Ups milestone_name: Collection Power-Ups
status: executing status: executing
stopped_at: Completed 07-01-PLAN.md stopped_at: Completed 07-02-PLAN.md (Phase 7 complete)
last_updated: "2026-03-16T11:16:30Z" last_updated: "2026-03-16T11:24:58.469Z"
last_activity: 2026-03-16 -- Completed 07-01 weight unit core (formatWeight + useWeightUnit) last_activity: 2026-03-16 -- Completed 07-02 weight unit UI wiring (toggle + all call sites)
progress: progress:
total_phases: 3 total_phases: 3
completed_phases: 0 completed_phases: 1
total_plans: 2 total_plans: 2
completed_plans: 1 completed_plans: 2
percent: 17 percent: 100
--- ---
# Project State # Project State
@@ -21,16 +21,16 @@ progress:
See: .planning/PROJECT.md (updated 2026-03-16) See: .planning/PROJECT.md (updated 2026-03-16)
**Core value:** Make it effortless to manage gear and plan new purchases -- see how a potential buy affects your total setup weight and cost before committing. **Core value:** Make it effortless to manage gear and plan new purchases -- see how a potential buy affects your total setup weight and cost before committing.
**Current focus:** Phase 7 - Weight Unit Selection **Current focus:** Phase 7 complete -- ready for Phase 8
## Current Position ## Current Position
Phase: 7 of 9 (Weight Unit Selection) Phase: 7 of 9 (Weight Unit Selection) -- COMPLETE
Plan: 2 of 2 Plan: 2 of 2
Status: Executing Status: Phase Complete
Last activity: 2026-03-16 -- Completed 07-01 weight unit core (formatWeight + useWeightUnit) Last activity: 2026-03-16 -- Completed 07-02 weight unit UI wiring (toggle + all call sites)
Progress: [█░░░░░░░░░] 17% Progress: [██████████] 100%
## Accumulated Context ## Accumulated Context
@@ -44,6 +44,7 @@ Progress: [█░░░░░░░░░] 17%
- Candidate status and classification schema migrations in separate phases (sequential) - Candidate status and classification schema migrations in separate phases (sequential)
- Weight conversion precision: g=0dp, oz=1dp, lb=2dp, kg=2dp - Weight conversion precision: g=0dp, oz=1dp, lb=2dp, kg=2dp
- useWeightUnit validates stored value against known units to protect against corrupt data - useWeightUnit validates stored value against known units to protect against corrupt data
- Unit toggle placed between title and stats in TotalsBar for subtle utility placement
### Pending Todos ### Pending Todos
@@ -55,6 +56,6 @@ None active.
## Session Continuity ## Session Continuity
Last session: 2026-03-16T11:16:30Z Last session: 2026-03-16T11:24:57.634Z
Stopped at: Completed 07-01-PLAN.md Stopped at: Completed 07-02-PLAN.md (Phase 7 complete)
Resume file: .planning/phases/07-weight-unit-selection/07-02-PLAN.md Resume file: None

View File

@@ -0,0 +1,116 @@
---
phase: 07-weight-unit-selection
plan: 02
subsystem: ui
tags: [weight-unit-toggle, react-hooks, settings-mutation, formatWeight]
# Dependency graph
requires:
- phase: 07-01
provides: "WeightUnit type, formatWeight(grams, unit), useWeightUnit() hook"
provides:
- "Segmented g/oz/lb/kg toggle in TotalsBar with settings persistence"
- "All weight displays across the app respect selected unit"
affects: []
# Tech tracking
tech-stack:
added: []
patterns: [segmented-pill-toggle, settings-mutation-via-useUpdateSetting]
key-files:
created: []
modified:
- src/client/components/TotalsBar.tsx
- src/client/components/ItemCard.tsx
- src/client/components/CandidateCard.tsx
- src/client/components/CategoryHeader.tsx
- src/client/components/SetupCard.tsx
- src/client/components/ItemPicker.tsx
- src/client/routes/index.tsx
- src/client/routes/setups/$setupId.tsx
key-decisions:
- "Unit toggle placed between title and stats in TotalsBar flex container for subtle utility control placement"
- "Biome requires type imports after value imports in destructured import statements"
patterns-established:
- "All formatWeight calls pass unit from useWeightUnit -- no bare formatWeight(grams) in components"
- "Settings mutation for UI preferences: useUpdateSetting().mutate({ key, value })"
requirements-completed: [UNIT-01, UNIT-02, UNIT-03]
# Metrics
duration: 3min
completed: 2026-03-16
---
# Phase 7 Plan 02: Weight Unit UI Wiring Summary
**Segmented g/oz/lb/kg toggle in TotalsBar with all 8 weight display call sites wired to user-selected unit**
## Performance
- **Duration:** 3 min
- **Started:** 2026-03-16T11:20:20Z
- **Completed:** 2026-03-16T11:23:32Z
- **Tasks:** 2 (1 auto + 1 checkpoint auto-approved)
- **Files modified:** 8
## Accomplishments
- Added segmented pill toggle (g/oz/lb/kg) to TotalsBar with persistent settings via useUpdateSetting
- Wired all 8 formatWeight call sites to pass the selected unit from useWeightUnit hook
- All 108 existing tests pass with no regressions, lint clean
## Task Commits
Each task was committed atomically:
1. **Task 1: Add unit toggle to TotalsBar and update all call sites** - `faa4378` (feat)
2. **Task 2: Verify weight unit selection end-to-end** - auto-approved (checkpoint)
## Files Created/Modified
- `src/client/components/TotalsBar.tsx` - Added unit toggle UI, useUpdateSetting mutation, and unit-aware formatWeight calls
- `src/client/components/ItemCard.tsx` - Added useWeightUnit import and unit parameter to formatWeight
- `src/client/components/CandidateCard.tsx` - Added useWeightUnit import and unit parameter to formatWeight
- `src/client/components/CategoryHeader.tsx` - Added useWeightUnit import and unit parameter to formatWeight
- `src/client/components/SetupCard.tsx` - Added useWeightUnit import and unit parameter to formatWeight
- `src/client/components/ItemPicker.tsx` - Added useWeightUnit import and unit parameter to formatWeight
- `src/client/routes/index.tsx` - Added useWeightUnit import and unit parameter to Dashboard formatWeight
- `src/client/routes/setups/$setupId.tsx` - Added useWeightUnit import and unit parameter to Setup Detail formatWeight
## Decisions Made
- Unit toggle placed between title and stats in TotalsBar's flex container, keeping it visible but non-dominant as a small utility control
- Biome requires `type` imports after value imports in destructured statements (e.g., `{ formatWeight, type WeightUnit }`)
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 1 - Bug] Fixed import order for WeightUnit type in TotalsBar.tsx**
- **Found during:** Task 1 (TotalsBar modification)
- **Issue:** Biome lint required `type WeightUnit` to come after value imports in destructured import
- **Fix:** Changed `{ type WeightUnit, formatPrice, formatWeight }` to `{ formatPrice, formatWeight, type WeightUnit }`
- **Files modified:** src/client/components/TotalsBar.tsx
- **Verification:** `bun run lint` passes clean
- **Committed in:** faa4378 (Task 1 commit)
---
**Total deviations:** 1 auto-fixed (1 bug - lint import ordering)
**Impact on plan:** Trivial import ordering fix. No scope creep.
## Issues Encountered
None
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Phase 7 (Weight Unit Selection) is fully complete
- All 3 requirements (UNIT-01, UNIT-02, UNIT-03) satisfied
- Ready to proceed to Phase 8 (Candidate Status & Category Icons)
---
*Phase: 07-weight-unit-selection*
*Completed: 2026-03-16*