/** * CaseLibrary — homepage case-file strip. * * The /bureau page uses a richer browser with filters; the home only needs * a quick magazine-style preview (one hero + a few cards) above the fold. * Both pull from the shared lib/cases.ts loader. */ import Link from "next/link"; import { loadCases, type CaseFile } from "@/lib/cases"; export async function CaseLibrary({ locale, limit, layout = "hero+grid", }: { locale: "pt-br" | "en"; limit?: number; /** "hero+grid" = first case big + rest small (homepage); "grid" = all equal */ layout?: "hero+grid" | "grid"; }) { const allCases = await loadCases(locale); const cases = typeof limit === "number" ? allCases.slice(0, limit) : allCases; if (cases.length === 0) { return (

{locale === "pt-br" ? "Nenhum caso narrado ainda. As primeiras histórias chegam em breve." : "No case files yet. The first stories arrive soon."}

); } const [hero, ...rest] = cases; return (
{locale === "pt-br" ? "// Casos em destaque" : "// Featured case files"}
{layout === "hero+grid" ? ( <> {rest.length > 0 && (
{rest.map((c) => )}
)} ) : (
{cases.map((c) => )}
)}
); } function CaseHero({ c, locale }: { c: CaseFile; locale: "pt-br" | "en" }) { const title = locale === "pt-br" ? (c.topic_pt_br ?? c.topic) : c.topic; return (
{locale === "pt-br" ? "Arquivo desclassificado" : "Declassified case file"}

{title}

{c.opening && (

{c.opening}

)}
{locale === "pt-br" ? "ler o caso completo →" : "read the full case file →"}
); } function CaseCard({ c, locale }: { c: CaseFile; locale: "pt-br" | "en" }) { const title = locale === "pt-br" ? (c.topic_pt_br ?? c.topic) : c.topic; return (

{title}

{c.opening && (

{c.opening}

)}
/c/{c.slug}
); }