diff --git a/.planning/phases/07-weight-unit-selection/07-CONTEXT.md b/.planning/phases/07-weight-unit-selection/07-CONTEXT.md new file mode 100644 index 0000000..58b0168 --- /dev/null +++ b/.planning/phases/07-weight-unit-selection/07-CONTEXT.md @@ -0,0 +1,63 @@ +# Phase 7: Weight Unit Selection - Context + +**Gathered:** 2026-03-16 +**Status:** Ready for planning + + +## Phase Boundary + +Users 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 Decisions + +### Claude'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) + + + + +## Existing Code Insights + +### Reusable Assets +- `formatWeight()` in `src/client/lib/formatters.ts`: Currently `Math.round(grams) + "g"` — single conversion point for all weight display +- `useSetting(key)` hook in `src/client/hooks/useSettings.ts`: Fetches from `/api/settings/:key`, caches with React Query +- `useUpdateSetting()` 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 `settings` table +- 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 route +- `formatPrice()` is in the same file — similar pattern, not affected by this phase +- TotalsBar already imports `useTotals()` and `formatWeight` — natural place for a unit toggle + + + + +## Specific Ideas + +No specific requirements — user gave full discretion. Standard gear app patterns apply (LighterPack-style toggle). + + + + +## Deferred Ideas + +None — discussion stayed within phase scope + + + +--- + +*Phase: 07-weight-unit-selection* +*Context gathered: 2026-03-16*