- Add CATEGORY_TYPES_ALL constant and isOverBudget direction-aware helper
- Derive groupedSections via useMemo (filters empty groups, computes totals)
- Initialize openSections state with smart defaults (over-budget expanded)
- State resets on month navigation via key={budgetId} on DashboardContent
- Insert CollapsibleSections between chart grid and QuickAdd
- Add skeleton placeholders for collapsible sections area in DashboardSkeleton
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { Skeleton } from "@/components/ui/skeleton"
|
|
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
|
|
|
function SkeletonStatCard() {
|
|
return (
|
|
<Card>
|
|
<CardHeader className="pb-2">
|
|
<Skeleton className="h-4 w-24" />
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Skeleton className="h-8 w-32" />
|
|
<Skeleton className="mt-1 h-3 w-20" />
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
}
|
|
|
|
export function DashboardSkeleton() {
|
|
return (
|
|
<div className="flex flex-col gap-6">
|
|
{/* Summary cards skeleton */}
|
|
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
|
<SkeletonStatCard />
|
|
<SkeletonStatCard />
|
|
<SkeletonStatCard />
|
|
</div>
|
|
|
|
{/* 3-column chart area skeleton */}
|
|
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
<Card>
|
|
<CardHeader>
|
|
<Skeleton className="h-5 w-40" />
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Skeleton className="h-[250px] w-full rounded-md" />
|
|
</CardContent>
|
|
</Card>
|
|
<Card>
|
|
<CardHeader>
|
|
<Skeleton className="h-5 w-40" />
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Skeleton className="h-[250px] w-full rounded-md" />
|
|
</CardContent>
|
|
</Card>
|
|
<Card>
|
|
<CardHeader>
|
|
<Skeleton className="h-5 w-40" />
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Skeleton className="h-[250px] w-full rounded-md" />
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
|
|
{/* Collapsible sections skeleton */}
|
|
<div className="space-y-3">
|
|
{[1, 2, 3].map((i) => (
|
|
<div key={i} className="flex items-center gap-3 rounded-md border-l-4 border-muted bg-card px-4 py-3">
|
|
<Skeleton className="size-4" />
|
|
<Skeleton className="h-4 w-32" />
|
|
<div className="ml-auto flex items-center gap-2">
|
|
<Skeleton className="h-5 w-24 rounded-full" />
|
|
<Skeleton className="h-5 w-24 rounded-full" />
|
|
<Skeleton className="h-4 w-16" />
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|