From a2eb5bfcd770544e2a6ef2d75423c6f6997fc745 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 4 Jan 2025 00:23:42 -0500 Subject: [PATCH] Add missing skeletons --- .../dashboard/MiniRealtimeAnalytics.jsx | 175 +++++++++--------- .../components/dashboard/MiniSalesChart.jsx | 4 +- 2 files changed, 92 insertions(+), 87 deletions(-) diff --git a/dashboard/src/components/dashboard/MiniRealtimeAnalytics.jsx b/dashboard/src/components/dashboard/MiniRealtimeAnalytics.jsx index 250a514..f15f446 100644 --- a/dashboard/src/components/dashboard/MiniRealtimeAnalytics.jsx +++ b/dashboard/src/components/dashboard/MiniRealtimeAnalytics.jsx @@ -17,6 +17,35 @@ import { SkeletonBarChart, processBasicData, } from "./RealtimeAnalytics"; +import { Skeleton } from "@/components/ui/skeleton"; + +const SkeletonCard = ({ colorScheme = "sky" }) => ( + + + +
+ +
+
+
+
+
+
+ + +
+
+ +
+
+ +
+
+
+
+
+ +); const MiniRealtimeAnalytics = () => { const [basicData, setBasicData] = useState({ @@ -76,95 +105,68 @@ const MiniRealtimeAnalytics = () => { }; }, [isPaused]); - if (loading && !basicData) { - return ( -
-
- - - - - -
-
- -
- - -
- - -
-
- - - - - - -
-
- -
- - -
- - + const renderContent = () => { + if (error) { + return ( + + + {error} + + ); + } + + if (loading) { + return ( +
+
+ + +
+ + + +
+
+ {/* Grid lines */} + {[...Array(5)].map((_, i) => ( +
+ ))} + {/* Y-axis labels */} +
+ {[...Array(5)].map((_, i) => ( + + ))} +
+ {/* X-axis labels */} +
+ {[...Array(6)].map((_, i) => ( + + ))} +
+ {/* Bars */} +
+ {[...Array(24)].map((_, i) => ( +
+ ))} +
+
+ ); + } - - -
- {/* Grid lines */} - {[...Array(5)].map((_, i) => ( -
- ))} - {/* Y-axis labels */} -
- {[...Array(5)].map((_, i) => ( - - ))} -
- {/* X-axis labels */} -
- {[...Array(6)].map((_, i) => ( - - ))} -
- {/* Bars */} -
- {[...Array(24)].map((_, i) => ( -
- ))} -
-
- - -
- ); - } - - return ( -
- {error && ( - - - {error} - - )} - + return ( +
{summaryCard( "Last 30 Minutes", @@ -245,7 +247,10 @@ const MiniRealtimeAnalytics = () => {
- ); + ); + }; + + return renderContent(); }; export default MiniRealtimeAnalytics; \ No newline at end of file diff --git a/dashboard/src/components/dashboard/MiniSalesChart.jsx b/dashboard/src/components/dashboard/MiniSalesChart.jsx index 79d9b9f..d1f44d1 100644 --- a/dashboard/src/components/dashboard/MiniSalesChart.jsx +++ b/dashboard/src/components/dashboard/MiniSalesChart.jsx @@ -309,7 +309,7 @@ const MiniSalesChart = ({ className = "" }) => { trendValue={`${Math.abs(Math.round(summaryStats.growth.revenue))}%`} colorClass="text-emerald-300" titleClass="text-emerald-300 font-bold text-md" - descriptionClass="text-emerald-300 text-md font-semibold" + descriptionClass="text-emerald-300 text-md font-semibold pb-1" icon={PiggyBank} iconColor="text-emerald-900" iconBackground="bg-emerald-300" @@ -324,7 +324,7 @@ const MiniSalesChart = ({ className = "" }) => { trendValue={`${Math.abs(Math.round(summaryStats.growth.orders))}%`} colorClass="text-blue-300" titleClass="text-blue-300 font-bold text-md" - descriptionClass="text-blue-300 text-md font-semibold" + descriptionClass="text-blue-300 text-md font-semibold pb-1" icon={Truck} iconColor="text-blue-900" iconBackground="bg-blue-300"