"use client"; import { useReveal } from "@/hooks/use-reveal"; import { useT } from "@/components/locale-provider"; type Variant = "table" | "map" | "schema" | "chart" | "grid"; type Loc = { en: string; sv: string }; const PROV = ["var(--prov-0)", "var(--prov-1)", "var(--prov-2)", "var(--prov-3)"]; const TABLE_ROWS: [string | Loc, string | Loc, 0 | 1 | 2 | 3][] = [ ["Volvo Group", "GLEIF", 3], ["Equinor ASA", "Brreg", 3], ["Maersk A/S", "CVR", 2], ["Nokia Oyj", "PRH", 2], [{ en: "Email (FI)", sv: "E-post (FI)" }, { en: "license", sv: "licens" }, 0], ]; const MAP_CELLS: [string, number][] = [ ["SE", 98], ["NO", 96], ["DK", 94], ["FI", 89], ["IS", 0], ["NL", 0], ["DE", 0], ["FR", 0], ]; const CHART_BARS = [42, 61, 38, 74, 55, 88]; /** * The generative, photo-free visual primitive. Every "image" surface uses it. * Animates on scroll-into-view; settles to a complete static state under * prefers-reduced-motion. Color discipline: mono + provenance squares + ONE red. */ export function DataArtifact({ variant, className = "" }: { variant: Variant; className?: string }) { const ref = useReveal(); const t = useT(); // Resolve a value that may be a plain string (literal token) or a {en,sv} map. const tx = (v: string | Loc): string => (typeof v === "string" ? v : t(v)); return (
{variant === "table" ? (
dim_company {t({ en: "provenance", sv: "härkomst" })}
{TABLE_ROWS.map((r, i) => (
{tx(r[0])} {tx(r[1])}
))}
) : null} {variant === "map" ? (
{MAP_CELLS.map((c, i) => (

{c[0]}

{c[1] ? `${c[1]}%` : "—"}

= 95 ? "var(--prov-3)" : c[1] > 0 ? "var(--prov-2)" : "transparent" }} />
))}
) : null} {variant === "schema" ? (
{[ { n: "dim_company", key: true }, { n: "fact_financials", key: false }, { n: "bridge_provenance", key: true }, ].map((e, i) => (
{e.n}
id · key · src
))}
) : null} {variant === "chart" ? (
{t({ en: "coverage", sv: "täckning" })} 06
{CHART_BARS.map((h, i) => (
))}
) : null} {variant === "grid" ? (
0pt
) : null}
); }