import CopyButton from "@/components/CopyButton";
import { EXPORT_FORMATS, exportableVariants } from "@/lib/report/export.mjs";
import { podcastFor } from "@/lib/report/serve.mjs";
import DeliverSection from "../DeliverSection";
import PodcastExport from "../PodcastExport";
import ShortsList from "./ShortsList";
import VariantsPanel from "./VariantsPanel";
import OutputFiles from "./OutputFiles";
import type { ReportTabProps } from "./shared";
// The Deliver tab: the deliver panel (cuts, share batches, rulings applied,
// the written report rebuilt) and the exports. Moved from ReportProject
// unchanged (P4a-1).
export default async function DeliverTab({ project, detail }: ReportTabProps) {
const { manifest: m, entries } = detail;
const variants = await exportableVariants(project.dir);
// Each exportable cut's podcast files, as they are on disk (build-podcast.mjs).
const podcastOf = async (v: string) => {
const f = async (which: "m4a" | "mp3" | "notes") => {
const got = await podcastFor(project, m, v, which);
return got ? { size: got.size, mtimeMs: got.mtimeMs } : null;
};
return { m4a: await f("m4a"), mp3: await f("mp3"), notes: await f("notes") };
};
const podcasts = new Map(await Promise.all(variants.map(async (v) => [v, await podcastOf(v)] as const)));
return (
<>
{/* --- delivering it --------------------------------------------- */}
{/* After the build chain, because that is the order the work happens
in: the video is one deliverable and the written report with its
own clip files is the other, and both wait on the same walk. */}
{/* The rendered files, as local paths with Copy (lane/ui-simplify): the newest take's first. */}
{/* --- the shorts: one clip each, 1080x1920 (release 36) ---------- */}
{/* --- variants and sync (video knobs): the encode ladder of a build, and its A/V sync report --- */}
{/* --- exports --------------------------------------------------- */}
export
{variants.length === 0 ? (
nothing built to export from — a TOC needs the build’s chapter offsets, and there is
no chapters.ffmeta and no segments under{" "}
out/