Extract shared UI primitives and a single money formatter #43

Open
opened 2026-07-17 03:08:50 +00:00 by claude-bot · 0 comments
Contributor

Small presentational components (Metric, Field, Check, Panel, Summary, ChartTooltip) are re-declared per tab (~13 files), and Metric has already forked into three prop APIs (warn/accent/positive). Money formatting is inconsistent: whole dollars in most tabs (BackupTab.jsx:333, DispatchImpactCard.jsx:122, RatePlanTable.jsx:142, QuotesTab.jsx:590 etc.) versus two-decimal in UsageImpactExplorer.jsx:443-459, BatteriesTab.jsx:101, OvernightFocusCards.jsx:93 for comparable figures.

Create src/components/ui/ with unified primitives (tone prop covering warn/accent/positive) and src/lib/format.js formatMoney. Migrate call sites opportunistically — the formatter first, since it changes user-visible numbers' consistency immediately.

Acceptance criteria

  • One money formatter; annual/system figures render with identical precision app-wide
  • Shared Metric/Field/Panel exist; at least the worst-drifted tabs migrated

(Audit finding F-23, 2026-07-16 — Severity: Low, Confidence: High)

Small presentational components (`Metric`, `Field`, `Check`, `Panel`, `Summary`, `ChartTooltip`) are re-declared per tab (~13 files), and `Metric` has already forked into three prop APIs (`warn`/`accent`/`positive`). Money formatting is inconsistent: whole dollars in most tabs (`BackupTab.jsx:333`, `DispatchImpactCard.jsx:122`, `RatePlanTable.jsx:142`, `QuotesTab.jsx:590` etc.) versus two-decimal in `UsageImpactExplorer.jsx:443-459`, `BatteriesTab.jsx:101`, `OvernightFocusCards.jsx:93` for comparable figures. Create `src/components/ui/` with unified primitives (`tone` prop covering warn/accent/positive) and `src/lib/format.js` `formatMoney`. Migrate call sites opportunistically — the formatter first, since it changes user-visible numbers' consistency immediately. **Acceptance criteria** - [ ] One money formatter; annual/system figures render with identical precision app-wide - [ ] Shared Metric/Field/Panel exist; at least the worst-drifted tabs migrated *(Audit finding F-23, 2026-07-16 — Severity: Low, Confidence: High)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/BatteryStorageCalculator#43
No description provided.