import Link from "next/link"; import type { ReportIndexView } from "../../lib/report/views"; import { EmptyState, Eyebrow, ReportName, dateLabel } from "./parts"; // A report index: one card per published report, in the index's order: its // name, subtitle and dates -- its counts and tally are the report page's. (A // site has none since release 26: its header links each page by its title.) `heading: null` draws no heading (the home page: the // header already names the site). `empty` is what an index with nothing in it // says. export default function ReportIndex({ index, heading = "Reports", tagline, empty = { title: "No reports", message: "This site has not published a report yet." }, }: { index: ReportIndexView | null; heading?: string | null; tagline?: string; empty?: { title: string; message: string }; }) { const reports = index?.reports ?? []; if (reports.length === 0) { return {empty.message}; } return (
{(heading || tagline) && (
{heading &&

{heading}

} {tagline &&

{tagline}

}
)}
); }