2.1 KiB
2.1 KiB
Phase 7: Weight Unit Selection - Context
Gathered: 2026-03-16 Status: Ready for planning
## Phase BoundaryUsers can select a preferred weight unit (g, oz, lb, kg) and all weight displays across the app reflect that choice. Weight input stays in grams. The setting persists across sessions.
## Implementation DecisionsClaude's Discretion
- Unit selector placement (TotalsBar, settings page, or elsewhere)
- Pounds display format (traditional "2 lb 3 oz" vs decimal "2.19 lb")
- Precision per unit (decimal places for oz, kg)
- Default unit (grams, matching current behavior)
- How formatWeight gets access to the setting (hook, context, parameter)
<code_context>
Existing Code Insights
Reusable Assets
formatWeight()insrc/client/lib/formatters.ts: CurrentlyMath.round(grams) + "g"— single conversion point for all weight displayuseSetting(key)hook insrc/client/hooks/useSettings.ts: Fetches from/api/settings/:key, caches with React QueryuseUpdateSetting()mutation: PUT to/api/settings/:key, invalidates query cache- Settings API already exists with get/put endpoints
Established Patterns
- Settings stored as key/value strings in SQLite
settingstable - React Query for server state, Zustand for UI-only state
- Pill badges for weight/price display on ItemCard and CandidateCard (blue-50/blue-400 for weight)
Integration Points
formatWeight()call sites (~8 components): TotalsBar, ItemCard, CandidateCard, CategoryHeader, SetupCard, ItemPicker, collection route, setup detail routeformatPrice()is in the same file — similar pattern, not affected by this phase- TotalsBar already imports
useTotals()andformatWeight— natural place for a unit toggle
</code_context>
## Specific IdeasNo specific requirements — user gave full discretion. Standard gear app patterns apply (LighterPack-style toggle).
## Deferred IdeasNone — discussion stayed within phase scope
Phase: 07-weight-unit-selection Context gathered: 2026-03-16