import type { Metadata } from "next"; import { MOMENT_PLACEHOLDER_KEY } from "yt-dlp-transcript-common/lib/report/views"; import MomentArticle from "yt-dlp-transcript-common/components/report/MomentArticle"; import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; import { PageShell } from "../../components/PageShell"; import { momentKeys, readMomentView } from "../../lib/articles"; // /m///-/ (a span) and /m/// (a post): // one moment the articles cite, from /m//moment.json. Its record opens in // the listed public archive that publishes the channel — compose wrote that // absolute link into the view — or nowhere. Static: with none, one placeholder. export const dynamicParams = false; export function generateStaticParams(): { moment: string[] }[] { const keys = momentKeys(); return (keys.length > 0 ? keys : [MOMENT_PLACEHOLDER_KEY]).map((k) => ({ moment: k.split("/") })); } type Params = { params: Promise<{ moment: string[] }> }; async function keyOf(params: Params["params"]): Promise { return (await params).moment.map((s) => decodeURIComponent(s)).join("/"); } export async function generateMetadata({ params }: Params): Promise { const view = readMomentView(await keyOf(params)); if (!view) return { title: "No moments" }; const who = view.record.title ?? view.record.channelTitle ?? view.record.channel; return { title: `“${view.quote.length > 60 ? `${view.quote.slice(0, 57)}…` : view.quote}” — ${who}` }; } export default async function MomentPage({ params }: Params) { const view = readMomentView(await keyOf(params)); return ( {view ? ( ) : ( No article cites a moment yet. )} ); }