From 08ddba358a4c1db0a6be39e9319f8a7908b2c166 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 2 Jan 2025 17:08:57 -0500 Subject: [PATCH] Update loading states --- .../components/dashboard/MiniStatCards.jsx | 133 ++++++++++++++---- 1 file changed, 109 insertions(+), 24 deletions(-) diff --git a/dashboard/src/components/dashboard/MiniStatCards.jsx b/dashboard/src/components/dashboard/MiniStatCards.jsx index 306e1bc..9953eb7 100644 --- a/dashboard/src/components/dashboard/MiniStatCards.jsx +++ b/dashboard/src/components/dashboard/MiniStatCards.jsx @@ -62,43 +62,73 @@ import { // Mini skeleton components const MiniSkeletonChart = ({ type = "line" }) => ( -
+
{/* Grid lines */} {[...Array(5)].map((_, i) => (
))} {/* Y-axis labels */} -
+
{[...Array(5)].map((_, i) => ( - + ))}
{/* X-axis labels */} -
+
{[...Array(6)].map((_, i) => ( - + ))}
{type === "bar" ? ( -
+
{[...Array(24)].map((_, i) => (
))}
) : ( -
+
(
); -const MiniSkeletonTable = ({ rows = 8 }) => ( -
+const MiniSkeletonTable = ({ rows = 8, colorScheme = "orange" }) => ( +
- + - + - + - + {[...Array(rows)].map((_, i) => ( - + - + - + - + ))} @@ -465,7 +530,9 @@ const MiniStatCards = ({
Proj: {projectionLoading ? ( - +
+ +
) : ( formatCurrency( projection?.projectedRevenue || stats.projectedRevenue @@ -476,7 +543,16 @@ const MiniStatCards = ({ } progress={stats?.periodProgress < 100 ? stats.periodProgress : undefined} trend={projectionLoading && stats?.periodProgress < 100 ? undefined : revenueTrend?.trend} - trendValue={revenueTrend?.value ? formatPercentage(revenueTrend.value) : null} + trendValue={ + projectionLoading && stats?.periodProgress < 100 ? ( +
+ + +
+ ) : revenueTrend?.value ? ( + formatPercentage(revenueTrend.value) + ) : null + } colorClass="text-emerald-200" titleClass="text-emerald-100 font-bold text-md" descriptionClass="text-emerald-200 text-md font-semibold" @@ -576,11 +652,20 @@ const MiniStatCards = ({ {detailDataLoading[selectedMetric] ? (
{selectedMetric === "shipping" ? ( - + ) : ( <> {selectedMetric === "orders" && (
@@ -593,7 +678,7 @@ const MiniStatCards = ({ }`}> Hourly Distribution - +
)}