5.6 KiB
5.6 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, key-decisions, patterns-established, requirements-completed, duration, completed
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | key-decisions | patterns-established | requirements-completed | duration | completed | |||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 04-chart-polish-and-bug-fixes | 02 | ui |
|
|
|
|
|
|
|
|
|
10min | 2026-03-12 |
Phase 4 Plan 02: Chart Tooltip Currency Formatting Summary
Custom Recharts tooltips on both charts show locale-aware formatted currency, with user.preferred_locale threaded from useAuth through DashboardPage
Performance
- Duration: 10 min
- Started: 2026-03-12T09:25:00Z
- Completed: 2026-03-12T09:35:00Z
- Tasks: 2
- Files modified: 4
Accomplishments
- ExpenseBreakdown pie chart replaces bare
<Tooltip />with custom content renderer showing category name and formatCurrency-formatted value - AvailableBalance donut chart gains a Tooltip for the first time, using same custom renderer pattern; center text also receives locale
- DashboardPage imports useAuth, derives userLocale with fallback to 'en', and passes it as locale prop to both chart components
Task Commits
Each task was committed atomically:
- Task 1: Add locale prop and custom Tooltip to both chart components -
f141c4f(feat) - Task 2: Thread user locale from useAuth through DashboardPage to chart components -
5a70899(feat)
Plan metadata: (docs commit — see final_commit)
Files Created/Modified
frontend/src/components/ExpenseBreakdown.tsx- Added locale prop, formatCurrency import, custom Tooltip content rendererfrontend/src/components/AvailableBalance.tsx- Added locale prop, Tooltip import, custom Tooltip content renderer, locale passed to center text formatCurrencyfrontend/src/pages/DashboardPage.tsx- Added useAuth import, userLocale derivation, locale prop passed to AvailableBalance and ExpenseBreakdownfrontend/src/pages/DashboardPage.test.tsx- Added useAuth mock to prevent i18n initReactI18next error
Decisions Made
- Custom Tooltip uses shadcn CSS variable classes (bg-background, border-border/50, shadow-xl) rather than importing ChartTooltipContent — aligns with project rule against editing ui/ source files
- Locale threading scoped to chart components only — table components already have 'en' default via formatCurrency, full threading deferred per plan spec
- DashboardPage.test.tsx required a useAuth mock because useAuth imports @/i18n which calls i18n.use(initReactI18next) — the existing react-i18next mock did not export initReactI18next
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] DashboardPage test broken by new useAuth import
- Found during: Task 2 (Thread user locale from useAuth through DashboardPage)
- Issue: Adding
useAuthto DashboardPage caused the test file to fail with "No initReactI18next export defined on react-i18next mock" — because useAuth transitively imports @/i18n which calls i18n.use(initReactI18next) - Fix: Added
vi.mock('@/hooks/useAuth', ...)to DashboardPage.test.tsx, returning a user with preferred_locale: 'en' - Files modified: frontend/src/pages/DashboardPage.test.tsx
- Verification: Full test suite passes (51 tests), production build succeeds with no TypeScript errors
- Committed in:
5a70899(Task 2 commit)
Total deviations: 1 auto-fixed (Rule 1 - bug introduced by task change) Impact on plan: Auto-fix was necessary to restore test suite. No scope creep.
Issues Encountered
None beyond the auto-fixed test breakage above.
User Setup Required
None - no external service configuration required.
Next Phase Readiness
- Both chart components now display locale-aware currency tooltips
- Locale threading pattern established: page-level useAuth() call + optional locale prop with 'en' default
- Ready to extend locale threading to table components if desired in a future plan
Phase: 04-chart-polish-and-bug-fixes Completed: 2026-03-12