I'll create a comprehensive analytics dashboard for a web agency. Let me start by exploring the project structure.
Now I'll build the dashboard. Starting with global styles, the HTML shell, and utility helpers.
Now the data engine — seeded, realistic agency data with aggregation helpers.
Now the chart library — custom SVG charts with hover tooltips and smooth transitions.
Fixing the type issues in the charts.
Now the UI primitives, icons, KPI cards, filters, and data table.
Now the analytics hook that derives every view from the live filters.
Finally, the app shell with sidebar navigation, header, dark mode toggle, and live filters.
Build passes. Now let me harden hover state against data changes and polish a class name.
The build is clean. Here's what I created — Northlight Studio, an internal analytics dashboard for a web agency's employees.
Architecture
src/lib/data.ts — a seeded (deterministic) data engine generating 2 years of daily records across 5 service lines, with weekday/weekend rhythms, yearly seasonality, growth trends, and noise. It also produces 10 team members with per-day time logs, 46 projects with budgets/burn/margins/status, clients, 5 acquisition channels, and an activity feed — plus all the aggregation, bucketing (day/week/month) and previous-period logic.
src/hooks/useDashboard.ts — a single memoized selector that recomputes KPIs, series, donut mixes, channel/client breakdowns, team stats and project rows from the current filters, so every view updates live.
Charts (all hand-built SVG, no chart library)
- Line chart — monotone-cubic smoothed revenue vs. target (plus a dashed previous period series when "Compare" is on), gradient area fill, animated stroke draw-in, crosshair + multi-series hover tooltip, nice-number Y ticks, touch support.
- Stacked bar chart — billable hours by service line per bucket, bars grow from the baseline and CSS-transition their geometry when filters change; hovering a column dims the rest and shows a full breakdown with total.
- Donut charts — dash-array driven so slices glide between states; hovering a slice (or its legend row) thickens it, dims the others and swaps the center readout to that slice's value and share.
- Sparklines in every KPI card.
Interactions
- KPI cards: revenue, billable hours, utilization, pitch win rate, CSAT — each with a green/red trend chip vs. the previous period and a contextual footnote (target attainment, hours/day, pace vs. the 78% goal).
- Filters: 7D/30D/90D/6M/12M presets, a custom start/end date popover, a multi-select service-line popover (also togglable from the sidebar), and a compare toggle — all of which drive every card, chart and table simultaneously.
- Data tables: sortable columns, live search, status/practice filter chips with counts, pagination, and CSV export.
- Views: Overview, Projects (budget burn, delivery health, largest overruns) and Team (capacity split, per-person roster).
- Dark mode toggle persisted to localStorage with system-preference default, and a fully responsive layout with a mobile drawer nav and scrollable tables.
Files built: src/index.css, index.html, src/lib/format.ts, src/hooks/useMeasure.ts, src/lib/data.ts, src/components/charts/LineChart.tsx, src/components/charts/BarChart.tsx, src/components/charts/DonutChart.tsx, src/components/charts/Sparkline.tsx, src/components/Icons.tsx, src/components/ui.tsx, src/components/KpiCard.tsx, src/components/DataTable.tsx, src/components/FilterBar.tsx, src/hooks/useDashboard.ts, src/components/BarList.tsx, src/components/ProjectsTable.tsx, src/views/Overview.tsx, src/views/ProjectsView.tsx, src/views/TeamView.tsx, src/App.tsx