import type { Metadata } from "next"; import { REPORT_PLACEHOLDER_ID, reportFullTitle } from "yt-dlp-transcript-common/lib/report/views"; import ReportHistory from "../../../components/reports/ReportHistory"; import { EmptyState } from "../../../components/reports/parts"; import { readReportHistory, reportIds } from "../../../lib/reports"; // /reports//history/: the report's revisions, from // /reports//history/history.json. Static: built for every published // report (and, with none, the placeholder, as /reports// is); a // report with no published history says so. export const dynamicParams = false; export function generateStaticParams(): { reportId: string }[] { const ids = reportIds(); return (ids.length > 0 ? ids : [REPORT_PLACEHOLDER_ID]).map((reportId) => ({ reportId })); } type Params = { params: Promise<{ reportId: string }> }; export async function generateMetadata({ params }: Params): Promise { const view = readReportHistory((await params).reportId); if (!view) return { title: "No history" }; return { title: `Revision history — ${reportFullTitle(view)}` }; } export default async function ReportHistoryPage({ params }: Params) { const view = readReportHistory((await params).reportId); if (!view) { return This report has no published revision history.; } return ; }