import Link from "next/link"; import type { ProjectRef } from "@/lib/project-types"; import { readManifest } from "@/lib/projects/report.mjs"; import { playView } from "@/lib/report/playView.mjs"; import { presentPayload } from "@/lib/report/present.mjs"; import { isWorkspaceMode, workspaceHref } from "@/lib/hrefs"; import { readinessOf } from "@/lib/inbox/readiness"; import { NotesProvider } from "@/components/notes/NotesProvider"; import { RememberCut } from "@/components/shell/RecentCuts"; import CutApp from "../cutApp/CutApp"; import ReportProject from "../ReportProject"; import type { PlayViewData } from "../review/PlayCut"; import type { PresentPayload } from "../present/PresentView"; import Workspace from "./Workspace"; // `/projects/` for a report video -- THE WORKSPACE (umtool redesign L7a; components/projects/workspace/ // Workspace.tsx): the draft playing, its blocks, the inspector, one screen. `?block=` opens with that block // selected (`&at=` seconds into it). `?mode=review` the review pass, `?mode=present` present mode (L7b), either // with `?take=` for a saved version, read-only. A project whose draft cannot be read is the piece page, // which says why. The piece page's tabs stay at `?tab=` (lib/projects/kinds.mjs opensWorkspace). export default async function WorkspacePage({ project, search }: { project: ProjectRef; search: Record }) { const mode = isWorkspaceMode(search.mode) ? search.mode : "edit"; const take = mode !== "edit" && search.take ? search.take : null; const [view, m, present, readiness] = await Promise.all([ playView(project, { take }), readManifest(project.dir).catch(() => null), mode === "present" ? presentPayload(project, { take, canUncensor: true }) : Promise.resolve(null), take ? Promise.resolve(null) : readinessOf(project), ]); if ("error" in view) { if (!take) return ; return (

{String(view.error)}

‹ the draft
); } const manifest = (m ?? {}) as { render?: { intro?: unknown }; ledger?: unknown; ledgerSchema?: unknown; generatedBy?: unknown }; const at = Number(search.at); return ( {/* Keyed on the address's mode and take: a navigation that changes either (Versions ▾ → Review, a pill, "Done — back to Edit" from a version) is a fresh workspace, so its mode and the cut it shows never part (L7b). */} 0 ? at : null} initialMode={mode} presentInitial={present && !("error" in present) ? (present as unknown as PresentPayload) : null} readiness={readiness} introWritten={manifest.render?.intro ?? null} hasLedger={Array.isArray(manifest.ledger) || !!manifest.ledgerSchema} generatedBy={typeof manifest.generatedBy === "string" ? manifest.generatedBy : null} /> ); }