| 1 | import StatsGrid from './StatsGrid'; |
| 2 | import ProductTable from './ProductTable'; |
| 3 | import ActivityFeed from './ActivityFeed'; |
| 4 | import ChartPanel from './ChartPanel'; |
| 5 | import {generateProducts, generateActivities, generateStats} from './data'; |
| 6 | |
| 7 | export default function Dashboard({itemCount}) { |
| 8 | const products = generateProducts(itemCount); |
| 9 | const activities = generateActivities(Math.min(itemCount, 50)); |
| 10 | const stats = generateStats(); |
| 11 | |
| 12 | return ( |
| 13 | <main className="dashboard"> |
| 14 | <div className="dashboard-header"> |
| 15 | <h1>Dashboard Overview</h1> |
| 16 | <p className="dashboard-subtitle"> |
| 17 | Welcome back. Here is what is happening with your store today. |
| 18 | </p> |
| 19 | </div> |
| 20 | <StatsGrid stats={stats} /> |
| 21 | <div className="dashboard-grid"> |
| 22 | <div className="dashboard-main"> |
| 23 | <ProductTable products={products} /> |
| 24 | </div> |
| 25 | <div className="dashboard-aside"> |
| 26 | <ChartPanel title="Revenue" data={stats.revenueByMonth} type="bar" /> |
| 27 | <ActivityFeed activities={activities} /> |
| 28 | </div> |
| 29 | </div> |
| 30 | </main> |
| 31 | ); |
| 32 | } |