import type { Metadata } from "next"; import { REPORT_PLACEHOLDER_ID, reportFullTitle } from "yt-dlp-transcript-common/lib/report/views"; import ReportHistory from "yt-dlp-transcript-common/components/report/ReportHistory"; import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; import { REPORTS_BASE, readReportHistory, reportIds } from "../../../lib/reports"; // /pages//history/: a page's revisions, from // /pages//history/history.json. Static: built for every page (and, // with none, the placeholder, as /pages// is); a page 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 page has no published revision history.; } return ; }