From 170c63d9e98f0bc154b011fe2075f51075429222 Mon Sep 17 00:00:00 2001 From: ArshVermaGit Date: Sat, 30 May 2026 01:50:56 +0530 Subject: [PATCH] feat(ui): standardize loading states with animated skeleton loaders --- src/app/globals.css | 10 ++++++++ src/components/CodingActivityInsightsCard.tsx | 9 +++---- src/components/ProjectMetrics.tsx | 25 +++++++++++++------ src/components/Skeleton.tsx | 15 +++++++++++ 4 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 src/components/Skeleton.tsx diff --git a/src/app/globals.css b/src/app/globals.css index b1d91427e..d0d51cf6a 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -337,3 +337,13 @@ body { transform: none !important; } } + +@keyframes shimmer { + 100% { + transform: translateX(100%); + } +} + +.animate-shimmer { + animation: shimmer 1.5s infinite; +} diff --git a/src/components/CodingActivityInsightsCard.tsx b/src/components/CodingActivityInsightsCard.tsx index d83cfdd62..f3d6375b7 100644 --- a/src/components/CodingActivityInsightsCard.tsx +++ b/src/components/CodingActivityInsightsCard.tsx @@ -12,6 +12,7 @@ import { YAxis, type TooltipProps, } from "recharts"; +import { Skeleton } from "@/components/Skeleton"; import { useAccount } from "@/components/AccountContext"; import { formatHourRange, @@ -272,14 +273,10 @@ export default function CodingActivityInsightsCard() { className="space-y-4" > Loading coding activity insights -
+
{[1, 2, 3].map((item) => ( -
diff --git a/src/components/ProjectMetrics.tsx b/src/components/ProjectMetrics.tsx index 8a570819a..77f9645a7 100644 --- a/src/components/ProjectMetrics.tsx +++ b/src/components/ProjectMetrics.tsx @@ -1,6 +1,7 @@ "use client"; import { useCallback, useEffect, useState } from "react"; +import { Skeleton } from "@/components/Skeleton"; interface ProjectData { metrics: { @@ -120,17 +121,25 @@ export default function ProjectMetrics() { if (loading) { return (
-

- Project Tracking -

-
+
+

+ Project Tracking +

+ +
+
{[1, 2, 3, 4].map((i) => ( -
+ ))}
+
+ +
+ {[1, 2, 3].map((i) => ( + + ))} +
+
); } diff --git a/src/components/Skeleton.tsx b/src/components/Skeleton.tsx new file mode 100644 index 000000000..f81cbb0fe --- /dev/null +++ b/src/components/Skeleton.tsx @@ -0,0 +1,15 @@ +import React from "react"; + +export function Skeleton({ + className = "", + ...props +}: React.HTMLAttributes) { + return ( +
+
+
+ ); +}