import Link from "next/link"; import VerdictChip from "@/components/VerdictChip"; import NoteField from "@/components/NoteField"; import { probeAll, type Cut, type Song } from "@/lib/browse"; import { fmtAgo, fmtBytes, fmtDur } from "@/lib/format"; import { cutHref } from "@/lib/hrefs"; import type { NoteMap } from "@/lib/notes"; // The Cuts tab: the four cut cards (poster, verdicts, the slot's and the // file's notes, the variants) and what matches no cut -- SongProject's left // column, moved unchanged (P4a-3). A cut's own page (/projects//, // CutPage) is this tab's view of one cut, linked at the song's full path (P6). export default async function CutsTab({ projectId, song, notes }: { projectId: string; song: Song; notes: NoteMap }) { // Durations are worth an ffprobe HERE but not on the index: this page is a // handful of files and "which of these is the short cut" is exactly the // question it answers. Memoised by mtime in lib/browse.ts. const rels = [ ...song.cuts.flatMap((c) => [c.shipped?.rel, ...c.variants.map((v) => v.rel)]), ...song.unattributed.map((v) => v.rel), ].filter((r): r is string => !!r); const info = await probeAll(song.id, rels); return (
{song.cuts.map((cut) => ( ))} {song.unattributed.length > 0 && (
matches no cut name — attribute by renaming, never by guessing
    {song.unattributed.map((v) => (
  • {v.rel}{" "} {fmtBytes(v.size)}
  • ))}
)}
); } function CutCard({ projectId, song, cut, info, notes, }: { projectId: string; song: Song; cut: Cut; info: Record; notes: NoteMap; }) { const shipped = cut.shipped; const live = cut.variants.filter((v) => !v.retired); const retired = cut.variants.filter((v) => v.retired); return (
{shipped ? ( /* eslint-disable-next-line @next/next/no-img-element */ ) : (
not built
)}
{cut.name} {shipped ? ( {fmtDur(info[shipped.rel]?.duration ?? 0)} ) : ( — a hole in the set )} {shipped && info[shipped.rel] && ( {info[shipped.rel].width}×{info[shipped.rel].height} )} {shipped ? `${fmtBytes(shipped.size)} · ${fmtAgo(shipped.mtimeMs)}` : ""}
{shipped && ( )} {/* Two different notes, deliberately. The `cut:` one is about the SLOT -- it survives a promote and can be written about a cut that has not been built. The `file:` one is about these bytes. */} {shipped && ( )} {live.length > 0 && (
    {live.map((v) => (
  • {v.tag} {fmtDur(info[v.rel]?.duration ?? 0)} {fmtBytes(v.size)}
  • ))}
)} {retired.length > 0 && (
{retired.length} retired: {retired.map((v) => v.tag).join(", ")}
)}
); }