mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
Route the recovery and sleep-quality device-score surfaces through the canonical card and loading primitives so they read as one family: - DeviceScoreTile titles itself with CardHeader/CardTitle + CardAction and drops its bespoke header row and padding override, so it matches the sibling sleep-debt and chronotype cards on the unified p-4 md:p-6 token. - Add DeviceScoreTileSkeleton / DeviceScoreGridSkeleton, a shared tile-shaped placeholder that mirrors the loaded layout. Recovery and sleep-quality paint it while their analytics slice loads instead of popping in. - Recovery's no-data branch now renders the shared EmptyState with an icon rather than a hand-rolled div; the sleep-quality sub-section keeps its calm collapse-to-null once data lands. - New insights.recovery.emptyTitle key across all six locales.
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import {
|
|
Card,
|
|
CardAction,
|
|
CardContent,
|
|
CardHeader,
|
|
} from "@/components/ui/card";
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
|
|
/**
|
|
* v1.17.1 — loading placeholder that mirrors {@link DeviceScoreTile}'s
|
|
* layout so the device-score grids (recovery + sleep-quality) and the lab
|
|
* list paint the same tile shape while their analytics slice loads, instead
|
|
* of popping in or showing a bespoke centred spinner. One header row (title +
|
|
* latest readout) over a sparkline block, all via the shared `Skeleton`
|
|
* primitive (which carries `motion-reduce:animate-none` for free).
|
|
*/
|
|
export function DeviceScoreTileSkeleton() {
|
|
return (
|
|
<Card data-slot="device-score-tile-skeleton" aria-hidden="true">
|
|
<CardHeader>
|
|
<Skeleton className="h-4 w-32" />
|
|
<CardAction>
|
|
<Skeleton className="h-5 w-12" />
|
|
</CardAction>
|
|
</CardHeader>
|
|
<CardContent className="space-y-3">
|
|
<Skeleton className="h-[120px] w-full" />
|
|
<Skeleton className="h-3 w-24" />
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* A `count`-wide grid of {@link DeviceScoreTileSkeleton}s, matching the
|
|
* `grid gap-4 sm:grid-cols-2` the device-score sections render their tiles in.
|
|
*/
|
|
export function DeviceScoreGridSkeleton({ count = 2 }: { count?: number }) {
|
|
return (
|
|
<div
|
|
data-slot="device-score-grid-skeleton"
|
|
className="grid gap-4 sm:grid-cols-2"
|
|
>
|
|
{Array.from({ length: count }, (_, i) => (
|
|
<DeviceScoreTileSkeleton key={i} />
|
|
))}
|
|
</div>
|
|
);
|
|
}
|