Let me install the required packages and start building the dashboard.
Now I'll create the complete dashboard. Let me start with the data layer and theme context, then build all components.
Now let me create the theme context for dark mode:
Now let me create the header component:
Now let me create the filters component:
Now the KPI cards component:
Now let me create the chart components:
Now the bar chart:
Now the donut chart:
Now the stock price chart:
Now the margins/ratios chart:
Now the data table:
Now let me create a store growth chart component:
Now let me create the main App component that ties everything together:
Now let me update the CSS and index.html:
Now let me build the project to check for any errors:
The project builds successfully. Let me also verify the data file has no issues by quickly checking it:
The build is successful. Here's a summary of what I built:
CPALL Analytics Dashboard
Architecture
- 11 files across data, context, and component layers
- Built with React + TypeScript + Tailwind CSS v4 + Recharts + Lucide Icons
Features Implemented
-
KPI Summary Cards (8 cards) — Revenue, Net Profit, EBITDA, EPS, Store Count, Gross Margin, YoY Growth, and Debt/Equity. Each has a gradient icon, trend arrow (up/down/flat), percentage change badge, and hover elevation animation.
-
Charts (6 interactive visualizations):
- Area Chart — Tracks any selected metric (Revenue, Net Profit, EBITDA, Gross Profit, EPS) with gradient fill and smooth transitions
- Bar Chart — Revenue vs Net Profit comparison with margin calculation in tooltips
- Two Donut Charts — Revenue and Profit by business segment with interactive hover highlighting and center total label
- Composed Chart — Stock price (area) + trading volume (bars) on dual Y-axes
- Line Chart — Gross Margin, Net Margin, and ROE trends
- Store Growth Chart — Store count (bars) + Same-Store Sales Growth (line) on dual axes
-
Sortable & Filterable Data Table — 11 columns, click-to-sort with direction indicators, search filtering, paginated (8 rows per page)
-
Live Filters:
- Date Range — 6 presets from "2020–2025" to "2025 Only"
- Segment Filter — 7 business segments that scale all financial data proportionally
- Metric Selector — Switches the primary trend chart between 5 metrics
-
Tab Navigation — Overview, Financials, and Market tabs with different chart arrangements
-
Dark Mode Toggle — Persists to localStorage, respects system preference, smooth transitions
-
Responsive Design — Fully responsive grid from mobile to 1440px wide, collapsing charts to single column on small screens
Data
Realistic CPALL-based data covering 24 quarters (2020–2025) with COVID impact modeling, seasonal patterns, and noise for authentic-looking charts.
Files built: src/data/sampleData.ts, src/context/ThemeContext.tsx, src/components/Header.tsx, src/components/Filters.tsx, src/components/KPICards.tsx, src/components/RevenueLineChart.tsx, src/components/ProfitBarChart.tsx, src/components/SegmentDonutChart.tsx, src/components/StockPriceChart.tsx, src/components/MarginChart.tsx, src/components/DataTable.tsx, src/components/StoreGrowthChart.tsx, src/App.tsx, src/index.css, index.html