diff --git a/src/app/medications/page.tsx b/src/app/medications/page.tsx index f6bdb4177..b36458230 100644 --- a/src/app/medications/page.tsx +++ b/src/app/medications/page.tsx @@ -13,7 +13,9 @@ import type { MedicationPayload } from "@/components/medications/wizard/wizard-p import { MedicationCard } from "@/components/medications/medication-card"; import { Glp1MedicationCard } from "@/components/medications/glp1-medication-card"; import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; import { EmptyState } from "@/components/ui/empty-state"; +import { Skeleton } from "@/components/ui/skeleton"; import { Loader2, Pill, Plus } from "lucide-react"; interface Schedule { @@ -71,6 +73,44 @@ interface Medication { schedules: Schedule[]; } +/** + * v1.11.3 C4 — loading placeholder for one medication card. Renders the + * real `Card`/`CardContent` shell (so padding, radius and gap match the + * loaded card exactly) with the shared `Skeleton` primitive standing in + * for each populated slot: header title + dose, status pill, next / last + * line, the two compliance bars and the action row. Replacing the bare + * centred spinner with a grid of these stops the layout jump when the + * cards resolve. + */ +function MedicationCardSkeleton() { + return ( + + ); +} + export default function MedicationsPage() { const { isAuthenticated, isLoading: authLoading } = useAuth(); const { t } = useTranslations(); @@ -223,8 +263,18 @@ export default function MedicationsPage() { {isLoading ? ( -
- + // v1.11.3 C4 — card skeletons instead of a bare centred spinner so + // the page reserves the loaded layout and does not jump when the + // medications resolve. +
+ {Array.from({ length: 4 }).map((_, i) => ( + + ))}
) : isError ? (