import type { Metadata } from "next"; import Link from "next/link"; import path from "node:path"; import { notFound } from "next/navigation"; import { getJobEntry } from "yt-dlp-transcript-common/jobs/listJobs"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { JobLogTail } from "./components/JobLogTail"; import { jobKindLabel } from "../jobKindLabels"; export const dynamic = "force-dynamic"; export async function generateMetadata({ params, }: { params: Promise<{ id: string }>; }): Promise { const { id } = await params; const job = await getJobEntry(getPaths(), id); if (!job) return { title: `${id} — Job` }; const scope = job.channelSlug ? job.videoId ? `${job.channelSlug}/${job.videoId}` : job.channelSlug : null; const kindLabel = job.kind ? jobKindLabel(job.kind) : "job"; const subject = scope ? `${kindLabel} (${scope})` : kindLabel; return { title: `${subject} — Job` }; } export default async function JobDetailPage({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; const job = await getJobEntry(getPaths(), id); if (!job) notFound(); return (
Jobs / {id}

{job.kind ? jobKindLabel(job.kind) : "job"}

{job.channelSlug && (

Channel:{" "} {job.channelSlug} {job.videoId && ( <> {" / Video: "} {job.videoId} )}

)}
{/* Why, when no person pressed Cancel: the boot pass's reason for a job a restart left queued (JobMeta.cancelReason). */} {job.status === "cancelled" && job.cancelReason && ( )}

log: {path.relative(getPaths().monorepoRoot, job.logPath)}

); } function Cell({ label, value, className = "", testId, }: { label: string; value: string; className?: string; testId?: string; }) { return (
{label}
{value}
); }