Implement skeleton loading states for dashboard and routes (P3.8)

Add skeleton loading components per specs/dashboard.md requirements:
- DecisionCardSkeleton: Shimmer placeholder for status and reason
- DataPanelSkeleton: Skeleton rows for 5 metrics
- NutritionPanelSkeleton: Skeleton for nutrition guidance
- MiniCalendarSkeleton: Placeholder grid with navigation and legend
- OverrideTogglesSkeleton: 4 toggle placeholders
- CycleInfoSkeleton: Cycle day and phase placeholders
- DashboardSkeleton: Combined skeleton for route-level loading

Add Next.js loading.tsx files for instant loading states:
- src/app/loading.tsx (Dashboard)
- src/app/calendar/loading.tsx
- src/app/history/loading.tsx
- src/app/plan/loading.tsx
- src/app/settings/loading.tsx

Update dashboard page to use DashboardSkeleton instead of "Loading..." text.

Fix flaky garmin test with wider date tolerance for timezone variations.

29 new tests in skeletons.test.tsx (749 total tests passing).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 09:32:09 +00:00
parent 714194f2d3
commit 9c5b8466f6
11 changed files with 708 additions and 13 deletions

View File

@@ -0,0 +1,53 @@
// ABOUTME: Route-level loading state for the calendar page.
// ABOUTME: Shows skeleton placeholders during page navigation.
export default function Loading() {
return (
<div className="min-h-screen bg-zinc-50 dark:bg-black">
<header className="border-b bg-white dark:bg-zinc-900 px-6 py-4">
<div className="container mx-auto">
<h1 className="text-xl font-bold">Calendar</h1>
</div>
</header>
<main className="container mx-auto p-6">
<div className="animate-pulse space-y-6">
{/* Navigation skeleton */}
<div className="flex items-center justify-between">
<div className="w-8 h-8 bg-gray-200 rounded" />
<div className="flex items-center gap-2">
<div className="h-6 w-32 bg-gray-200 rounded" />
<div className="h-8 w-16 bg-gray-200 rounded" />
</div>
<div className="w-8 h-8 bg-gray-200 rounded" />
</div>
{/* Day headers */}
<div className="grid grid-cols-7 gap-2">
{[1, 2, 3, 4, 5, 6, 7].map((i) => (
<div key={i} className="h-8 bg-gray-200 rounded text-center" />
))}
</div>
{/* Calendar grid - 6 rows */}
<div className="grid grid-cols-7 gap-2">
{Array.from({ length: 42 }).map((_, i) => (
<div
// biome-ignore lint/suspicious/noArrayIndexKey: Static skeleton placeholders never reorder
key={`skeleton-day-${i}`}
className="h-20 bg-gray-200 rounded"
/>
))}
</div>
{/* ICS Subscription section */}
<div className="rounded-lg border p-4 space-y-3">
<div className="h-5 w-48 bg-gray-200 rounded" />
<div className="h-10 bg-gray-200 rounded" />
<div className="h-4 w-64 bg-gray-200 rounded" />
</div>
</div>
</main>
</div>
);
}