"use client"; import type { ReactNode } from "react"; import { AlertTriangle, RotateCw } from "lucide-react"; import { Button } from "@/components/ui/button"; import { useTranslations } from "@/lib/i18n/context"; import { cn } from "@/lib/utils"; /** * Read-failure row — the compact sibling of ``. * * Two dense metric surfaces (the HealthKit metric sub-pages and the vitals * dashboard) had each hand-rolled the identical row: a one-line message with * a Retry button on the same baseline. The tall centred card is the right * shape for a primary list surface, but on a strip of tiles it dominates the * geometry and pushes everything the user came for below the fold — so this * shape stays, promoted to a primitive instead of being copied a third time. * * Pick by surface (UI-STANDARDS §6): * - primary / list surface → `QueryErrorCard` * - dense metric strip or tile where the tall card would dominate → * `QueryErrorRow` * - chart body → `ChartErrorState` * * One deliberate change from the copies it replaces: the message renders in * `text-foreground`. An alert IS the content of a failed surface, and §3 * reserves muted for meta — both copies had it muted. */ export function QueryErrorRow({ message, onRetry, retryLabel, slot, retrySlot, className, }: { /** The failure line. Defaults to the generic `common.loadFailed`. */ message?: ReactNode; onRetry?: () => void; retryLabel?: string; /** * Overrides the row's `data-slot`. The two converted surfaces keep their * shipped hooks (`healthkit-metric-error`, `vitals-dashboard-error`) so * their tests and any e2e selector stay stable. */ slot?: string; /** Same, for the Retry button's own `data-slot`. */ retrySlot?: string; className?: string; }) { const { t } = useTranslations(); return (
{onRetry ? ( ) : null}
); }