Create an interactive analytics dashboard for pizza cafe aimed at Admin. Include KPI…
- User
Create an interactive analytics dashboard for pizza cafe aimed at Admin. 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
I'll build a comprehensive pizza cafe analytics dashboard. Let me start by exploring the project structure and then create all the necessary files.
Now I'll install the needed packages and build the dashboard. Let me install Recharts for charts and Lucide for icons.
Now let me create all the files. I'll start with the data layer, then components.
Now let me create the context for state management and the components:
Let me fix all the tooltip formatter types:
Let me simplify - I'll remove the formatter props to avoid the type issues:
Let me rewrite the ChartsSection file completely to avoid type issues:
Now let me create the sortable/filterable data table:
Now the Filters component:
Now let me create the Header component:
Now let me create the main App.tsx:
Now let me update the HTML title and CSS:
Let me now build the project to check for errors:
The project builds successfully. Let me verify the segmentsList export is correct:
Good. The build was successful! The dashboard is now complete. Let me do a final review to make sure all files are properly connected and the app is fully functional. Let me quickly verify the Filters component is importing correctly:
The build is successful! Let me provide a summary of everything that was created:
PizzaHub Admin Dashboard — Complete Summary
Files Created/Modified:
-
src/data/sampleData.ts— Realistic seeded sample data generator with:- 90 days of daily revenue data
- 200 detailed orders with customers, pizza types, sizes, toppings, segments, statuses
- Hourly order distribution
- Segment revenue breakdown and top products
-
src/context/DashboardContext.tsx— Global state management with:- Dark mode toggle
- Date range, segment, and search filters
- Live filtered data computed via
useMemo
-
src/components/Header.tsx— Sticky top bar with:- PizzaHub branding with gradient logo
- Dark mode toggle (sun/moon)
- Notification bell with red dot
- Admin avatar
-
src/components/KPICards.tsx— 5 KPI cards with:- Total Revenue, Total Orders, Avg Order Value, Customers, Satisfaction
- Trend indicators (green up / red down arrows)
- Hover animations with color-coded icons
-
src/components/ChartsSection.tsx— 4 interactive charts:- Revenue Trend (Area chart) — with gradient fill and smooth animation
- Peak Hours (Bar chart) — with color-coded intensity
- Order Segments (Donut chart) — with legend and colored segments
- Top Products (Horizontal bar chart) — top 8 pizzas by orders
-
src/components/DataTable.tsx— Full-featured data table:- Click-to-sort on every column with ascending/descending icons
- Search/filter across orders
- Status and segment badges
- Pagination with smart page number display
-
src/components/Filters.tsx— Live filter controls:- Date range presets (7/30/90 days, All)
- Segment buttons (Dine-in, Delivery, Takeaway, Catering) with color dots
- Active filter count badge and clear button
-
src/App.tsx— Main layout assembling all components -
index.html— Updated title to "PizzaHub Admin Dashboard" -
src/index.css— Custom styles for scrollbars, selection color, dark mode transitions
Files built:
src/data/sampleData.ts,src/context/DashboardContext.tsx,src/components/KPICards.tsx,src/components/ChartsSection.tsx,src/components/DataTable.tsx,src/components/Filters.tsx,src/components/Header.tsx,src/App.tsx,index.html,src/index.css-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.