From 61f2393431bf2ba804ea0e121b436da8e4f886b1 Mon Sep 17 00:00:00 2001 From: Mohammed Rayan A Date: Sun, 19 Jul 2026 00:25:35 +0530 Subject: [PATCH] feat: implement inline shimmer skeleton loading states --- app/components/Dashboard.tsx | 19 +++++----- app/components/ui/ResourceSkeleton.tsx | 52 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 app/components/ui/ResourceSkeleton.tsx diff --git a/app/components/Dashboard.tsx b/app/components/Dashboard.tsx index 889fd7a..60bca3a 100644 --- a/app/components/Dashboard.tsx +++ b/app/components/Dashboard.tsx @@ -1,6 +1,6 @@ 'use client' -import { Edit, ExternalLink, FolderPlus, Globe, Loader2, Lock, MoreHorizontal, Search, Trash2, Sparkles } from 'lucide-react' +import { Edit, ExternalLink, FolderPlus, Globe, Lock, MoreHorizontal, Search, Trash2, Sparkles } from 'lucide-react' import { Tooltip } from 'react-tooltip' import { useEffect, useMemo, useRef, useState } from 'react' import { useAuth } from '../contexts/AuthContext' @@ -9,6 +9,7 @@ import { authFetch } from '../lib/authFetch' import { CollectionsSidebar } from './collections/CollectionsSidebar' import { ResourceCollectionManager } from './collections/ResourceCollectionManager' import { EditResource } from './EditResource' +import { ResourceSkeleton } from './ui/ResourceSkeleton' function formatDate(dateValue: any): string { if (!dateValue) return '' @@ -126,13 +127,7 @@ export function Dashboard({ onNavigate }: { onNavigate?: (page: 'dashboard' | 'a } } - if (loading) { - return ( -
- -
- ) - } + // We render inline skeletons inside the feed area below rather than block the entire dashboard UI return ( <> @@ -220,7 +215,13 @@ export function Dashboard({ onNavigate }: { onNavigate?: (page: 'dashboard' | 'a - {resources.length === 0 ? ( + {loading ? ( +
+ {Array.from({ length: 6 }).map((_, idx) => ( + + ))} +
+ ) : resources.length === 0 ? (
diff --git a/app/components/ui/ResourceSkeleton.tsx b/app/components/ui/ResourceSkeleton.tsx new file mode 100644 index 0000000..4e61bf8 --- /dev/null +++ b/app/components/ui/ResourceSkeleton.tsx @@ -0,0 +1,52 @@ +'use client' + +import { MoreHorizontal } from 'lucide-react' + +export function ResourceSkeleton() { + return ( +
+ {/* Card Header Chips */} +
+
+ {/* Tag Chip */} +
+ {/* Index Status Chip */} +
+ {/* Visibility Chip */} +
+
+ + {/* Actions Button Skeleton */} +
+ +
+
+ + {/* Resource Title */} +
+
+
+
+ + {/* Note Content */} +
+
+
+
+ + {/* Collection Chips */} +
+
+
+
+ + {/* Card Footer */} +
+ {/* Date skeleton */} +
+ {/* Open link skeleton */} +
+
+
+ ) +}