import Link from "next/link"; import AppShell from "@/components/shell/AppShell"; import ArchiveInventory from "@/components/research/ArchiveInventory"; import { badgeVariants } from "@/components/ui/badge"; import { scopeFrom } from "@/lib/research/corpus"; import { coverageOf } from "@/lib/research/coverage"; import { researchArchiveHref, researchHref } from "@/lib/research/hrefs"; import { listSources, shownSources } from "@/lib/research/sources"; import type { CoverageResponse } from "@/lib/research/types"; export const dynamic = "force-dynamic"; // THE ARCHIVE INVENTORY (plans/umtool-redesign.md, "Research, first-class" 6): // what the archive can and cannot answer -- channels × years, what is held and // what is published, the gaps. A static segment under app/research/, so it is // never a case id when R2 adds /research/. The numbers are // lib/research/coverage.ts's; the grid is the client's (hover, keys, Table). export default async function ArchivePage({ searchParams }: { searchParams: Promise> }) { const sp = await searchParams; const params = new URLSearchParams(); for (const [k, v] of Object.entries(sp)) for (const x of Array.isArray(v) ? v : v !== undefined ? [v] : []) params.append(k, x); const sources = await listSources(); const scope = scopeFrom(params); if (!scope.source || !sources.some((s) => s.handle === scope.source)) scope.source = sources[0].handle; let data: CoverageResponse | null = null; let error: string | null = null; try { data = await coverageOf(scope); } catch (e) { error = (e as Error).message; } const at = (handle: string) => (handle === sources[0].handle ? undefined : handle); // settings.privacy.hidePrivateSites: what the source links DRAW (the full // list above stays the allow-list and the default). const shown = await shownSources(sources, scope.source); return (
{error ? (

{error}

) : data ? ( ) : null}
); }