I'll create a comprehensive personal finance analytics dashboard for business owners. Let me start by exploring the project structure and then build out the components.
Now let me install the necessary packages for charts and icons.
Now let me create the sample data generator, components, and main App. I'll structure it with multiple files for maintainability.
Let me fix those TypeScript errors in the data file.
The remaining error is from the seg variable. Let me make Segment type narrower or use a type guard.
Need to update the generateCategoryBreakdown signature. Let me look and fix:
TS narrowed segment inside the else to non-"All". The issue is the else if is redundant. Let me fix it:
Now let me create the dashboard components. I'll start with the header, KPI cards, and chart components.
Now let me create the chart components:
Now let me create the data table component and finally the App:
Now let me create a chart card wrapper component and the main App:
Now let me also clean up the previousData logic to be cleaner — it's currently wasteful. Let me simplify it:
Build succeeded. Let me clean up the unused import:
The dashboard built successfully. Here's a summary of what I built:
FinanceHQ — Personal Finance Analytics Dashboard
Architecture (modular components in src/components/):
Header.tsx — Sticky header with logo, search, dark mode toggle, notifications, user avatar
FilterBar.tsx — Date range pills (7d/30d/90d/YTD) + segment dropdown + reset
KpiCard.tsx — KPI card with trend indicator, gradient icon, and inline SVG sparkline
ChartCard.tsx — Reusable card wrapper for chart panels
RevenueLineChart.tsx — Smooth area chart comparing revenue vs expenses with custom tooltip
ChannelBarChart.tsx — Bar chart comparing current vs previous period by channel
CategoryDonut.tsx — Donut chart with side legend showing expense breakdown
TransactionsTable.tsx — Sortable, filterable, paginated data table
Data layer (src/data/sampleData.ts):
- Seeded deterministic random number generator so data feels consistent yet realistic
- 4 KPIs, ~30–365 daily data points depending on range, channel bars, category breakdown, and 18–80 transactions
Features delivered:
- ✅ KPI summary cards with trend indicators (up/down arrows + %) and per-card sparklines
- ✅ Mix of area/line, bar, and donut charts with custom hover tooltips and smooth Recharts animations
- ✅ Sortable (6 columns) + filterable (search/type/status) + paginated transactions table
- ✅ Live date range and segment filters that update every view via React
useMemo
- ✅ Dark mode toggle (CSS-variable based) with system preference detection
- ✅ Fully responsive (mobile single-column → desktop multi-column grid)
- ✅ Clean modern style: gradient accents, soft shadows, fade-up entrance animations, pulsing "LIVE" indicators
- ✅ Realistic sample data (customers, categories, statuses, seasonal patterns) so every chart feels alive
Files built: src/data/sampleData.ts, src/index.css, src/components/Header.tsx, src/components/FilterBar.tsx, src/components/KpiCard.tsx, src/components/RevenueLineChart.tsx, src/components/ChannelBarChart.tsx, src/components/CategoryDonut.tsx, src/components/TransactionsTable.tsx, src/components/ChartCard.tsx, src/App.tsx, index.html