import type { Metadata } from "next"; import { isCitedSite } from "yt-dlp-transcript-common/lib/siteSchema"; import { currentSite } from "../lib/site"; import { instanceMode } from "../lib/mode"; import { onlyReportView, readReportIndex, reportMetadata } from "../lib/reports"; import NewSinceLastVisit from "../components/NewSinceLastVisit"; import HubHome from "../components/hub/HubHome"; import ReportIndex from "../components/reports/ReportIndex"; import ReportArticle from "../components/reports/ReportArticle"; // A cited site with one report: the home page IS the report, so its tab names // the report as the report's own page does. Every other home keeps the // layout's default title (the site's). export function generateMetadata(): Metadata { if (instanceMode() === "hub" || !isCitedSite(currentSite())) return {}; const only = onlyReportView(); return only ? reportMetadata(only) : {}; } export default async function Home() { // Hub mode renders the federated shelf + cross-site search and reads no local // summaries manifest (there is none), so branch before countTranscripts(). // The workspace layout passes hub children straight through, so // stays fully self-contained (its own PlayerProvider + MultiSiteDataProvider). if (instanceMode() === "hub") { return ; } const settings = currentSite(); // A cited site publishes only its reports and their moments: its home is the // report index (a static export has no redirect to send it there), and it // has no summaries manifest, so countTranscripts() — which throws without // one — is never reached: its module is not even loaded on this path. // // With ONE published report the home page IS that report (the header then // links nothing: there is nowhere else to go). With more, the index -- no // heading of its own: the header already names the site. if (isCitedSite(settings)) { const only = onlyReportView(); if (only) return ; return ; } const { countTranscripts } = await import("yt-dlp-transcript-common/lib/transcripts"); const count = await countTranscripts(); // The corpus data source, SearchSession, the persistent search bar, AND the // results pane all live in the workspace shell (layout → WorkspaceView). This // page renders only the results pane's INTRO chrome — the transcript-count // header — which the shell slots above the results. return (

{count.toLocaleString()}{" "} transcripts

{settings.homeTagline && (

{settings.homeTagline}

)}
); }