Now I'll install the necessary packages for charts and date handling.
Now let me build the dashboard. I'll create multiple component files for a clean architecture.
Now let me build the main App.tsx:
Now update index.html with a proper title:
Now let's update src/index.css to ensure Tailwind and global styles are right:
Now let's build the project to check for errors:
The build succeeds. Let me do some final polish — I want to add a sparkline mini-chart inside each KPI card and also improve the overall visual hierarchy. Let me update the KPI card with a sparkline:
Now update App.tsx to pass sparkline data to KPI cards:
The build succeeds perfectly. Let me do a final review of the complete implementation:
The app looks great! Let me verify the full file structure is complete:
All 14 source files are in place and the build is successful. Here's a complete summary of everything that was built:
🎯 InvenTrack — Inventory Analytics Dashboard
What was built
10 source files across a fully-componentized React + Vite + Tailwind architecture:
📊 Features
KPI Summary Cards (4 cards)
- Total Units · Portfolio Value · Stock Alerts · In-Stock Rate
- Each card has: trend badge (↑ green / ↓ red), contextual sub-label, background glow accent, and a live sparkline area chart with hover tooltip
Charts (4 chart types)
| Chart | Component | Description |
|---|
| 📈 Line Chart | LineChartCard | 90-day portfolio value + items in/out, toggle-able metric pills |
| 🍩 Donut Chart | DonutChartCard | Value by category, interactive legend with active highlighting |
| 📊 Bar Chart | BarChartCard | 12-month inflow vs outflow vs alerts |
| 📉 Category Bar | MonthlyBarChart | Per-category monthly stock level selector |
All charts have smooth transitions, custom hover tooltips, and responsive containers.
Sortable & Filterable Data Table
- 10 columns with click-to-sort (asc/desc) with icons
- Live search by name, SKU, vendor, category
- Pagination (8 rows/page)
- Striped rows, status badges, color-coded quantities
Filter Bar
- Date range pills: 7D / 30D / 90D / 6M / 1Y — updates all charts live
- Category dropdown + Status dropdown
- Active filter chips with ✕ remove buttons
- Reset all button
Alerts Banner
- Auto-detects Low Stock, Out of Stock, On Order items
- Color-coded alert cards with item name previews
Dark Mode Toggle
- Available in sidebar and top bar
- Full dark/light theme across every component with smooth transitions
Navigation Sidebar
- Collapsible on mobile (hamburger menu)
- Category quick-links (Laptops, Monitors, Keyboards, etc.)
- Active state with indigo highlight
📦 Realistic Sample Data
- 36 inventory items across 10 categories with real product names
- 90 days of daily stock value/inflow/outflow data
- 12 months of monthly category breakdown data
- Proper stock statuses, vendors, locations, trends
Files built: src/data/inventoryData.ts, src/components/KPICard.tsx, src/components/LineChartCard.tsx, src/components/BarChartCard.tsx, src/components/DonutChartCard.tsx, src/components/DataTable.tsx, src/components/FilterBar.tsx, src/components/AlertsBanner.tsx, src/components/MonthlyBarChart.tsx, src/App.tsx, index.html, src/index.css, src/components/SparklineChart.tsx