Create an interactive analytics dashboard for riders valid days ans status aimed at logistics . Include KPI summary cards with trend indicators, a mix of line, bar, and donut charts with hover tooltips and smooth transitions, a sortable and filterable data table, and date-range and segment filters that update every view live. Use a clean, modern visual style with clear layout hierarchy and a dark mode toggle, generate realistic sample data so every chart feels alive, and make it fully responsive.
Assistant
Let me install the charting library and build out this analytics dashboard.
Now let me create all the files for the dashboard. I'll start with the utilities and data layer, then components, then the main app.
Now let me create the components:
Now let me create the main App component that ties everything together:
Let me build the project to confirm everything works:
The dashboard builds successfully. Let me verify the complete file structure:
The dashboard is built and ready. Here's what was created:
Rider Analytics Dashboard — Complete
File Structure
code
src/
├── components/
│ ├── KpiCard.tsx — KPI summary card with trend indicators & hover effects
│ ├── Filters.tsx — Date-range slider, segment/status toggles, region dropdown, search
│ ├── LineChartCard.tsx — Dual Y-axis line chart (active riders + valid days)
│ ├── BarChartCard.tsx — Daily deliveries bar chart
│ ├── DonutChartCard.tsx — Twin donut charts (segment breakdown + status breakdown)
│ └── DataTable.tsx — Sortable, paginated table with progress bars & status badges
├── hooks/
│ ├── useDarkMode.ts — Dark mode toggle with localStorage + system preference detection
│ └── useFilters.ts — Reactive filter state management
├── utils/
│ └── data.ts — Realistic sample data generators (50 riders, 45 days of metrics)
├── App.tsx — Main dashboard layout composing all components
└── index.css — Tailwind v4 config + custom range slider styling + animations
Features
Feature
Detail
KPI Cards
Total Valid Days, Active Riders, Deliveries, Avg Rating — each with trend % vs last 5 days
Line Chart
Dual-line for Active Riders / Valid Days with gradient fill, custom tooltip
Bar Chart
Daily deliveries with amber gradient bars, smooth transitions
Donut Charts
Valid Days by Segment + Riders by Status — both with hover tooltips
Filters
Date range sliders, segment/status chips, region dropdown, text search — all reactive
Data Table
9-column sortable table with pagination, progress bars, status badges
Dark Mode
Toggle in header, persisted via localStorage, respects system preference
Responsive
Grid layout adapts from 2 cols (mobile) to 4 cols (desktop), stacked charts
Key Design Choices
Recharts for all charts — smooth SVG animations, hover tooltips, responsive containers
All filter state is centralized in useFilters hook — every chart/table/KPI updates live
useMemo heavily used so computations only re-run when filtered data changes
Tailwind dark: variants for every component — seamless theme switching
Range inputs styled with CSS for consistent cross-browser appearance