whisper-money/resources/js/components
Víctor Falcón 2a1286e98a
chore(frontend): add orphan component detection and remove dead components (#181)
## 🚪 Why?

### Problem

Dead frontend components were accumulating in the codebase with no
automated way to detect them. Unused code increases maintenance burden,
confuses contributors, and inflates bundle analysis noise. Additionally,
several React hooks had incorrect dependency arrays causing stale
closures or unnecessary re-renders, and an unused variable was left in
the new test file.

## 🔑 What?

### Changes

- Add `resources/js/lib/orphan-components.test.ts` — a Vitest test that
scans every file under `resources/js/components/` and fails if any
component is never imported anywhere in the codebase (supports `@/`
alias imports, relative imports, and barrel `index.*` re-exports)
- Delete 14 orphan components identified by the new test:
-
`accounts/import-balances/import-balance-step-{account,mapping,preview,upload}`
  - `app-mobile-nav`
  - `appearance-dropdown`
  - `dashboard/stat-card`
  - `landing/encryption-video-player`
  - `sync-status-button`
  - `transactions/date-header`
  - `ui/{icon,input-group,navigation-menu,placeholder-pattern}`
- Restore `ui/avatar.tsx` which was incorrectly included in the deletion
(it is imported via relative path in `user-info.tsx`)
- Fix ESLint warnings across 5 files:
- `orphan-components.test.ts` — remove unused `componentDir` variable in
`importStrings()`
- `transaction-list.tsx` — remove `categories`, `accounts`, `banks`,
`automationRules` from `useCallback` deps (none referenced in callback
body)
- `amount-input.tsx` — add missing `locale` dep to `useEffect` (used in
`formatCurrency`)
- `use-dashboard-data.ts` — wrap `fetchData` in `useCallback([locale])`
and add to `useEffect` deps to prevent stale closure on locale
- `dashboard.tsx` — wrap `netWorthEvolution` fallback in
`useMemo([props.netWorthEvolution])` to stabilise the reference passed
to the downstream `useMemo`

##  Verification

### Tests

The new test runs as part of `bun run test` (Vitest), already executed
in the `linter` CI job. All 48 tests pass:

```
✓ resources/js/lib/chart-calculations.test.ts (32 tests)
✓ resources/js/lib/file-parser.test.ts (15 tests)
✓ resources/js/lib/orphan-components.test.ts (1 test)
```

`bun run lint` and `bun run build` now exit clean.

Going forward, any new component added to `resources/js/components/`
that is not imported anywhere will fail CI automatically.
2026-03-02 12:43:27 +01:00
..
accounts chore: Improve create account dialog 2026-03-01 12:50:42 +00:00
automation-rules feat(i18n): add localization test and fix missing Spanish translations (#174) 2026-03-01 12:32:39 +00:00
budgets feat(privacy): enable privacy mode for all users and extend amount masking (#182) 2026-03-02 10:48:45 +00:00
cashflow feat(Budgets): add period navigation and unify period selector UI (#171) 2026-03-01 12:25:01 +00:00
categories feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
charts feat(cashflow): promote trend chart above money flow and increase height (#166) 2026-02-28 18:53:02 +00:00
dashboard chore(frontend): add orphan component detection and remove dead components (#181) 2026-03-02 12:43:27 +01:00
icons Subscriptions (#15) 2025-12-06 19:09:56 +01:00
labels feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
landing chore(frontend): add orphan component detection and remove dead components (#181) 2026-03-02 12:43:27 +01:00
onboarding refactor(accounts): unify account type icons via accountIconByType helper (#180) 2026-03-02 08:47:44 +00:00
open-banking fix(ux): improve status badge, hide balance update for connected accounts, localize delete confirm (#159) 2026-02-27 22:37:16 +00:00
partials feat(i18n): add localization test and fix missing Spanish translations (#174) 2026-03-01 12:32:39 +00:00
shared feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
transactions chore(frontend): add orphan component detection and remove dead components (#181) 2026-03-02 12:43:27 +01:00
ui chore(frontend): add orphan component detection and remove dead components (#181) 2026-03-02 12:43:27 +01:00
alert-error.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
app-content.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
app-logo-icon.tsx Automated rules labels (#30) 2025-12-15 12:11:55 +01:00
app-logo.tsx Add animated logo icon that transitions based on encryption key state 2025-12-12 11:24:42 +01:00
app-shell.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
app-sidebar-header.tsx feat: Decrypt encrypted transactions on key unlock (#123) 2026-02-16 10:37:43 +01:00
app-sidebar.tsx feat(nav): add icon+label mobile nav with active pill and full-width buttons (#178) 2026-03-01 19:43:18 +01:00
appearance-tabs.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
bank-logo.tsx feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
breadcrumbs.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
delete-user.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
encrypted-text.tsx fix: make encryption key storage SSR-safe to prevent 502 errors 2025-12-08 17:13:45 +01:00
encryption-key-button.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
heading-small.tsx Add Budgeting Feature to Track and Manage Spending (#36) 2026-01-21 15:25:50 +01:00
heading.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-error.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
nav-footer.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
nav-main.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
nav-user.tsx Format + Open transactions on row click 2025-12-08 15:58:50 +01:00
text-link.tsx Set up a fresh Laravel app 2025-11-07 12:01:36 +00:00
two-factor-recovery-codes.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
two-factor-setup-modal.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
unlock-message-dialog.tsx Remove encryption from bank account names (#104) 2026-02-09 14:15:26 +01:00
user-info.tsx feat: Update facehash and enable blink 2026-02-24 15:54:49 +01:00
user-menu-content.tsx feat(privacy): enable privacy mode for all users and extend amount masking (#182) 2026-03-02 10:48:45 +00:00