whisper-money/resources/js/lib
Víctor Falcón c5df59c285 feat: add multiple chart view modes for net worth evolution (#37)
## Summary

- Add four view modes for net worth and account balance charts:
- **Stacked Accounts**: existing stacked bar chart showing balances by
account
  - **Line**: net worth line chart with linear/log scale toggle
  - **Change**: bar chart showing MoM%, YoY%, Rolling 12M changes
- **Waterfall**: bridge chart showing Start -> Change -> End transition

- Add Vitest for frontend unit testing with 52 tests covering all
calculation functions
- Proper sign handling for liabilities (credit cards and loans subtract
from net worth)
- Log scale disabled with warning when net worth includes zero or
negative values
- Shared components and logic between dashboard and account detail
charts

## New Files

- `vitest.config.ts` - Vitest configuration
- `resources/js/lib/chart-calculations.ts` - Pure computation functions
- `resources/js/lib/chart-calculations.test.ts` - 52 unit tests
- `resources/js/hooks/use-chart-views.ts` - Shared chart view state hook
- `resources/js/components/charts/` - Reusable chart components

## Test plan

- [x] Dashboard net worth chart shows view toggle and all four views
work
- [ ] Account detail page chart shows view toggle and three views work
(no stacked)
- [x] Line chart scale toggle works (log disabled with warning when
applicable)
- [x] Change chart series toggle (MoM, YoY, 12M EUR, 12M %) works
- [x] Waterfall chart month selector works
- [x] All 52 unit tests pass (`bun run test`)
- [x] Build succeeds (`bun run build`)
- [x] Dark mode styling correct
2025-12-30 07:22:19 +01:00
..
balance-import-config-storage.ts fix: add SSR guards to localStorage/sessionStorage access 2025-12-08 18:19:20 +01:00
chart-calculations.test.ts feat: add multiple chart view modes for net worth evolution (#37) 2025-12-30 07:22:19 +01:00
chart-calculations.ts feat: add multiple chart view modes for net worth evolution (#37) 2025-12-30 07:22:19 +01:00
constants.ts welcome-page: explain e2e encryption 2025-12-30 07:22:18 +01:00
crypto.ts Add some toast notifications 2025-11-11 11:39:28 +00:00
db-migration-helper.ts Add some toast notifications 2025-11-11 11:39:28 +00:00
debug.ts fix: make useIsMobile hook and utility functions SSR-safe 2025-12-08 17:33:54 +01:00
dexie-db.ts feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
file-parser.ts Fix CI: Update bun.lock and fix linting errors 2025-12-01 15:16:06 +01:00
import-config-storage.ts fix: add SSR guards to localStorage/sessionStorage access 2025-12-08 18:19:20 +01:00
key-storage.ts fix: make encryption key storage SSR-safe to prevent 502 errors 2025-12-08 17:13:45 +01:00
rule-builder-utils.ts Smart rules: Change operator to `OR` by default (#7) 2025-12-03 10:16:29 +01:00
rule-engine.ts fix: automated rules broken and now they work in batches 2025-12-16 12:01:38 +01:00
sync-manager.ts Add pending operations dialog and improve sync status UI (#16) 2025-12-06 21:54:11 +01:00
track-event.ts fix: make useIsMobile hook and utility functions SSR-safe 2025-12-08 17:33:54 +01:00
user-session-storage.ts User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
utils.ts Prevent duplicate notes when re-evaluating automation rules 2025-12-04 16:42:54 +01:00