AI media harness for planning, generating, and editing locally
TypeScript
Add generation controls to shot inspector
Bittia800da9c43a6
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 9fce2d2..83df998 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -32,21 +32,23 @@ beforeEach(() => {});afterEach(cleanup);-it("generates only the scene open in the inspector", () => {+it.each(["scene", "shot"])("generates only the selected scene from the %s inspector", (view) => {const state = setup();- fireEvent.click(screen.getByRole("button", { name: "Select scene Second scene" }));- const panel = within(screen.getByRole("complementary", { name: "Scene: Second scene" }));+ fireEvent.click(screen.getByRole("button", { name: view === "shot" ? "Shot 1 of Second scene" : "Select scene Second scene" }));+ const panel = within(screen.getByRole("complementary", { name: view === "shot" ? "Shot 1 of Second scene" : "Scene: Second scene" }));fireEvent.click(panel.getByRole("button", { name: "Generate" }));expect(state.latest().generationJobs.map((job) => job.status)).toEqual(["draft", "queued"]);expect(panel.getByRole("button", { name: "Cancel" })).toBeEnabled();});-it.each(["queued", "generating"] as const)("cancels only the %s scene open in the inspector", (status) => {+it.each([+ ["queued", "scene"], ["generating", "scene"], ["queued", "shot"], ["generating", "shot"],+] as const)("cancels only the %s scene from the %s inspector", (status, view) => {const initial = project();initial.generationJobs.forEach((job) => { job.status = status; });setup(initial);- fireEvent.click(screen.getByRole("button", { name: "Select scene Second scene" }));- const panel = within(screen.getByRole("complementary", { name: "Scene: Second scene" }));+ fireEvent.click(screen.getByRole("button", { name: view === "shot" ? "Shot 1 of Second scene" : "Select scene Second scene" }));+ const panel = within(screen.getByRole("complementary", { name: view === "shot" ? "Shot 1 of Second scene" : "Scene: Second scene" }));fireEvent.click(panel.getByRole("button", { name: "Cancel" }));expect(cancelSlopfabGeneration).toHaveBeenCalledExactlyOnceWith("scene-second");expect(panel.getByRole("button", { name: "Cancelling…" })).toBeDisabled();diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex 268ea5a..492651c 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -674,26 +674,26 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo/></div>- <div className="inspector-actions">- {debugEnabled && !animate && <button- type="button"- className="secondary-button debug-prompt__toggle"- aria-expanded={showDebugPrompt}- aria-haspopup="dialog"- onClick={() => setShowDebugPrompt(true)}- >Debug prompt</button>}- <button- type="button"- className="primary-button"- data-tooltip={selectedCancellable ? `Cancel ${selected.title}` : selectedBlocker ?? `Generate ${selected.title}`}- disabled={selectedCancellable ? selectedCancelling : Boolean(selectedBlocker)}- onClick={() => generateScene(selected)}- >- {selectedCancellable ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}- {selectedCancellable ? selectedCancelling ? "Cancelling…" : "Cancel" : "Generate"}- </button>- </div></>}+ <div className="inspector-actions">+ {debugEnabled && !animate && !openShot && <button+ type="button"+ className="secondary-button debug-prompt__toggle"+ aria-expanded={showDebugPrompt}+ aria-haspopup="dialog"+ onClick={() => setShowDebugPrompt(true)}+ >Debug prompt</button>}+ <button+ type="button"+ className="primary-button"+ data-tooltip={selectedCancellable ? `Cancel ${selected.title}` : selectedBlocker ?? `Generate ${selected.title}`}+ disabled={selectedCancellable ? selectedCancelling : Boolean(selectedBlocker)}+ onClick={() => generateScene(selected)}+ >+ {selectedCancellable ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}+ {selectedCancellable ? selectedCancelling ? "Cancelling…" : "Cancel" : "Generate"}+ </button>+ </div></aside>}{debugEnabled && showDebugPrompt && selected && !openShot && <DebugPromptDialog