I'll build a comprehensive sleep tracking analytics dashboard called "Sleep10". Let me start by exploring the project structure, then install needed packages and create the components.
Let me install the chart library, date utilities, and icons in parallel while reading the index.html.
Now I'll update the HTML title and write the CSS with dark mode support.
Now let me create the data generation module with realistic sleep patterns.
Now let me create the topbar with the dark mode toggle.
Now the KPI cards with trend indicators.
Now the charts component with line, bar, and donut charts.
Now the sortable and filterable data table.
Now the main App that ties everything together with live-updating filter logic.
Now let me build to verify everything compiles.
The build succeeded. Let me fix a minor date-range asymmetry so the current and previous periods match exactly in length.
The dashboard is complete and builds successfully. Here's a summary of what was built:
Sleep10 · Sleep Analytics Dashboard — a cohort tracking dashboard for 10 participants across 90 days.
Features delivered:
- 4 KPI cards (Avg Sleep, Sleep Score, Deep Sleep, Goal Hit Rate) each with gradient icons, big values, contextual subtitles, and colored trend badges (▲/▼ with % change vs previous period)
- Dual-axis line chart showing sleep duration (solid indigo) + score (dashed cyan) with monotone smoothing and custom hover tooltips
- Stacked bar chart breaking down deep/REM/light/awake sleep per participant
- Donut chart with stage composition, center total, and legend breakdown
- Sortable data table — click any column header to sort asc/desc, with sort icons and sticky header
- Searchable table — filter by user name, segment, or date live
- Date range filter (7D / 14D / 30D / 90D) as a pill toggle
- Segment filter (All / Athletes / Remote Workers / Students / Shift Workers) as a dropdown
- Every filter change recomputes KPIs, trends, and all charts live via
useMemo
- Dark mode toggle with animated sun/moon swap, respects system preference, persists in localStorage
- Fully responsive — mobile 2-col KPIs stack to 4-col on xl, charts reflow, table scrolls horizontally
- Realistic data generation with deterministic PRNG (mulberry32), segment-specific profiles (bedtime, deep%, variance), weekend effects, per-user bias, and a gentle global improvement trend
Design: clean modern style using Inter, indigo→cyan accent gradient, subtle radial-gradient backdrop, glass-like cards with soft shadows, fade-in animations, and shimmer effects for polish.
Files built: index.html, src/index.css, src/data.ts, src/components/Topbar.tsx, src/components/Filters.tsx, src/components/KPICards.tsx, src/components/Charts.tsx, src/components/DataTable.tsx, src/App.tsx