Loading dashboard data...
;
}
if (error) {
- return (
-
-
Dashboard
+ // Provide default values if data is undefined (though useQuery's type should handle this better now)
+ const { totalStockValue, totalItems, totalOrders, totalCustomers } = data || {
+ totalStockValue: 0,
+ totalItems: 0,
+ totalOrders: 0,
+ totalCustomers: 0,
+ };
+ return (
+
+
+
Dashboard
+
}
+ value={`$${totalStockValue.toLocaleString()}`}
+ description="The total value of all items in stock."
+ icon={
}
/>
}
+ title="Total Items"
+ value={totalItems.toLocaleString()}
+ description="The total number of unique items in stock."
+ icon={
}
/>
}
+ title="Total Orders"
+ value={totalOrders.toLocaleString()}
+ description="Total orders processed this month."
+ icon={
}
/>
}
+ title="Total Customers"
+ value={totalCustomers.toLocaleString()}
+ description="Total active customers."
+ icon={
}
/>
-
-
-
- {/*
*/}
+
+
+
+ Stock Overview
+
+
+
+
+
+
+
+ Recent Activity
+
+
+
+
+
);
-}
\ No newline at end of file
+};
+
+export default Index;
\ No newline at end of file