"use client"; import { DataArtifact } from "@/components/data-artifact"; import { useT } from "@/components/locale-provider"; /** * Shared loading / empty / error states for the 0pt portal. * Mono, square, radius 0. One red accent per screen, used at most once * (the single EmptyState CTA). No fetching here — pure presentation. * * LoadingSkeleton: hairline rows with a slow left-to-right sweep (not pulsing * blobs). EmptyState: centered, generous air, faint DataArtifact "grid" motif. * ErrorState: terse interface voice + "Försök igen". */ /** Hairline shimmer rows — a slow sweep travels left→right across each bar. */ export function LoadingSkeleton({ rows = 5 }: { rows?: number }) { const t = useT(); return (
{t({ en: "loading", sv: "laddar" })} ·
{Array.from({ length: Math.max(1, rows) }).map((_, i) => (
))} {t({ en: "Loading content", sv: "Laddar innehåll" })}
); } /** Nothing here yet — centered, lots of air, faint grid motif, one red CTA max. */ export function EmptyState({ title, line, ctaHref, ctaLabel, }: { title: string; line: string; ctaHref?: string; ctaLabel?: string; }) { const t = useT(); return (

{t({ en: "empty", sv: "tomt" })}

{title}

{line}

{ctaHref && ctaLabel ? ( {ctaLabel} → ) : null}
); } /** Something broke — interface voice, single retry. */ export function ErrorState({ title, onRetry, }: { title?: string; onRetry?: () => void; }) { const t = useT(); const resolvedTitle = title ?? t({ en: "Something went wrong", sv: "Något gick fel" }); return (

{t({ en: "error", sv: "fel" })}

{resolvedTitle}

{t({ en: "Couldn't fetch data. No changes were saved.", sv: "Kunde inte hämta data. Ingen ändring sparad." })}

{onRetry ? ( ) : null}
); }