whisper-money/resources/js/components/ui
Víctor Falcón b743cad803
feat: Add multi-currency conversion for net worth charts (#138)
## Why

### Problem

Users with accounts in multiple currencies see raw balances on the net
worth chart without any conversion. A user with a USD-denominated
profile who also holds EUR and GBP accounts sees misleading totals — the
chart simply sums cents across currencies as if they were the same unit.

## What

### Changes

- **`ExchangeRateService`** — New service that wraps
`CurrencyConversionService` with DB-level caching. Checks the
`exchange_rates` table first, falls back to the external CDN API on
cache miss, and stores the full rate blob for future lookups.
- **`exchange_rates` migration + model** — New table with
`(base_currency, date)` unique constraint storing JSON rate blobs.
Includes factory.
- **`CurrencyConversionService`** — Made `getRatesForCurrency()` public
so `ExchangeRateService` can delegate to it.
- **`DashboardAnalyticsController`** — `netWorthEvolution` and
`netWorthDailyEvolution` endpoints now convert every account balance
from `account.currency_code` to `user.currency_code`. Response includes
`currency_code` field and `_original` data for foreign-currency
accounts.
- **Future date capping** — `ExchangeRateService::getRates()` caps any
future date to today, since the currency API only serves historical
rates. Prevents 500 errors when the chart requests end-of-month rates
for the current (incomplete) month.
- **Frontend charts** — Simplified to single-currency display. Removed
multi-currency `TotalDisplay` component; the chart header and tooltip
now show amounts in the user's currency. Foreign-currency accounts show
their original amount inline in the tooltip (e.g., "€2,000.00 →
$2,222.22").
- **`valueFormatter` type fix** — Changed return type from `string` to
`React.ReactNode` in chart component interfaces to match actual usage
with `AmountDisplay`.

## Screenshot
<img width="1266" height="649" alt="image"
src="https://github.com/user-attachments/assets/6f661840-3f65-49fe-9948-d4cfd6c6ef0e"
/>
2026-02-20 10:45:23 +01:00
..
alert-dialog.tsx Accounts: new pages to list, and see account details (#13) 2025-12-05 14:33:18 +01:00
alert.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
amount-display.tsx ui: amount display when encryption key is not set 2025-12-30 14:25:19 +01:00
amount-input.tsx feat: Better, easier, and faster account balance update modal (#65) 2026-01-19 19:43:20 +01:00
avatar.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
badge.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
breadcrumb.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
button-group.tsx Bulk actions on transactions 2025-11-10 10:02:28 +00:00
button.tsx ui: add cursor pointer to the buttons 2026-01-07 11:12:03 +01:00
card.tsx Dashboard: Net worth Chart (#3) 2025-12-03 08:53:28 +01:00
chart.tsx feat: Add multi-currency conversion for net worth charts (#138) 2026-02-20 10:45:23 +01:00
checkbox.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
collapsible.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
command.tsx fix: scroll category combobox to top while searching 2026-01-09 10:02:25 +01:00
context-menu.tsx Context menu to tables 2025-11-15 13:57:10 +01:00
create-button.tsx feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
data-table-pagination.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
data-table-view-options.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
data-table.tsx Refactor: Transaction Table Layout and Styling Improvements (#26) 2025-12-14 12:56:05 +01:00
dialog.tsx ui(fix): add hasKeyboard prop to dialogs 2025-12-30 07:22:19 +01:00
drawer.tsx Import CSV 2025-11-08 14:17:11 +00:00
dropdown-menu.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
icon.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
input-group.tsx Update transaction amount to bigint 2025-11-15 20:53:47 +01:00
input-otp.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
input.tsx Add Budgeting Feature to Track and Manage Spending (#36) 2026-01-21 15:25:50 +01:00
kbd.tsx Adapt for mobile screen 2025-12-09 16:44:56 +01:00
label.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
navigation-menu.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
placeholder-pattern.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
popover.tsx Settings: add account view 2025-11-07 21:38:23 +00:00
progress.tsx Dashboard: Top spending categories (#9) 2025-12-03 16:34:13 +01:00
radio-group.tsx Import CSV 2025-11-08 14:17:11 +00:00
select.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
separator.tsx Bulk actions on transactions 2025-11-10 10:02:28 +00:00
sheet.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
sidebar.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
skeleton.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
spinner.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
stacked-area-chart.tsx feat: Add multi-currency conversion for net worth charts (#138) 2026-02-20 10:45:23 +01:00
stacked-bar-chart.tsx feat: Add multi-currency conversion for net worth charts (#138) 2026-02-20 10:45:23 +01:00
table.tsx Refactor: Transaction Table Layout and Styling Improvements (#26) 2025-12-14 12:56:05 +01:00
textarea.tsx Transactions page 2025-11-08 23:38:35 +00:00
toggle-group.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
toggle.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
tooltip.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00