AI media harness for planning, generating, and editing locally
TypeScript
Mark the scene open in Generator in the Timeline's sources
Bitti0ec4d81ddb37
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex 49f2d3f..5b4ee19 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -7,7 +7,7 @@ import { listen } from "@tauri-apps/api/event";import { createElement } from "react";import { afterEach, describe, expect, it, vi } from "vitest";import completeFixture from "../../fixtures/project-v1-complete.json";-import { compileMiniMaxH3Prompt, createProjectConfig, parseProjectConfig, sceneShots, UNTITLED_SCENE, type GenerationJob, type ProjectConfig, type ProjectRecord } from "../lib/project";+import { compileMiniMaxH3Prompt, createDraftGenerationJob, createProjectConfig, parseProjectConfig, sceneShots, UNTITLED_SCENE, type GenerationJob, type ProjectConfig, type ProjectRecord } from "../lib/project";import { saveGeneratedScene } from "../lib/generatedVideo";import { formatDurationTimecode, formatSavedAt, formatSequenceLength, isGenerationOngoing } from "./ProjectWorkspace";import { ProjectWorkspace } from "./ProjectWorkspace";@@ -182,6 +182,21 @@ describe("project workspace timecode", () => {expect(document.querySelectorAll(".ui-statusbar")).toHaveLength(1);});+ it("marks the scene open in the Generator in the Timeline's sources", () => {+ const base = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });+ const config = { ...base, generationJobs: [+ createDraftGenerationJob("First", { id: "scene-first", title: "First scene" }),+ createDraftGenerationJob("Second", { id: "scene-second", title: "Second scene" }),+ ] };+ render(createElement(ProjectWorkspace, { project: { folderPath: "C:\Ceramic Lamp", config }, initialView: "generator", onBack: () => undefined, onSave: async () => undefined }));+ fireEvent.click(screen.getByRole("button", { name: "Select scene Second scene" }));+ const tabs = screen.getByRole("tablist", { name: "Project views" });+ fireEvent.click(within(tabs).getByRole("tab", { name: "Timeline" }));+ const open = [...document.querySelectorAll(".scene-card.is-selected")];+ expect(open).toHaveLength(1);+ expect(open[0]).toHaveTextContent("Second scene");+ });+it("surfaces native save failures in the workspace, inline under the title bar", async () => {const record = { folderPath: "C:\\Portable Launch Film", config: parseProjectConfig(completeFixture) };const queue = new WorkQueue(async () => { throw new Error("The original project file is locked."); });diff --git a/src/components/ProjectWorkspace.tsx b/src/components/ProjectWorkspace.tsxindex 6d5d244..3511d07 100644--- a/src/components/ProjectWorkspace.tsx+++ b/src/components/ProjectWorkspace.tsx@@ -294,8 +294,8 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =<div className={`project-body${agentOpen ? " project-body--agent" : ""}`} style={agentPane.style}><div id={`${panelId}-view`} role="tabpanel" aria-label={VIEW_LABELS[view]} className={`project-content project-content--${view}`}>{view === "editor" && imageProject && <ImageEditor config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template) => queue.enqueueImage(session, template)} onCancel={(id) => queue.cancel(id)} work={projectItems.filter((item) => item.kind === "image").at(-1)} />}- {view === "timeline" && <TimelineView config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView(imageProject ? "editor" : "generator"); }} />}- {view === "generator" && <GeneratorView onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}+ {view === "timeline" && <TimelineView config={config} openSceneId={selectedGenerationJobId} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView(imageProject ? "editor" : "generator"); }} />}+ {view === "generator" && <GeneratorView onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onSelectedJobChange={setSelectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}{view === "references" && <ReferencesView config={config} folderPath={project.folderPath} onChange={changeConfig} onRegenerateIcon={(id) => queue.regenerateReferenceIcon(session, id)} onGenerateBuiltinIcons={() => queue.generateBuiltinReferenceIcons(session)} onRegenerateBuiltinIcon={(id) => queue.regenerateBuiltinReferenceIcon(session, id)} pendingBuiltinIconIds={queue.pendingBuiltinIconIds()} pendingIconIds={new Set(config.references.filter((reference) => queue.isReferenceIconPending(session, reference.id)).map((reference) => reference.id))} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView("generator"); }} />}{view === "export" && <ExportView config={config} folderPath={project.folderPath} onClose={() => setView("timeline")} />}</div>diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex ee65a35..1822276 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -35,6 +35,9 @@ interface GeneratorViewProps {cancellingJobIds?: ReadonlySet<string>;onOpenTimeline: () => void;selectedJobId?: string;+ /** The scene open here, whenever it changes — the Timeline marks it in its+ * sources, and the Generator reopens on it. */+ onSelectedJobChange?: (jobId: string) => void;onRuntimeChange?: (runtime: SlopfabStatus) => void;}@@ -54,7 +57,7 @@ const readDensity = (): BoardDensity => {* The panel is whatever is open — one shot, or the scene itself. Nothing is* edited on the board, and nothing is duplicated in the panel: there is exactly* one place to change any given thing. */-export function GeneratorView({ config, folderPath, runtime = null, generationCompletionTimes = {}, onChange, selectedJobId, onRuntimeChange, onGenerate, onCancelGeneration, cancellingJobIds = new Set() }: GeneratorViewProps) {+export function GeneratorView({ config, folderPath, runtime = null, generationCompletionTimes = {}, onChange, selectedJobId, onSelectedJobChange, onRuntimeChange, onGenerate, onCancelGeneration, cancellingJobIds = new Set() }: GeneratorViewProps) {const jobs = config.generationJobs;const [templateSettings, setTemplateSettings] = useState(loadGeneratorTemplateSettings);const selectedTemplate = defaultGeneratorTemplate(templateSettings);@@ -130,7 +133,14 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo});}, [templateKey]);- useEffect(() => { if (selectedJobId) setSelection({ jobId: selectedJobId, shotId: null }); }, [selectedJobId]);+ /* The workspace hears which scene is open, and may send one back (Open in+ Generator). Its echo of this panel's own choice must not close the shot. */+ useEffect(() => {+ if (selectedJobId) setSelection((current) => current.jobId === selectedJobId ? current : { jobId: selectedJobId, shotId: null });+ }, [selectedJobId]);+ const reportSelection = useRef(onSelectedJobChange);+ reportSelection.current = onSelectedJobChange;+ useEffect(() => { if (selection.jobId) reportSelection.current?.(selection.jobId); }, [selection.jobId]);/* A scene can be deleted, and a shot can be removed, from under the panel.Falling back to the first scene beats a panel pointing at nothing. */