Let me start by exploring the project structure and then build a comprehensive analytics dashboard.
Now let me install the required packages and update the HTML title.
Now let me create all the files. I'll start with types and data, then build every component.
Now let me create all the components. I'll build them in parallel where possible.
I need to install lucide-react and fix the TypeScript errors. Let me handle both.
Now let me fix the TypeScript formatter types across all chart components:
Now let me create the data table, filters, dark mode toggle, and dashboard layout:
Now let me build the main Dashboard layout and the App entry point:
Let me fix the unused imports in Dashboard.tsx:
Now let me build and verify everything compiles:
The build succeeded. Let me provide a summary of the complete analytics dashboard.
Here's what was built — a fully-featured, interactive analytics dashboard:
📊 KPI Summary Cards
4 cards (Total Revenue, Total Profit, Profit Margin, Active Campaigns) with trend indicators (up/down/flat), percentage change badges, and hover lift animations. KPIs recompute live when the date range changes.
📈 Revenue Line Chart
A multi-series line chart (Revenue, Expenses, Profit) with smooth monotone interpolation, animated transitions, hover tooltips showing exact values, and auto-aggregation to weekly when viewing longer ranges. Responds to the date-range filter.
📊 Monthly Bar Chart
Grouped bars for Users vs Sessions across all 12 months, with rounded tops, animated entry, and formatted tooltips.
🍩 Channel Donut Chart
A donut chart with 5 channels (Organic Search, Paid Social, Email, Direct, Referral) using a cohesive indigo/violet/teal color palette with hover tooltips.
📋 Sortable & Filterable Data Table
- 200 realistic campaign rows with 8 sortable columns
- Click any column header to sort asc/desc with visual indicators
- Search bar filters across campaign, channel, and segment
- Paginated (10 per page) with prev/next and numbered page buttons
- Segment filter restricts which rows are shown
🎛️ Filters
- Date range: Button-group toggle (7d / 30d / 90d / 1y / All) — updates KPIs and the line chart instantly
- Segment: Dropdown (All / Enterprise / Mid-Market / SMB / Startup) — filters the data table live
🌓 Dark Mode
Toggle in the header with animated sun/moon icon rotation. Persists to localStorage and respects the system preference on first visit. All components use Tailwind's dark: variants for seamless switching.
📱 Responsive
Grid-based layout adapts from 4-column KPI cards on desktop → 2 → 1 on mobile. Table scrolls horizontally, filters stack vertically on small screens.
🎨 Style
Clean, modern design with rounded-2xl cards, subtle shadows, indigo accent color, gradient header icon, sticky header with backdrop blur, and smooth transition-all duration-300 throughout.
Files built: index.html, src/types.ts, src/data/sampleData.ts, src/components/KPICards.tsx, src/components/RevenueLineChart.tsx, src/components/MonthlyBarChart.tsx, src/components/ChannelDonutChart.tsx, src/components/DataTable.tsx, src/components/Filters.tsx, src/components/DarkModeToggle.tsx, src/components/Dashboard.tsx, src/App.tsx