import GeneratedBanner from "@/components/notes/GeneratedBanner"; import { postItemSeconds } from "umtool-report-to-video/post-item"; import { NotesProvider } from "@/components/notes/NotesProvider"; import { channelFor, clipsOf } from "@/lib/projects/report.mjs"; import type { PieceFrame } from "@/lib/pieces/frame"; import { awaitingReviewOf } from "@/lib/report/draft-provenance.mjs"; import BuildTab from "./BuildTab"; import CutTab from "./CutTab"; import DeliverTab from "./DeliverTab"; import HistoryTab from "./HistoryTab"; import MediaTab from "./MediaTab"; import OverviewTab from "./OverviewTab"; import SourcesTab from "./SourcesTab"; import { hms, type ClipDetail, type ReportTabProps } from "./shared"; // ONE TAB of a report video's sections (P4a-1), wherever the video is drawn: // its own piece page (ReportProject) or, since P4a-2, the video tabs of the // article piece that claims it (components/articles/ArticlePage.tsx). The // project's notes are the target of everything under it. /** * The tabs' counts (Cut: clips, Media: the fields awaiting review -- the Inbox's * drafts card's number, lib/inbox/drafts.mjs awaitingReview -- Sources: recordings). */ export async function reportCounts(detail: ClipDetail, dir: string): Promise<{ cut: number; media: number; sources: number }> { const m = detail.manifest; const clips = detail.entries.filter((e) => e.kind === "clip").length; const media = (await awaitingReviewOf(dir, m)).length; const sources = new Set(clipsOf(m).map((e: { video: string }) => `${channelFor(m, e)}/${e.video}`)).size; return { cut: clips, media, sources }; } /** The page's one-line status: `4 clips · 2 other · 0:12 · not built`. */ export function reportStatus(detail: ClipDetail): string { const clips = detail.entries.filter((e) => e.kind === "clip"); const posts = detail.entries.filter((e) => e.kind === "post"); const nonClips = detail.entries.filter((e) => e.kind !== "clip" && e.kind !== "post"); const runtime = clips.reduce((n, e) => n + Math.max(0, e.end - e.start), 0) + posts.reduce((n, e) => n + postItemSeconds(e), 0); return ( `${clips.length} clips` + (posts.length ? ` · ${posts.length} posts` : "") + (nonClips.length ? ` · ${nonClips.length} other` : "") + ` · ${hms(runtime)} · ${detail.build.built ? "built" : "not built"}` ); } export default function ReportTabBody({ tab, frame, fold = false, ...props }: ReportTabProps & { tab: string; frame: PieceFrame; /** * The project piece's four tabs (L7b, lib/pieces/tabs.mjs PIECE_FOLDED): Deliver draws what Build and Media * held, above its own. An article piece keeps the seven (its Build and Media tabs are their own). */ fold?: boolean; }) { const m = props.detail.manifest; return (
{tab === "overview" && } {tab === "cut" && } {tab === "media" && !fold && } {tab === "build" && !fold && } {tab === "deliver" && fold && ( <> {/* What was Build: the build chain and the final mp4. */} {/* What was Media: the drafted fields, the upload's text, the on-screen panel. */} )} {tab === "deliver" && } {tab === "sources" && } {tab === "history" && }
); }