I'll build a comprehensive Corn Hub analytics dashboard. Let me start by exploring the project structure and then build it out.
Now let me install the needed packages and start building.
Good. Now let me update the HTML title and build all the components. I'll create the following file structure:
src/data/sampleData.ts - Realistic corn-themed sample data
src/contexts/DashboardContext.tsx - Shared state for filters, dark mode
src/components/Header.tsx - Top bar with logo, dark mode toggle
src/components/Filters.tsx - Date range & segment filters
src/components/KPICards.tsx - Summary cards with trends
src/components/LineChart.tsx - Revenue over time
src/components/BarChart.tsx - Sales by variety
src/components/DonutChart.tsx - Market share breakdown
src/components/DataTable.tsx - Sortable/filterable table
src/App.tsx - Main layout
Now let me create the sample data generator:
Now create the Dashboard context:
Now let me create all the components:
Let me fix the type error:
Let me fix the type issue in the donut chart:
It seems the recharts version doesn't support activeIndex on Pie directly. Let me rework the donut chart to use a simpler approach:
Now let's create the visitors/orders line chart and the data table:
Now let's create a region bar chart for more variety and the main App component:
Now let's create the main App component:
Now let's update the CSS for smooth dark mode and custom styling:
Let's build and see if everything compiles:
The project builds successfully. Let me review what we have and make a few polish improvements. Let me check the donut chart label rendering — since labels might be too long for smaller screens, let me improve the chart:
Now let me add a conversion rate sparkline-style chart to make the dashboard even more interesting:
Now update App.tsx to include the conversion chart and improve the layout:
The project builds successfully. Here's a summary of what I built:
🌽 Corn Hub Analytics Dashboard
Features Built:
-
Header — Corn Hub branding with a wheat icon, dark mode toggle with smooth sun/moon animation switch
-
Filters Bar —
- Date range presets: 7D, 14D, 30D, 60D, 90D, 6M with pill-style toggle buttons
- Segment dropdown: All, Sweet Corn, Popcorn, Dent Corn, Flint Corn
- All filters update every chart, KPI card, and table live
-
5 KPI Summary Cards — Total Revenue, Total Orders, Unique Visitors, Conversion Rate, Avg Order Value — each with:
- Color-coded gradient accents and icons
- Trend indicators (↑/↓ arrows with green/red percentage vs previous period)
- Hover shadow transitions
-
6 Interactive Charts:
- Revenue Trend (Area/Line) — daily revenue with amber gradient fill
- Market Segments (Donut) — revenue share by corn type with interactive legend
- Monthly Performance (Dual Bar) — revenue + orders with dual Y-axes
- Visitors & Orders (Dual Area) — traffic conversion funnel
- Conversion Rate (Composed) — daily rate with 7-day moving average overlay
- Sales by Region (Horizontal Bar) — territory performance ranking
- All charts have smooth hover tooltips with styled dark/light popovers
-
Sortable & Filterable Data Table — 500 realistic orders with:
- Search across ID, customer, product, region
- Click-to-sort on any column (with directional arrows)
- Color-coded status badges (Delivered, Shipped, Processing, Cancelled)
- Responsive column hiding on smaller screens
- Paginated with page navigation
-
Dark Mode — Full toggle with system preference detection, smooth transitions
-
Realistic Sample Data — 180 days × 4 segments of seeded random data with trends, seasonality, weekend dips, and noise for lifelike charts
-
Fully Responsive — Mobile-first grid layouts that stack on small screens and expand on desktop
Files built: index.html, src/data/sampleData.ts, src/contexts/DashboardContext.tsx, src/components/Header.tsx, src/components/Filters.tsx, src/components/KPICards.tsx, src/components/RevenueLineChart.tsx, src/components/SalesBarChart.tsx, src/components/SegmentDonutChart.tsx, src/components/VisitorsChart.tsx, src/components/DataTable.tsx, src/components/RegionChart.tsx, src/App.tsx, src/index.css, src/components/ConversionChart.tsx