Spaces:
Running
Running
Upload components/DashboardStats.jsx with huggingface_hub
Browse files
components/DashboardStats.jsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { TrendingUp, DollarSign, ShoppingBag, Users } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const DashboardStats = ({ stats }) => {
|
| 5 |
+
const statsData = [
|
| 6 |
+
{
|
| 7 |
+
id: 'revenue',
|
| 8 |
+
icon: DollarSign,
|
| 9 |
+
label: 'รายได้รวม',
|
| 10 |
+
value: stats.revenue,
|
| 11 |
+
change: stats.revenueChange,
|
| 12 |
+
color: 'bg-success/10 text-success'
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
id: 'sales',
|
| 16 |
+
icon: TrendingUp,
|
| 17 |
+
label: 'ยอดขาย',
|
| 18 |
+
value: `${stats.sales} รายการ`,
|
| 19 |
+
change: stats.salesChange,
|
| 20 |
+
color: 'bg-primary-50 text-primary-600'
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
id: 'customers',
|
| 24 |
+
icon: Users,
|
| 25 |
+
label: 'ลูกค้า',
|
| 26 |
+
value: stats.customers,
|
| 27 |
+
change: stats.customerChange,
|
| 28 |
+
color: 'bg-purple-50 text-purple-600'
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
id: 'orders',
|
| 32 |
+
icon: ShoppingBag,
|
| 33 |
+
label: 'คำสั่งซื้อ',
|
| 34 |
+
value: stats.orders,
|
| 35 |
+
change: stats.orderChange,
|
| 36 |
+
color: 'bg-orange-50 text-orange-600'
|
| 37 |
+
},
|
| 38 |
+
];
|
| 39 |
+
|
| 40 |
+
return (
|
| 41 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
| 42 |
+
{statsData.map((stat) => (
|
| 43 |
+
<div key={stat.id} className="bg-white rounded-2xl border border-pos-border p-5 hover:shadow-lg transition-shadow duration-300">
|
| 44 |
+
<div className="flex items-center justify-between mb-3">
|
| 45 |
+
<div className={`w-10 h-10 rounded-xl flex items-center justify-center ${stat.color}`}>
|
| 46 |
+
<stat.icon className="w-5 h-5" />
|
| 47 |
+
</div>
|
| 48 |
+
<span className={`text-xs font-medium px-2 py-1 rounded-lg ${
|
| 49 |
+
stat.change >= 0
|
| 50 |
+
? 'bg-success/10 text-success'
|
| 51 |
+
: 'bg-danger/10 text-danger'
|
| 52 |
+
}`}>
|
| 53 |
+
{stat.change >= 0 ? '+' : ''}{stat.change}%
|
| 54 |
+
</span>
|
| 55 |
+
</div>
|
| 56 |
+
<h3 className="text-sm text-pos-text-secondary mb-1">{stat.label}</h3>
|
| 57 |
+
<p className="text-2xl font-bold text-pos-text">{stat.value}</p>
|
| 58 |
+
</div>
|
| 59 |
+
))}
|
| 60 |
+
</div>
|
| 61 |
+
);
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
export default DashboardStats;
|