/** * Loading and refreshing affordances (Task F.1b-fix). * * Two states that used to be conflated, and the difference matters: * * - `PageSkeleton` is for the *first* load, when there is genuinely nothing to * show. It mimics the shape of the real content so the page does not jump * when the data lands. * - `RefreshingIndicator` is for a *background* refetch, when cached data is * already on screen. The data stays; a small marker says it is being updated. * * A page that blanks during a background refetch is the bug this exists to * prevent: with a 30 s staleTime the common case is a refetch the user did not * ask for, and replacing the content with a spinner makes the app feel slower * than no cache at all. */ import { Loader2 } from 'lucide-react' function Block({ className }: { className: string }) { return
} /** * A page-shaped skeleton: title, a row of stat tiles, then a content block. * * Deliberately not a centred spinner. A spinner says "wait"; this says "this is * roughly what is coming", which is the actual information available. */ export function PageSkeleton({ label }: { label: string }) { return (
{Array.from({ length: 4 }, (_, i) => (
))}
{label}
) } /** A tighter skeleton for pages that are one list, e.g. findings. */ export function ListSkeleton({ label, rows = 5 }: { label: string; rows?: number }) { return (
{Array.from({ length: rows }, (_, i) => (
))} {label}
) } /** * The background-refetch marker. * * Rendered only when data is already on screen and a refetch is in flight, so it * never appears on a first load and never replaces content. */ export function RefreshingIndicator({ show }: { show: boolean }) { if (!show) return null return ( ) }