1+ import React from "react" ;
2+ import SkeletonCard from "./ui/SkeletonCard" ;
3+
4+ /**
5+ * AnalyticsSkeleton renders a structured placeholder layout for the dashboard.
6+ * Designed to be shown when 'isLoading' is true to prevent layout shifting.
7+ */
8+ const AnalyticsSkeleton : React . FC = ( ) => {
9+ return (
10+ < div className = "space-y-8" >
11+ { /* Top Metrics Grid (matching typical 4-column stat layout) */ }
12+ < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4" >
13+ { [ ...Array ( 4 ) ] . map ( ( _ , i ) => (
14+ < SkeletonCard key = { i } height = "h-32" className = "p-6 flex flex-col gap-3" >
15+ { /* Title placeholder */ }
16+ < div className = "h-4 w-24 bg-slate-700/50 rounded" />
17+ { /* Value placeholder */ }
18+ < div className = "h-8 w-32 bg-slate-700/50 rounded" />
19+ { /* Trend placeholder */ }
20+ < div className = "h-3 w-16 bg-slate-700/50 rounded" />
21+ </ SkeletonCard >
22+ ) ) }
23+ </ div >
24+
25+ { /* Main Analytics Charts Section */ }
26+ < div className = "grid grid-cols-1 lg:grid-cols-3 gap-6" >
27+ { /* Large Primary Chart (e.g., Volume over time) */ }
28+ < SkeletonCard className = "lg:col-span-2 p-6" height = "h-[400px]" >
29+ < div className = "flex justify-between items-center mb-8" >
30+ < div className = "h-6 w-48 bg-slate-700/50 rounded" />
31+ < div className = "h-8 w-24 bg-slate-700/50 rounded-lg" />
32+ </ div >
33+ { /* Simulated Chart Area */ }
34+ < div className = "w-full h-64 border-l border-b border-slate-700/50 relative" >
35+ < div className = "absolute bottom-4 left-4 right-4 h-32 bg-gradient-to-t from-blue-500/10 to-transparent rounded-t-lg" />
36+ </ div >
37+ </ SkeletonCard >
38+
39+ { /* Secondary Panel (e.g., Asset distribution) */ }
40+ < SkeletonCard height = "h-[400px]" className = "p-6 flex flex-col items-center justify-center" >
41+ < div className = "h-6 w-32 bg-slate-700/50 rounded mb-8 self-start" />
42+ { /* Simulated Donut Chart */ }
43+ < div className = "w-48 h-48 rounded-full border-[16px] border-slate-700/50" />
44+ < div className = "mt-8 grid grid-cols-2 gap-4 w-full" >
45+ < div className = "h-3 bg-slate-700/50 rounded" />
46+ < div className = "h-3 bg-slate-700/50 rounded" />
47+ </ div >
48+ </ SkeletonCard >
49+ </ div >
50+
51+ { /* Bottom Table/Activity Section */ }
52+ < div className = "space-y-4" >
53+ < div className = "h-6 w-48 bg-slate-800/50 animate-pulse rounded" />
54+ < SkeletonCard height = "h-64" className = "divide-y divide-slate-700/30" >
55+ { [ ...Array ( 5 ) ] . map ( ( _ , i ) => (
56+ < div key = { i } className = "h-12 w-full bg-transparent" />
57+ ) ) }
58+ </ SkeletonCard >
59+ </ div >
60+ </ div >
61+ ) ;
62+ } ;
63+ export default AnalyticsSkeleton ;
0 commit comments