diff --git a/src/pages/BalancePage.tsx b/src/pages/BalancePage.tsx index 4a15f33..b184641 100644 --- a/src/pages/BalancePage.tsx +++ b/src/pages/BalancePage.tsx @@ -173,96 +173,104 @@ export default function BalancePage() { )} -
- {(() => { - // Issue #178 — show a 2-step onboarding card while the user has no - // accounts or no snapshots yet. We probe accountsLatest for ANY - // snapshot date so the empty-state guard is independent of the - // active period filter (state.period). - const accountsCount = state.accountsLatest.length; - const hasAnySnapshot = state.accountsLatest.some( - (a) => a.latest_snapshot_date != null - ); - if (accountsCount === 0 || !hasAnySnapshot) { - return ( + {/* Issue #178 — empty-state guard. We probe accountsLatest for ANY + snapshot date so the guard is independent of the active period + filter (state.period). When empty, we render only the onboarding + card — period selector, chart and accounts table would all show + empty states stacked under it (S2 from #187). */} + {(() => { + const accountsCount = state.accountsLatest.length; + const hasAnySnapshot = state.accountsLatest.some( + (a) => a.latest_snapshot_date != null + ); + const isEmpty = accountsCount === 0 || !hasAnySnapshot; + + if (isEmpty) { + return ( +
- ); - } - return ; - })()} +
+ ); + } -
- {/* Period selector */} -
- {PERIOD_OPTIONS.map((p) => ( - - ))} -
+ {PERIOD_OPTIONS.map((p) => ( + + ))} +
- {/* Chart mode toggle */} -
- {(["line", "stacked"] as BalanceChartMode[]).map((mode) => ( - - ))} + {(["line", "stacked"] as BalanceChartMode[]).map((mode) => ( + + ))} +
+
+ + + +
+

+ {t("balance.overview.accountsTitle")} +

+ handleArchiveAccount(acc.account_id)} + onLinkTransfers={(acc) => setLinkTarget(acc)} + /> +
- - - - -
-

- {t("balance.overview.accountsTitle")} -

- handleArchiveAccount(acc.account_id)} - onLinkTransfers={(acc) => setLinkTarget(acc)} - /> -
- + ); + })()}