Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

The generator is a board of shot cards and one panel

Bittif35c09f8791b
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.ts
index 367fbed..ae0f375 100644
--- a/src/components/ProjectWorkspace.test.ts
+++ b/src/components/ProjectWorkspace.test.ts
@@ -924,7 +924,7 @@ describe("project workspace timecode", () => {
render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
expect(screen.queryByText("1 reference guides this scene")).toBeNull();
expect(screen.getByText("No references used by this scene")).not.toBeNull();
- expect(screen.getByText("The video engine only follows the words above.")).not.toBeNull();
+ expect(screen.getByText("The video engine only follows the words in the shots.")).not.toBeNull();
// The claim that a text definition is written into the prompt must not
// appear when nothing is written into it.
expect(screen.queryByText(/text definitions are written into this scene/)).toBeNull();
@@ -951,11 +951,17 @@ describe("project workspace timecode", () => {
onBack: () => undefined, onSave: async () => undefined,
}));
const line = () => screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement;
+ openShot(1);
fireEvent.change(line(), { target: { value: "a slow push across the launch pad" } });
fireEvent.click(screen.getByRole("button", { name: "Timeline" }));
await screen.findByRole("heading", { name: "Timeline", level: 2 });
fireEvent.click(screen.getByRole("button", { name: "Generator" }));
await screen.findByRole("heading", { name: "Generator" });
+ /* The trip unmounted the generator, so the panel is back on the scene and
+ the card is where the words have to have survived. */
+ expect(screen.getByRole("button", { name: "Shot 1 of First scene" }).textContent)
+ .toContain("a slow push across the launch pad");
+ openShot(1);
/* Switching tabs unmounts the generator. The words are no longer typed into
a composer the parent has to hold on its behalf — every keystroke lands on
the scene itself, so the project carries them across the trip. Losing the
@@ -1032,6 +1038,21 @@ describe("project workspace timecode", () => {
expect(screenText).toContain("Not described yet — the picture is sent, but nothing tells the engine what to keep.");
});
+ /* The Generator is a board of shot cards and a panel that edits whichever
+ one is open. It opens on the SCENE — the thing with a state, a prompt and a
+ Generate button — so a test that wants a shot's own controls has to choose
+ its card first, exactly as a user would. */
+
+ /** Opens one shot's card, which is what puts its line and settings in the
+ * panel on the right. */
+ const openShot = (shotNumber: number, sceneTitle = "First scene") =>
+ fireEvent.click(screen.getByRole("button", { name: `Shot ${shotNumber} of ${sceneTitle}` }));
+
+ /** Opens the scene's own settings, which live on the line that separates its
+ * row of cards from the next scene's. */
+ const openScene = (sceneTitle = "First scene") =>
+ fireEvent.click(screen.getByRole("button", { name: `Scene settings for ${sceneTitle}` }));
+
/** Adds one setting to one shot: choose the setting, then choose its value.
* Settings are added one at a time now, rather than laid out as a wall of
* every term the vocabulary holds. */
@@ -1042,16 +1063,23 @@ describe("project workspace timecode", () => {
const lampProject = () => createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
- it("calls the rail Scenes, drops the eyebrow, and offers no way back to the timeline from the header", () => {
+ it("has no scene rail: the scenes ARE the board, and the panel edits one thing", () => {
const fresh = lampProject();
for (const config of [parseProjectConfig({ ...fresh, generationJobs: [] }), fresh]) {
+ const empty = config.generationJobs.length === 0;
const { container, unmount } = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined }));
- expect(screen.getByRole("complementary", { name: "Scenes" })).not.toBeNull();
+ /* The rail on the left is gone. Every scene is a row of shot cards in the
+ middle instead, and the panel on the right is the ONE place anything is
+ edited — so with nothing to edit there is no panel at all. */
+ expect(screen.queryByRole("complementary", { name: "Scenes" })).toBeNull();
+ expect(container.querySelector(".queue-panel")).toBeNull();
+ expect(Boolean(container.querySelector(".scene-board"))).toBe(!empty);
+ expect(Boolean(container.querySelector(".generator-panel"))).toBe(!empty);
expect(container.querySelector(".generator-heading .eyebrow")).toBeNull();
expect(screen.queryByRole("button", { name: "View timeline" })).toBeNull();
- /* The composer panel is gone. A new scene is started from the + in the
- rail, which adds an EMPTY one — nothing on this page turns a sentence
- into a scene any more, so nothing may advertise that it does. */
+ /* The composer panel is gone. A new scene is added EMPTY — nothing on this
+ page turns a sentence into a scene any more, so nothing may advertise
+ that it does. */
expect(screen.queryByRole("heading", { name: "Start another scene" })).toBeNull();
expect(container.querySelector(".generation-composer")).toBeNull();
expect(screen.getByRole("button", { name: "Add a scene" })).not.toBeNull();
@@ -1059,6 +1087,60 @@ describe("project workspace timecode", () => {
}
});
+ it("shows every shot as a card, in the order they play, under its own scene line", () => {
+ const fresh = lampProject();
+ const config = parseProjectConfig({
+ ...fresh,
+ generationJobs: [
+ { ...fresh.generationJobs[0], title: "Second scene", id: "job-second", durationSeconds: 8, shots: [{ id: "b1", startSeconds: 0, action: "the door opens" }] },
+ { ...fresh.generationJobs[0], durationSeconds: 9, shots: [
+ { id: "a1", startSeconds: 0, action: "she walks towards the camera" },
+ { id: "a2", startSeconds: 4.5, action: "she stops at the doorway" },
+ ] },
+ ],
+ });
+ const { container } = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined }));
+
+ // One section per scene, each with its own line, and the cards inside it in
+ // playing order.
+ const sections = [...container.querySelectorAll(".scene-section")];
+ expect(sections).toHaveLength(2);
+ expect(sections.map((section) => section.getAttribute("aria-label"))).toEqual(["Second scene", "First scene"]);
+ const cards = [...sections[1].querySelectorAll(".shot-card:not(.shot-card--add)")];
+ expect(cards.map((card) => card.getAttribute("aria-label"))).toEqual(["Shot 1 of First scene", "Shot 2 of First scene"]);
+ // The card carries the words and the span it covers — it IS the summary.
+ expect(cards[0].textContent).toContain("she walks towards the camera");
+ expect(cards[0].textContent).toContain("0.0s – 4.5s");
+ expect(cards[1].textContent).toContain("4.5s – 9.0s");
+ // Nothing has been rendered, so no card invents a picture.
+ expect(container.querySelector(".shot-thumb--poster")).toBeNull();
+ expect(screen.getAllByRole("img", { name: "Shot 1 — Not rendered yet" }).length).toBe(2);
+ });
+
+ it("opens a shot in the panel when its card is chosen, and the scene from the scene line", () => {
+ const config = lampProject();
+ render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+
+ // It opens on the scene: the thing with a state, a prompt and a Generate
+ // button.
+ expect(screen.getByRole("textbox", { name: "Rename First scene" })).not.toBeNull();
+ expect(screen.queryByRole("textbox", { name: "What happens in shot 1" })).toBeNull();
+
+ openShot(1);
+ expect(screen.getByRole("textbox", { name: "What happens in shot 1" })).not.toBeNull();
+ // One thing at a time: the scene's own controls are not also on screen.
+ expect(screen.queryByRole("slider", { name: "Scene length in seconds" })).toBeNull();
+ expect(screen.queryByRole("textbox", { name: "Rename First scene" })).toBeNull();
+
+ // And the way back up is named, so a shot is never a dead end.
+ fireEvent.click(screen.getByRole("button", { name: "First scene · Scene settings" }));
+ expect(screen.getByRole("slider", { name: "Scene length in seconds" })).not.toBeNull();
+
+ openShot(1);
+ openScene();
+ expect(screen.getByRole("textbox", { name: "Rename First scene" })).not.toBeNull();
+ });
+
it("adds an EMPTY scene from the + button — one blank shot, no words this app wrote", () => {
const config = lampProject();
const onChange = vi.fn();
@@ -1092,14 +1174,15 @@ describe("project workspace timecode", () => {
const { rerender } = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
// Two more shots, and the scene stretched to hold them.
- fireEvent.click(screen.getByRole("button", { name: "Add a shot" }));
+ fireEvent.click(screen.getByRole("button", { name: "Add a shot to First scene" }));
let next = onChange.mock.calls.at(-1)![0];
expect(next.generationJobs[0].shots).toHaveLength(2);
rerender(createElement(GeneratorView, { config: parseProjectConfig(next), folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
- fireEvent.click(screen.getByRole("button", { name: "Add a shot" }));
+ fireEvent.click(screen.getByRole("button", { name: "Add a shot to First scene" }));
next = onChange.mock.calls.at(-1)![0];
rerender(createElement(GeneratorView, { config: parseProjectConfig(next), folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ openScene();
fireEvent.change(screen.getByRole("slider", { name: "Scene length in seconds" }), { target: { value: "9" } });
next = onChange.mock.calls.at(-1)![0];
expect(next.generationJobs[0].durationSeconds).toBe(9);
@@ -1107,6 +1190,7 @@ describe("project workspace timecode", () => {
// Each cut is set on the bar, and the second and third lines are written.
for (const [shotNumber, startSeconds, line] of [[2, 3, "she stops at the doorway"], [3, 6.5, "the door opens"]] as const) {
+ openShot(shotNumber);
fireEvent.change(screen.getByRole("spinbutton", { name: `Shot ${shotNumber} starts at, in seconds` }), { target: { value: String(startSeconds) } });
next = onChange.mock.calls.at(-1)![0];
rerender(createElement(GeneratorView, { config: parseProjectConfig(next), folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
@@ -1115,6 +1199,7 @@ describe("project workspace timecode", () => {
rerender(createElement(GeneratorView, { config: parseProjectConfig(next), folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
}
+ openScene();
const compiled = document.querySelector(".compiled-prompt__text")!.textContent!;
expect(compiled).toContain("[Shot 1] Live-action, cinematic, A quiet product film.");
expect(compiled).toContain("[Shot 2] (cut at 3s) she stops at the doorway.");
@@ -1129,6 +1214,7 @@ describe("project workspace timecode", () => {
const onChange = vi.fn();
const app = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
const length = () => screen.getByRole("slider", { name: "Scene length in seconds" }) as HTMLInputElement;
+ // The length belongs to the scene, so it is on the scene's own panel.
expect(length().min).toBe("0");
expect(length().max).toBe("15");
// The bound is enforced, not merely advertised: a hand-set value past the
@@ -1149,6 +1235,7 @@ describe("project workspace timecode", () => {
const config = lampProject();
const onChange = vi.fn();
const { rerender } = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ openShot(1);
addSetting(1, "cameraMovement", "push-in");
let next = onChange.mock.calls.at(-1)![0];
expect(next.generationJobs[0].shots[0].settings).toEqual({ cameraMovement: ["push-in"] });
@@ -1163,11 +1250,13 @@ describe("project workspace timecode", () => {
// The compiled prompt shows it immediately, with the term marked as the
// user's choice rather than as their own prose.
+ openScene();
const prompt = document.querySelector(".compiled-prompt__text")!;
expect(prompt.textContent).toContain("Camera movement: push in, slow speed.");
expect([...document.querySelectorAll(".prompt-part--tag")].map((part) => part.textContent)).toContain("push in, slow speed");
expect(document.querySelector(".prompt-part--brief")!.textContent).not.toContain("push in");
+ openShot(1);
fireEvent.click(screen.getByRole("button", { name: "Remove Camera movement: Push in from shot 1" }));
expect(onChange.mock.calls.at(-1)![0].generationJobs[0].shots[0].settings).toEqual({ cameraSpeed: ["slow"] });
});
@@ -1175,14 +1264,17 @@ describe("project workspace timecode", () => {
it("refuses movement speed until there is a movement for it to qualify", () => {
const config = lampProject();
render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ openShot(1);
// Not merely disabled — it says why, the way every other blocked control on
// this screen does.
const menu = screen.getByRole("combobox", { name: "Add a setting to shot 1" });
const speed = within(menu).getByRole("option", { name: /^Movement speed/ }) as HTMLOptionElement;
expect(speed.disabled).toBe(true);
expect(speed.textContent).toContain("needs a camera movement first");
- // The look belongs to the whole scene, so it is not offered per shot.
+ // The look belongs to the whole scene, so it is not offered per shot — it is
+ // on the scene's own panel instead.
expect(within(menu).queryByRole("option", { name: "Look" })).toBeNull();
+ openScene();
expect(screen.getByRole("combobox", { name: "The look of this scene" })).not.toBeNull();
});
@@ -1195,15 +1287,21 @@ describe("project workspace timecode", () => {
render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
// One shot, holding the words and the tags the file already had.
+ openShot(1);
expect((screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement).value).toBe("A quiet product film");
- expect(screen.getByText("macro lens")).not.toBeNull();
+ // The legacy per-job tag now reads as a setting ON the shot.
+ expect(screen.getByRole("button", { name: "Remove Lens: Macro from shot 1" })).not.toBeNull();
expect(screen.queryByRole("textbox", { name: "What happens in shot 2" })).toBeNull();
+ // Only one card, because a legacy scene is read as a single-shot scene.
+ expect(screen.queryByRole("button", { name: "Shot 2 of First scene" })).toBeNull();
+ openScene();
expect(document.querySelector(".compiled-prompt__text")!.textContent).toContain("macro lens, A quiet product film");
// Its length is the one it was always generated at, said out loud.
expect(screen.getByText("6.0 seconds, one shot")).not.toBeNull();
// The first edit moves the tags onto the shot, and clears the legacy copy
// so the two can never disagree.
+ openShot(1);
addSetting(1, "lighting", "soft-light");
const next = onChange.mock.calls.at(-1)![0].generationJobs[0];
expect(next.shots[0].settings).toEqual({ lens: ["macro-lens"], lighting: ["soft-light"] });
@@ -1215,9 +1313,10 @@ describe("project workspace timecode", () => {
const fresh = lampProject();
const config = parseProjectConfig({ ...fresh, generationJobs: [{ ...fresh.generationJobs[0], status: "generating", stage: "generating", progress: 0.4 }] });
render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ expect((screen.getByRole("slider", { name: "Scene length in seconds" }) as HTMLInputElement).disabled).toBe(true);
+ openShot(1);
expect((screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement).disabled).toBe(true);
expect((screen.getByRole("combobox", { name: "Add a setting to shot 1" }) as HTMLSelectElement).disabled).toBe(true);
- expect((screen.getByRole("slider", { name: "Scene length in seconds" }) as HTMLInputElement).disabled).toBe(true);
expect(screen.getByText(/It can be changed once it finishes/)).not.toBeNull();
});
@@ -1232,6 +1331,7 @@ describe("project workspace timecode", () => {
const onChange = vi.fn();
const render1 = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
const show = (next: ProjectConfig) => render1.rerender(createElement(GeneratorView, { config: parseProjectConfig(next), folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ openShot(1);
// Dragged out of the palette and dropped onto the line.
const drop = (referenceId: string) => {
@@ -1260,6 +1360,7 @@ describe("project workspace timecode", () => {
expect((screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement).value)
.toBe("[Reference 1] walks towards the camera on [Reference 2]");
expect(next.generationJobs[0].shots[0].action).toBe("@[ref:ref-woman] walks towards the camera on @[ref:ref-street]");
+ openScene();
const compiled = () => document.querySelector(".compiled-prompt__text")!.textContent!;
expect(compiled()).toContain("<Subject 1> walks towards the camera on <Subject 2>");
expect(compiled()).not.toContain("@[ref:");
@@ -1268,6 +1369,7 @@ describe("project workspace timecode", () => {
expect(document.querySelector(".prompt-part--brief")!.textContent).not.toContain("<Subject");
// Clicking the first reference in the line offers every other one.
+ openShot(1);
const token = screen.getByRole("combobox", { name: "Reference 1 · Red-haired woman — choose another reference" });
expect([...token.querySelectorAll("option")].map((option) => option.textContent)).toEqual([
"Reference 1 · Red-haired woman", "Reference 2 · City street", "Take it out of the line",
@@ -1276,6 +1378,7 @@ describe("project workspace timecode", () => {
next = onChange.mock.calls.at(-1)![0];
show(next);
expect(next.generationJobs[0].shots[0].action).toBe("@[ref:ref-street] walks towards the camera on @[ref:ref-street]");
+ openScene();
expect(compiled()).toContain("<Subject 2> walks towards the camera on <Subject 2>");
});
@@ -1301,6 +1404,7 @@ describe("project workspace timecode", () => {
const onChange = vi.fn((next: ProjectConfig) => { config = parseProjectConfig(next); });
const view = () => createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: start.generationJobs[0].id });
const app = render(view());
+ openShot(1);
const field = screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement;
field.setSelectionRange(caret, caret);
const event = createEvent.drop(field);
@@ -1344,6 +1448,11 @@ describe("project workspace timecode", () => {
show();
};
const press = (name: string) => { fireEvent.click(screen.getByRole("button", { name })); show(); };
+ /* Every control below belongs to one shot or to the scene, and the panel
+ shows one of those at a time — so the test opens what it is about to set,
+ exactly as the user would. */
+ const shot = (shotNumber: number) => { openShot(shotNumber, "First scene"); show(); };
+ const scene = () => { openScene("First scene"); show(); };
const dropReference = (referenceId: string, shotNumber: number) => {
const field = screen.getByRole("textbox", { name: `What happens in shot ${shotNumber}` });
const event = createEvent.drop(field);
@@ -1353,38 +1462,46 @@ describe("project workspace timecode", () => {
};
set("slider", "Scene length in seconds", "12");
- press("Add a shot");
- press("Add a shot");
+ press("Add a shot to First scene");
+ press("Add a shot to First scene");
// The street is dropped FIRST and the woman second, but the numbering
// follows the project's reference order once both are bound — which is the
// order reference_paths is built in, so <Subject 1> is <Picture 1>.
+ shot(1);
dropReference("ref-street", 1);
dropReference("ref-woman", 1);
set("textbox", "What happens in shot 1", "[Reference 1] walks towards the camera on [Reference 2]");
+ shot(2);
set("spinbutton", "Shot 2 starts at, in seconds", "4.5");
set("textbox", "What happens in shot 2", "she stops at a doorway and looks up");
+ shot(3);
set("spinbutton", "Shot 3 starts at, in seconds", "9");
set("textbox", "What happens in shot 3", "the door opens and light spills across [Reference 2]");
+ shot(1);
set("combobox", "Add a setting to shot 1", "cameraMovement");
set("combobox", "Value for Camera movement on shot 1", "push-in");
set("combobox", "Add a setting to shot 1", "cameraSpeed");
set("combobox", "Value for Movement speed on shot 1", "slow");
+ shot(2);
set("combobox", "Add a setting to shot 2", "shotSize");
set("combobox", "Value for Shot size on shot 2", "medium-close-up");
+ scene();
set("combobox", "The look of this scene", "live-action-cinematic");
set("textbox", "The sound of this scene", "Rain on cobbles, distant traffic, her boots on stone.");
set("textbox", "The music of this scene", "Low sustained cello, slow tempo, swelling in the last two seconds.");
// What the field shows is "Reference N"; what is stored is the id, so a
// rename or a reorder cannot re-point the sentence.
+ shot(1);
expect((screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement).value)
.toBe("[Reference 1] walks towards the camera on [Reference 2]");
expect(config.generationJobs[0].shots![0].action).toBe("@[ref:ref-woman] walks towards the camera on @[ref:ref-street]");
expect(config.generationJobs[0].durationSeconds).toBe(12);
- expect(config.generationJobs[0].shots!.map((shot) => shot.startSeconds)).toEqual([0, 4.5, 9]);
+ expect(config.generationJobs[0].shots!.map((item) => item.startSeconds)).toEqual([0, 4.5, 9]);
+ scene();
const compiled = document.querySelector(".compiled-prompt__text")!.textContent!;
// The panel IS the string that is sent — the parts concatenate to it.
expect([...document.querySelectorAll(".compiled-prompt__text .prompt-part")].map((part) => part.textContent).join("")).toBe(compiled);
@@ -1432,20 +1549,25 @@ describe("project workspace timecode", () => {
expect(parseProjectConfig(config)).toBeTruthy();
// And the swap: the same sentence, pointed at the other reference.
+ shot(1);
const token = document.querySelector(".shot-readback__token") as HTMLSelectElement;
expect([...token.options].map((option) => option.textContent))
.toEqual(["Reference 1 · Red-haired woman", "Reference 2 · City street", "Take it out of the line"]);
fireEvent.change(token, { target: { value: "ref-street" } });
show();
+ scene();
expect(document.querySelector(".compiled-prompt__text")!.textContent)
.toContain("[Shot 1] <Subject 2> walks towards the camera on <Subject 2>.");
});
- it("labels a cancelled preview as cancelled instead of queued", () => {
+ it("labels a cancelled scene as cancelled instead of queued, on the card and on its line", () => {
const fresh = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
const config = parseProjectConfig({ ...fresh, generationJobs: [{ ...fresh.generationJobs[0], status: "cancelled", stage: "failed" }] });
render(createElement(GeneratorView, { config, folderPath: "C:\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined }));
- expect(screen.getByText("Generation cancelled")).not.toBeNull();
+ // The card's picture is the placeholder that says why there is no picture.
+ expect(screen.getByRole("img", { name: "Shot 1 — Cancelled" })).not.toBeNull();
+ expect(screen.getByText("CANCELLED")).not.toBeNull();
+ expect(screen.getByText("Generation stopped")).not.toBeNull();
expect(screen.queryByText("Waiting in queue")).toBeNull();
});
});
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index b0d4558..5385275 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -1,12 +1,12 @@
-import { listen } from "@tauri-apps/api/event";
-import { AlertCircle, Ban, Check, ChevronRight, Clock3, FileText, Image as ImageIcon, LoaderCircle, Music2, Play, Plus, RefreshCw, Sparkles, Square, Video, WandSparkles, X } from "lucide-react";
+import { Ban, Check, FileText, Image as ImageIcon, LoaderCircle, Music2, Play, Plus, RefreshCw, Sparkles, Square, Video, WandSparkles, X } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import { resolutionLabel } from "../../lib/export";
-import { isTauri } from "../../lib/persistence";
-import { actionReferenceIds, compileGenerationJobPrompt, compileGenerationJobSegments, createDraftGenerationJob, danglingReferenceTokens, sceneDurationSeconds, sceneShots, STORY_TRACK_ID, isReferenceDescribed, isReferenceUsable, isVisualReference, projectItemPath, usableImageReferences, type GenerationJob, type ProjectAsset, type ProjectConfig, type ProjectReference, type PromptSegment, type TimelineClip, type TimelineTrack } from "../../lib/project";
+import { actionReferenceIds, compileGenerationJobPrompt, compileGenerationJobSegments, createDraftGenerationJob, danglingReferenceTokens, sceneDurationSeconds, sceneShots, SCENE_MAX_SECONDS, SCENE_MIN_SECONDS, STORY_TRACK_ID, isReferenceDescribed, isReferenceUsable, isVisualReference, projectItemPath, usableImageReferences, type GenerationJob, type ProjectAsset, type ProjectConfig, type ProjectReference, type PromptSegment, type SceneShot, type TimelineClip, type TimelineTrack } from "../../lib/project";
import { cancelVidfabGeneration, enqueueVidfabGeneration, resolveVidfabPlan, type VidfabGenerationRequest, type VidfabStatus } from "../../lib/runtime";
import { ReferenceImage } from "./ReferenceImage";
-import { SceneEditor } from "./SceneEditor";
+import { SceneBoard, type GeneratorSelection } from "./SceneBoard";
+import { SceneInspector, ShotInspector, STEP_SECONDS, writeShots } from "./SceneEditor";
+import { progressTitle, stageCopy, statusIcon, STATUS_WORD } from "./sceneStatus";
interface GeneratorViewProps {
config: ProjectConfig;
@@ -17,23 +17,39 @@ interface GeneratorViewProps {
selectedJobId?: string;
}
-type JobStatus = GenerationJob["status"];
-
+/* The Generator is a BOARD and a PANEL.
+ *
+ * The board is every scene in the project, each one a row of shot cards reading
+ * left to right in the order they play, separated by the line that carries the
+ * scene's own name, state and settings. A card is the summary of a shot: its
+ * picture once the scene has been rendered, the line written for it, and the
+ * settings hung off it.
+ *
+ * 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, onChange, onOpenTimeline, selectedJobId }: GeneratorViewProps) {
- const [selectedId, setSelectedId] = useState(selectedJobId ?? config.generationJobs.find((job) => job.status === "generating")?.id ?? config.generationJobs[0]?.id);
- const [planNotes, setPlanNotes] = useState<Record<string, string>>({});
+ const jobs = config.generationJobs;
const configRef = useRef(config);
configRef.current = config;
- const jobs = config.generationJobs;
- const selected = jobs.find((job) => job.id === selectedId);
- /* "ready" means the pictures exist and the file does not yet — the app is
- encoding them. That is work in progress, so it belongs beside the render it
- came out of rather than under "Already run", where it would sit looking
- finished with nothing to open. */
+
+ /* A scene is always what is named; the shot inside it is what a card opens.
+ Opening the Generator, or arriving from a clip in the timeline, opens the
+ SCENE — the thing that has a state, a prompt and a Generate button. */
+ const [selection, setSelection] = useState<GeneratorSelection>(() => ({ jobId: selectedJobId ?? jobs.find((job) => job.status === "generating")?.id ?? jobs[0]?.id ?? "", shotId: null }));
+ const [planNotes, setPlanNotes] = useState<Record<string, string>>({});
+
+ useEffect(() => { if (selectedJobId) setSelection({ jobId: selectedJobId, shotId: null }); }, [selectedJobId]);
+
+ /* 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. */
+ const selected = jobs.find((job) => job.id === selection.jobId) ?? jobs[0];
+ const selectedShots = useMemo(() => (selected ? sceneShots(selected) : []), [selected]);
+ const shotIndex = selectedShots.findIndex((shot) => shot.id === selection.shotId);
+ const openShot = shotIndex >= 0 ? selectedShots[shotIndex] : null;
+
const active = jobs.filter((job) => job.status === "generating" || job.status === "ready");
const queued = jobs.filter((job) => job.status === "queued");
- const drafts = jobs.filter((job) => job.status === "draft");
- const completed = jobs.filter((job) => ["completed", "failed", "cancelled"].includes(job.status));
// Queued and generating scenes have already been handed to the engine with
// their references attached; re-binding now would change nothing about that
// run while claiming otherwise.
@@ -49,19 +65,17 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
user can see and fix; the button says the reason rather than sitting grey. */
const blocked = selected ? sendBlocker(selected, config.references) : null;
- useEffect(() => { if (selectedJobId) setSelectedId(selectedJobId); }, [selectedJobId]);
-
const updateJob = (id: string, updates: Partial<GenerationJob>) => {
const current = configRef.current;
onChange({ ...current, generationJobs: current.generationJobs.map((job) => job.id === id ? { ...job, ...updates } : job) });
};
- /* An edit from the scene editor. Writing a reference into a line BINDS it to
- the scene, because binding is what gives it a <Subject N> and puts its
- picture in `reference_paths` — a citation the engine was never sent the
- reference for would point at nothing. Nothing is ever auto-unbound: taking
- a name out of one line is not a decision to stop steering the scene with it,
- and the checkbox list below is where that decision is made. */
+ /* An edit from the panel. Writing a reference into a line BINDS it to the
+ scene, because binding is what gives it a <Subject N> and puts its picture
+ in `reference_paths` — a citation the engine was never sent the reference
+ for would point at nothing. Nothing is ever auto-unbound: taking a name out
+ of one line is not a decision to stop steering the scene with it, and the
+ checkbox list in the scene panel is where that decision is made. */
const updateScene = (job: GenerationJob, updates: Partial<GenerationJob>) => {
const next: Partial<GenerationJob> = { ...updates, updatedAt: new Date().toISOString() };
if (updates.shots) {
@@ -76,6 +90,44 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
updateJob(job.id, next);
};
+ /* --- The shots of a scene ------------------------------------------------
+ Every one of these goes through writeShots, so the mirrored `prompt` and
+ `creativeBrief` can never fall behind the lines they mirror. */
+
+ const setShots = (job: GenerationJob, next: SceneShot[], extra: Partial<GenerationJob> = {}) =>
+ updateScene(job, writeShots(job, next, extra));
+
+ const patchShot = (job: GenerationJob, shotId: string, updates: Partial<SceneShot>) =>
+ setShots(job, sceneShots(job).map((shot) => shot.id === shotId ? { ...shot, ...updates } : shot));
+
+ const addShot = (job: GenerationJob) => {
+ const shots = sceneShots(job);
+ const duration = sceneDurationSeconds(job);
+ const last = shots[shots.length - 1];
+ const halfway = Math.round(((last.startSeconds + duration) / 2) / STEP_SECONDS) * STEP_SECONDS;
+ const start = Math.min(duration, Math.max(last.startSeconds + STEP_SECONDS, halfway));
+ const shot: SceneShot = { id: `shot-${crypto.randomUUID()}`, startSeconds: start, action: "" };
+ setShots(job, [...shots, shot]);
+ // The new card is blank, so open it: there is nowhere else to write it.
+ setSelection({ jobId: job.id, shotId: shot.id });
+ };
+
+ const removeShot = (job: GenerationJob, shotId: string) => {
+ const shots = sceneShots(job);
+ // A scene is at least one shot: with none there is nowhere to write, and
+ // the compiler would have nothing to make a [Shot 1] out of.
+ if (shots.length <= 1) return;
+ setShots(job, shots.filter((shot) => shot.id !== shotId));
+ setSelection({ jobId: job.id, shotId: null });
+ };
+
+ const setDuration = (job: GenerationJob, value: number) => {
+ const next = Math.min(SCENE_MAX_SECONDS, Math.max(SCENE_MIN_SECONDS, Math.round(value / STEP_SECONDS) * STEP_SECONDS));
+ // A shot cannot start after the scene ends, so shortening the scene pulls
+ // the later cuts back with it rather than leaving them past the end.
+ setShots(job, sceneShots(job).map((shot) => ({ ...shot, startSeconds: Math.min(shot.startSeconds, next) })), { durationSeconds: next });
+ };
+
const requestFor = (job: GenerationJob): VidfabGenerationRequest => {
// Only the references actually bound to this scene, in list order. The same
// ordered list drives the <Subject N> / <Picture N> numbering inside the
@@ -114,9 +166,9 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
/* A scene now starts EMPTY. There is no box that turns a sentence into a
scene any more: the + button adds a scene holding one blank shot, and the
- shots are written in the editor above. PolStudio still writes no line for
- anyone, so the scene arrives with no words and carries UNTITLED_SCENE as
- its name rather than a phrase this app made up.
+ shots are written in the panel beside the board. PolStudio still writes no
+ line for anyone, so the scene arrives with no words and carries
+ UNTITLED_SCENE as its name rather than a phrase this app made up.
A scene built FROM a prompt is Pol’s job: the bar along the bottom of the
window hands the request to Claude Code or Codex, which returns the whole
@@ -126,7 +178,7 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
const newScene = () => {
const job = createDraftGenerationJob("");
onChange({ ...config, generationJobs: [job, ...jobs] });
- setSelectedId(job.id);
+ setSelection({ jobId: job.id, shotId: null });
};
const startDraft = async (job: GenerationJob) => {
@@ -184,177 +236,219 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
updateJob(job.id, { status: "cancelled", stage: "failed", updatedAt: new Date().toISOString() });
};
- return <div className="generator-view">
- <aside className="queue-panel" aria-label="Scenes">
- <div className="queue-panel__title">
- <div>
- <span>Scenes</span>
- <b>{queueSummary(active.length, queued.length, jobs.length)}</b>
- </div>
- {/* Adds the scene and leaves it empty. PolStudio still writes no words
- for anyone — it gives the user somewhere to write them, and the
- scene keeps the name UNTITLED_SCENE until they rename it. */}
- <button className="queue-panel__new" onClick={newScene} aria-label="Add a scene" title="Add an empty scene — you write the shots"><Plus size={18} /></button>
- </div>
- <div className="queue-panel__scroll">
- <QueueGroup title="Rendering now" jobs={active} selectedId={selectedId} onSelect={setSelectedId} />
- <QueueGroup title="Waiting to render" jobs={queued} selectedId={selectedId} onSelect={setSelectedId} />
- <QueueGroup title="Drafts" jobs={drafts} selectedId={selectedId} onSelect={setSelectedId} />
- <QueueGroup title="Already run" jobs={completed} selectedId={selectedId} onSelect={setSelectedId} />
- {jobs.length === 0 && <p className="queue-empty">No scenes yet. Choose + to add an empty one, or ask Pol in the bar along the bottom to build one from a prompt.</p>}
- </div>
- {/* One line: the headline already IS the status. */}
- <div className={`queue-runtime queue-runtime--${runtime?.state ?? "checking"}`}>
- <span className="queue-runtime__state"><i /> {runtimeHeadline(runtime)}</span>
- </div>
- </aside>
-
+ return <div className={`generator-view ${selected ? "" : "generator-view--empty"}`}>
<main className="generator-main">
<header className="generator-heading">
- <h1>Generator</h1>
+ <div className="generator-heading__title">
+ <h1>Generator</h1>
+ <p>{boardSummary(active.length, queued.length, jobs.length)}</p>
+ </div>
+ <div className="generator-heading__actions">
+ {/* One line: the headline already IS the status. */}
+ <span className={`generator-runtime generator-runtime--${runtime?.state ?? "checking"}`}>
+ <i aria-hidden="true" /> {runtimeHeadline(runtime)}
+ </span>
+ {/* Adds the scene and leaves it empty. PolStudio still writes no words
+ for anyone — it gives the user somewhere to write them, and the
+ scene keeps the name UNTITLED_SCENE until they rename it. */}
+ <button className="secondary-button" onClick={newScene} title="Add an empty scene — you write the shots">
+ <Plus size={16} aria-hidden="true" /> Add a scene
+ </button>
+ </div>
</header>
- {selected && <section className="job-detail">
- <div className="job-detail__visual">
- {/* THE control on this screen: the lines the user writes, the shots
- they are split into, and the settings hung off each one. */}
- <SceneEditor
- key={selected.id}
- job={selected}
- references={config.references}
- disabled={refsLocked}
- onChange={(updates) => updateScene(selected, updates)}
- />
- {refsLocked && <p className="job-refs__empty">This scene is already with the engine. It can be changed once it finishes, and the next run will use the changes.</p>}
-
- {/* Every setting on this scene collapsed into the one string vidfab is
- given. Recompiled from what the scene holds right now, so it cannot
- disagree with what the next run sends. */}
- <CompiledPrompt
- segments={compileGenerationJobSegments(selected, boundRefs)}
- caption={refsLocked
- ? "This is the prompt the engine was given for the run in progress."
- : "Rebuilt from this scene’s shots, settings and references every time it is sent."}
- />
-
- <div className="job-progress-block">
- <div className="job-progress-block__head">
- <b>{progressTitle(selected)}</b>
- <span>{stageCopy(selected)}</span>
- </div>
- <div className="progress-track"><i style={{ width: `${selected.progress * 100}%` }} /></div>
- <ol className="stage-rail">
- {STAGES.map((stage, index) => {
- const done = selected.progress > 0 && selected.progress >= stage.at;
- return <li key={stage.label} className={done ? "done" : ""}>
- <i>{done ? <Check size={14} /> : index + 1}</i>
- <span>{stage.label}</span>
- </li>;
- })}
- <li className="stage-rail__blocked">
- <i><Ban size={14} /></i>
- <span>Save as a video file<small>Not built yet</small></span>
- </li>
- </ol>
- </div>
- </div>
+ {jobs.length > 0 && <SceneBoard
+ jobs={jobs}
+ folderPath={folderPath}
+ references={config.references}
+ selection={{ jobId: selected?.id ?? "", shotId: openShot?.id ?? null }}
+ onSelect={setSelection}
+ onAddShot={addShot}
+ />}
+
+ {/* No scenes at all — which, on a new project, is where everyone starts.
+ This is the whole of the "how do I start" advice now that the composer
+ is gone, so it has to name both doors: the button below, and Pol. */}
+ {jobs.length === 0 && <div className="job-empty">
+ <span className="job-empty__icon"><Sparkles size={26} /></span>
+ <h2>Start with one scene</h2>
+ <p>An empty scene is one blank shot waiting for a line. Add one, then write what should happen on screen — who or what is in frame, what they do.</p>
+ <ul className="job-empty__tips">
+ <li>A scene can be up to 15 seconds and split into as many shots as you like.</li>
+ <li>Each shot is a card. Choose one to write its line and set it up.</li>
+ <li>Drag a reference into a line and the prompt cites it as a subject.</li>
+ <li>You can read the finished prompt before anything is sent.</li>
+ <li>Or ask Pol in the bar along the bottom — Claude Code and Codex can write a whole scene from a prompt.</li>
+ </ul>
+ <button className="primary-button job-empty__add" onClick={newScene}><Plus size={16} /> Add an empty scene</button>
+ </div>}
+ </main>
- <aside className="job-detail__info">
- <div className="job-title">
- <span className={`status-icon status-icon--${selected.status}`}>{statusIcon(selected.status)}</span>
- <div>
- <span className="job-title__badge">{STATUS_BADGE[selected.status]}</span>
- {/* The title is the one part of a scene PolStudio writes for the
- user — taken from their first words — so it has to be theirs
- to change. Blanking it falls back rather than saving a
- nameless scene the schema would reject. */}
- <h2><input
- className="job-title__name"
- value={selected.title}
- aria-label={`Rename ${selected.title}`}
- title="Rename this scene"
- onChange={(event) => updateJob(selected.id, { title: event.target.value || "Untitled scene", updatedAt: new Date().toISOString() })}
- /></h2>
- </div>
+ {selected && <aside className="generator-panel" aria-label={openShot ? `Shot ${shotIndex + 1} of ${selected.title}` : `Scene: ${selected.title}`}>
+ {openShot
+ ? <>
+ <header className="panel-head">
+ {/* The way back up: the scene this shot belongs to, which is the
+ same thing its line on the board opens. */}
+ <button type="button" className="panel-head__up" onClick={() => setSelection({ jobId: selected.id, shotId: null })}>
+ {selected.title} · Scene settings
+ </button>
+ <h2>Shot {shotIndex + 1}<small>of {selectedShots.length === 1 ? "one shot" : `${selectedShots.length} shots`}</small></h2>
+ </header>
+ <div className="panel-scroll">
+ <ShotInspector
+ key={openShot.id}
+ job={selected}
+ shots={selectedShots}
+ shot={openShot}
+ index={shotIndex}
+ endsAt={shotIndex + 1 < selectedShots.length ? selectedShots[shotIndex + 1].startSeconds : sceneDurationSeconds(selected)}
+ duration={sceneDurationSeconds(selected)}
+ references={config.references}
+ disabled={refsLocked}
+ removable={selectedShots.length > 1}
+ onChange={(updates) => patchShot(selected, openShot.id, updates)}
+ onRemove={() => removeShot(selected, openShot.id)}
+ />
+ {refsLocked && <p className="job-refs__empty">This scene is already with the engine. It can be changed once it finishes, and the next run will use the changes.</p>}
</div>
+ </>
+ : <>
+ <header className="panel-head">
+ <div className="job-title">
+ <span className={`status-icon status-icon--${selected.status}`}>{statusIcon(selected.status)}</span>
+ <div>
+ {/* The badge is on the scene's own line on the board, where the
+ eye compares one scene against the next. A second copy of it
+ an inch away from the first says nothing new. */}
+ {/* The title is the one part of a scene PolStudio writes for the
+ user — taken from their first words — so it has to be theirs
+ to change. Blanking it falls back rather than saving a
+ nameless scene the schema would reject. */}
+ <h2><input
+ className="job-title__name"
+ value={selected.title}
+ aria-label={`Rename ${selected.title}`}
+ title="Rename this scene"
+ onChange={(event) => updateJob(selected.id, { title: event.target.value || "Untitled scene", updatedAt: new Date().toISOString() })}
+ /></h2>
+ </div>
+ </div>
+ </header>
+
+ <div className="panel-scroll">
+ <div className="job-progress-block">
+ <div className="job-progress-block__head">
+ <b>{progressTitle(selected)}</b>
+ <span>{stageCopy(selected)}</span>
+ </div>
+ <div className="progress-track"><i style={{ width: `${selected.progress * 100}%` }} /></div>
+ <ol className="stage-rail">
+ {STAGES.map((stage, index) => {
+ const done = selected.progress > 0 && selected.progress >= stage.at;
+ return <li key={stage.label} className={done ? "done" : ""}>
+ <i>{done ? <Check size={14} /> : index + 1}</i>
+ <span>{stage.label}</span>
+ </li>;
+ })}
+ <li className="stage-rail__blocked">
+ <i><Ban size={14} /></i>
+ <span>Save as a video file<small>Not built yet</small></span>
+ </li>
+ </ol>
+ </div>
- {/* A labelled placeholder, never invented art — the same rule the
- scene thumb, media thumb and reference cards follow. PolStudio
- cannot display real frames yet, so it shows none. */}
- <div className={`generation-preview generation-preview--${selected.status}`}>
- {selected.status === "generating" && <span className="generation-scanner" aria-hidden="true" />}
- <span className="preview-status">{previewStatus(selected)}</span>
- <p className="generation-preview__caption">{previewCaption(selected)}</p>
- </div>
+ {(planNotes[selected.id] || selected.error) && <div className="job-runtime-note">
+ <span>What actually happened</span>
+ <p>{planNotes[selected.id] ?? selected.error}</p>
+ <small>Reported by the video engine (vidfab).</small>
+ </div>}
+
+ {/* How long the scene runs, where its cuts fall, and the three
+ things the H3 guide defines once per prompt. */}
+ <SceneInspector
+ key={selected.id}
+ job={selected}
+ shots={selectedShots}
+ disabled={refsLocked}
+ onChange={(updates) => updateScene(selected, updates)}
+ onShots={(next) => setShots(selected, next)}
+ onDuration={(value) => setDuration(selected, value)}
+ onSelectShot={(shotId) => setSelection({ jobId: selected.id, shotId })}
+ />
+
+ {refsLocked && <p className="job-refs__empty">This scene is already with the engine. It can be changed once it finishes, and the next run will use the changes.</p>}
+
+ <div className="job-refs">
+ <span>{promptRefs.length === 0 ? "No references used by this scene" : promptRefs.length === 1 ? "1 reference guides this scene" : `${promptRefs.length} references guide this scene`}</span>
+ {/* Every reference in the project, each a checkbox: which ones steer
+ a scene is the user's decision. Writing one into a line ticks it
+ here; unticking it takes it out of the prompt and out of what is
+ sent to the engine. A bound reference the prompt skips stays
+ listed with its reason — hiding it would leave the user
+ wondering where it went. */}
+ {config.references.map((ref) => {
+ const bound = selected.referenceIds.includes(ref.id);
+ const picture = ref.kind === "image" && (ref.relativePath || ref.sourcePath);
+ const skipped = skipReason(ref);
+ return <label key={ref.id} className={`job-ref ${bound ? "job-ref--bound" : ""}`}>
+ <input
+ type="checkbox"
+ checked={bound}
+ disabled={refsLocked}
+ onChange={() => toggleReference(selected, ref.id)}
+ />
+ {/* The reference's real picture, not a stand-in. aria-hidden
+ because the name it illustrates is the next node in this
+ same <label>, and repeating it would say every reference
+ twice when the checkbox announces itself. */}
+ <span className="ref-mini" aria-hidden="true">
+ {picture
+ ? <ReferenceImage folderPath={folderPath} relativePath={ref.relativePath} sourcePath={ref.sourcePath} alt="" />
+ : referenceKindIcon(ref.kind)}
+ </span>
+ <b>{ref.name}</b>
+ {skipped
+ ? <p className="job-refs__reason">{skipped}</p>
+ : bound && !isReferenceDescribed(ref)
+ // Used, but incomplete: the picture goes to the engine while
+ // nothing tells it what to keep. Silence here let a
+ // boilerplate-filled card look finished.
+ ? <p className="job-refs__reason">Not described yet — the picture is sent, but nothing tells the engine what to keep.</p>
+ : ref.intendedUse.length > 0 && <small>Your tags: {ref.intendedUse.join(", ")}</small>}
+ </label>;
+ })}
+ {config.references.length === 0 && <p className="job-refs__empty">This project has no references yet. Add one under References and it can steer this scene.</p>}
+ {/* Only the empty case says anything now. With references actually
+ bound, the list above already shows what each one is and what is
+ wrong with any that will not be used; a paragraph restating the
+ route every one of them takes was a sentence about the system
+ rather than about this scene. */}
+ {promptRefs.length === 0 && <p className="job-refs__empty">The video engine only follows the words in the shots.</p>}
+ </div>
- {(planNotes[selected.id] || selected.error) && <div className="job-runtime-note">
- <span>What actually happened</span>
- <p>{planNotes[selected.id] ?? selected.error}</p>
- <small>Reported by the video engine (vidfab).</small>
- </div>}
-
- <dl className="job-meta">
- <div><dt>Video model</dt><dd>MiniMax H3</dd></div>
- <div><dt>Scene length</dt><dd>{sceneDurationSeconds(selected).toFixed(1)} seconds, {sceneShots(selected).length === 1 ? "one shot" : `${sceneShots(selected).length} shots`}</dd></div>
- {/* The project's own settings, not this scene's. The frame size is
- what the edit is exported at; the engine picks its own canvas
- from the shape alone (set_aspect is the only geometry vidfab
- takes), and the plan note above reports the one it picked. */}
- <div><dt>Shape</dt><dd>{config.settings.aspectRatio}</dd></div>
- <div><dt>Frame size</dt><dd>{resolutionLabel(config.settings.resolution, config.settings.aspectRatio)}</dd></div>
- <div><dt>Where it is</dt><dd>{STATUS_WORD[selected.status]}</dd></div>
- <div><dt>Saved to</dt><dd>{selected.outputRelativePath ?? "Nothing saved to disk"}</dd></div>
- </dl>
-
- <div className="job-refs">
- <span>{promptRefs.length === 0 ? "No references used by this scene" : promptRefs.length === 1 ? "1 reference guides this scene" : `${promptRefs.length} references guide this scene`}</span>
- {/* Every reference in the project, each a checkbox: which ones steer
- a scene is the user's decision. Writing one into a line ticks it
- here; unticking it takes it out of the prompt and out of what is
- sent to the engine. A bound reference the prompt skips stays
- listed with its reason — hiding it would leave the user
- wondering where it went. */}
- {config.references.map((ref) => {
- const bound = selected.referenceIds.includes(ref.id);
- const picture = ref.kind === "image" && (ref.relativePath || ref.sourcePath);
- const skipped = skipReason(ref);
- return <label key={ref.id} className={`job-ref ${bound ? "job-ref--bound" : ""}`}>
- <input
- type="checkbox"
- checked={bound}
- disabled={refsLocked}
- onChange={() => toggleReference(selected, ref.id)}
- />
- {/* The reference's real picture, not a stand-in. aria-hidden
- because the name it illustrates is the next node in this
- same <label>, and repeating it would say every reference
- twice when the checkbox announces itself. */}
- <span className="ref-mini" aria-hidden="true">
- {picture
- ? <ReferenceImage folderPath={folderPath} relativePath={ref.relativePath} sourcePath={ref.sourcePath} alt="" />
- : referenceKindIcon(ref.kind)}
- </span>
- <b>{ref.name}</b>
- {skipped
- ? <p className="job-refs__reason">{skipped}</p>
- : bound && !isReferenceDescribed(ref)
- // Used, but incomplete: the picture goes to the engine while
- // nothing tells it what to keep. Silence here let a
- // boilerplate-filled card look finished.
- ? <p className="job-refs__reason">Not described yet — the picture is sent, but nothing tells the engine what to keep.</p>
- : ref.intendedUse.length > 0 && <small>Your tags: {ref.intendedUse.join(", ")}</small>}
- </label>;
- })}
- {config.references.length === 0 && <p className="job-refs__empty">This project has no references yet. Add one under References and it can steer this scene.</p>}
- {/* The request was already handed to the engine, so a change here
- would say it steered a render it never touched. */}
- {refsLocked && <p className="job-refs__empty">This scene is already with the engine. Its references can be changed once it finishes, and the next run will use them.</p>}
- {/* Only the empty case says anything now. With references actually
- bound, the list above already shows what each one is and what is
- wrong with any that will not be used; a paragraph restating the
- route every one of them takes was a sentence about the system
- rather than about this scene. */}
- {promptRefs.length === 0 && <p className="job-refs__empty">The video engine only follows the words above.</p>}
+ {/* Every setting on this scene collapsed into the one string vidfab is
+ given. Recompiled from what the scene holds right now, so it cannot
+ disagree with what the next run sends. */}
+ <CompiledPrompt
+ segments={compileGenerationJobSegments(selected, boundRefs)}
+ caption={refsLocked
+ ? "This is the prompt the engine was given for the run in progress."
+ : "Rebuilt from this scene’s shots, settings and references every time it is sent."}
+ />
+
+ <dl className="job-meta">
+ <div><dt>Video model</dt><dd>MiniMax H3</dd></div>
+ <div><dt>Scene length</dt><dd>{sceneDurationSeconds(selected).toFixed(1)} seconds, {selectedShots.length === 1 ? "one shot" : `${selectedShots.length} shots`}</dd></div>
+ {/* The project's own settings, not this scene's. The frame size is
+ what the edit is exported at; the engine picks its own canvas
+ from the shape alone (set_aspect is the only geometry vidfab
+ takes), and the plan note above reports the one it picked. */}
+ <div><dt>Shape</dt><dd>{config.settings.aspectRatio}</dd></div>
+ <div><dt>Frame size</dt><dd>{resolutionLabel(config.settings.resolution, config.settings.aspectRatio)}</dd></div>
+ <div><dt>Where it is</dt><dd>{STATUS_WORD[selected.status]}</dd></div>
+ <div><dt>Saved to</dt><dd>{selected.outputRelativePath ?? "Nothing saved to disk"}</dd></div>
+ </dl>
</div>
<div className="job-actions">
@@ -405,26 +499,8 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
<p className="job-actions__note">This run finished without a video file in your project folder, so there is nothing to add to your edit.</p>
</>}
</div>
- </aside>
- </section>}
-
- {/* No scene selected — which, on a new project, means none exists. This
- is the whole of the "how do I start" advice now that the composer is
- gone, so it has to name both doors: the button below, and Pol. */}
- {!selected && <div className="job-empty">
- <span className="job-empty__icon"><Sparkles size={26} /></span>
- <h2>Start with one scene</h2>
- <p>An empty scene is one blank shot waiting for a line. Add one, then write what should happen on screen — who or what is in frame, what they do.</p>
- <ul className="job-empty__tips">
- <li>A scene can be up to 15 seconds and split into as many shots as you like.</li>
- <li>Each shot gets its own line, its own start time and its own settings.</li>
- <li>Drag a reference into a line and the prompt cites it as a subject.</li>
- <li>You can read the finished prompt before anything is sent.</li>
- <li>Or ask Pol in the bar along the bottom — Claude Code and Codex can write a whole scene from a prompt.</li>
- </ul>
- <button className="primary-button job-empty__add" onClick={newScene}><Plus size={16} /> Add an empty scene</button>
- </div>}
- </main>
+ </>}
+ </aside>}
</div>;
}
@@ -464,26 +540,6 @@ function CompiledPrompt({ segments, caption }: { segments: PromptSegment[]; capt
</section>;
}
-/* The rail sits before the <h1> in the DOM, so its group titles are labelled
- groups rather than headings — otherwise the document outline would start
- mid-tree with an <h3>. */
-function QueueGroup({ title, jobs, selectedId, onSelect }: { title: string; jobs: GenerationJob[]; selectedId?: string; onSelect: (id: string) => void }) {
- if (jobs.length === 0) return null;
- const labelId = `queue-group-${title.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`;
- return <section className="queue-group" role="group" aria-labelledby={labelId}>
- <p className="queue-group__label" id={labelId}>{title}<span>{jobs.length}</span></p>
- {jobs.map((job) => <button key={job.id} className={selectedId === job.id ? "selected" : ""} onClick={() => onSelect(job.id)}>
- <span className={`queue-thumb queue-thumb--${job.status}`}>{statusIcon(job.status)}</span>
- <span className="queue-row__text">
- <b>{job.title}</b>
- <small>{queueLine(job)}</small>
- {job.status === "generating" && <i className="mini-progress"><em style={{ width: `${job.progress * 100}%` }} /></i>}
- </span>
- <ChevronRight size={16} />
- </button>)}
- </section>;
-}
-
/* Why a reference that is bound to this scene never reaches its prompt, or null
when it does. The wording mirrors the References card so the two screens
describe the same state in the same words. */
@@ -518,101 +574,13 @@ const STAGES: Array<{ label: string; at: number }> = [
{ label: "Save", at: 0.9 },
];
-const STATUS_BADGE: Record<JobStatus, string> = {
- draft: "DRAFT",
- queued: "IN QUEUE",
- generating: "RENDERING",
- ready: "SAVING",
- completed: "FINISHED",
- failed: "FAILED",
- cancelled: "CANCELLED",
-};
-
-const STATUS_WORD: Record<JobStatus, string> = {
- draft: "Saved as a draft",
- queued: "Waiting to render",
- generating: "Rendering now",
- ready: "Saving the video file",
- completed: "Finished",
- failed: "Stopped by an error",
- cancelled: "Stopped by you",
-};
-
-const queueSummary = (active: number, waiting: number, total: number) => {
+const boardSummary = (active: number, waiting: number, total: number) => {
if (total === 0) return "Nothing here yet";
if (active > 0) return `${active} rendering · ${waiting} waiting`;
if (waiting > 0) return `${waiting} waiting to render`;
return total === 1 ? "1 scene" : `${total} scenes`;
};
-const queueLine = (job: GenerationJob) => {
- const shots = sceneShots(job).length;
- const shape = `${sceneDurationSeconds(job).toFixed(1)}s · ${shots === 1 ? "1 shot" : `${shots} shots`}`;
- switch (job.status) {
- case "generating": return `Rendering · ${Math.round(job.progress * 100)}%`;
- case "queued": return "Waiting its turn";
- case "draft": return `Draft — ${shape}`;
- case "ready": return `Saving the video file · ${Math.round(job.progress * 100)}%`;
- case "completed": return job.outputRelativePath ? `Ready to use · ${shape}` : "Finished with no file";
- case "failed": return "Didn’t finish";
- case "cancelled": return "Cancelled";
- }
-};
-
-/* Encoding turns the same spinner as rendering: it is the app working, not the
- app waiting, and a tick beside "saving" would say it was already done. */
-const statusIcon = (status: JobStatus) => status === "generating" || status === "ready" ? <LoaderCircle size={16} /> : status === "completed" ? <Check size={16} /> : status === "failed" ? <AlertCircle size={16} /> : status === "cancelled" ? <Ban size={16} /> : <Clock3 size={16} />;
-
-const progressTitle = (job: GenerationJob) => {
- switch (job.status) {
- case "generating": return `${Math.round(job.progress * 100)}% rendered`;
- case "queued": return "Waiting to start";
- case "draft": return "Draft saved";
- case "ready": return "Saving the video file";
- case "completed": return job.outputRelativePath ? "Ready for your edit" : "Finished with no file";
- case "failed": return "Didn’t finish";
- case "cancelled": return "Generation stopped";
- }
-};
-
-const stageCopy = (job: GenerationJob) => {
- switch (job.status) {
- case "generating": return "The video engine is building the motion and the sound.";
- case "queued": return "Waiting for the scene ahead of it to finish.";
- case "draft": return "Saved with your project. Nothing has been rendered yet.";
- case "ready": return "The pictures are rendered. They are being encoded into a video file in your project folder.";
- case "completed": return job.outputRelativePath ? "Saved in your project and ready to drop into the timeline." : "This run ended without saving a video file.";
- case "failed": return "The run stopped before it finished. You can try it again.";
- case "cancelled": return "You stopped this one. You can run it again.";
- }
-};
-
-const previewStatus = (job: GenerationJob) => {
- switch (job.status) {
- case "generating": return <><LoaderCircle size={15} /> Rendering {Math.round(job.progress * 100)}%</>;
- case "queued": return <><Clock3 size={15} /> Waiting in queue</>;
- case "draft": return <><Clock3 size={15} /> Draft — nothing rendered</>;
- case "ready": return <><LoaderCircle size={15} /> Saving {Math.round(job.progress * 100)}%</>;
- case "completed": return job.outputRelativePath ? <><Check size={15} /> Ready for your edit</> : <><AlertCircle size={15} /> No video file was saved</>;
- case "failed": return <><AlertCircle size={15} /> Generation failed</>;
- case "cancelled": return <><Ban size={15} /> Generation cancelled</>;
- }
-};
-
-/* Says out loud why the placeholder is empty, so the blank surface is never
- read as "the picture failed to load". */
-const previewCaption = (job: GenerationJob): string => {
- switch (job.status) {
- case "generating": return "Frames are being built now. PolStudio can’t show them while they are still in memory.";
- case "queued": return "This scene hasn’t started, so there is no picture to show.";
- case "draft": return "Nothing has been rendered, so there is no picture to show.";
- case "ready": return "The pictures are being encoded into a video file. It can be watched in the timeline once it lands.";
- case "completed": return job.outputRelativePath ? "A video file was saved. Open it in the timeline to watch it." : "This run ended without a video file, so there is no picture to show.";
- case "failed": return "The run stopped before any frames were kept.";
- case "cancelled": return "You stopped this run, so no frames were kept.";
- }
-};
-
const runtimeHeadline = (runtime: VidfabStatus | null) => {
if (!runtime) return "Checking for the video engine…";
switch (runtime.state) {
diff --git a/src/components/workspace/SceneBoard.tsx b/src/components/workspace/SceneBoard.tsx
new file mode 100644
index 0000000..e4ec6a3
--- /dev/null
+++ b/src/components/workspace/SceneBoard.tsx
@@ -0,0 +1,142 @@
+import { Plus, SlidersHorizontal } from "lucide-react";
+import { sceneDurationSeconds, sceneShots, splitActionText, type GenerationJob, type ProjectReference, type SceneShot } from "../../lib/project";
+import { selectedShotTagOptions } from "../../lib/shot-tags";
+import { referenceOrder } from "./SceneEditor";
+import { sceneLine, statusIcon, STATUS_BADGE } from "./sceneStatus";
+import { ShotThumbnail } from "./ShotThumbnail";
+
+/** What the right-hand panel is looking at. A scene is always named; `shotId`
+ * is the shot inside it, or null when the SCENE itself is what is open —
+ * which is what the line above each row of cards selects. */
+export interface GeneratorSelection {
+ jobId: string;
+ shotId: string | null;
+}
+
+const seconds = (value: number): string => `${value.toFixed(1)}s`;
+
+/* The board: every scene in the project, one row of shot cards each, separated
+ * by the line that carries the scene's own name and settings.
+ *
+ * Shots read left to right in the order they play, and the cards are the
+ * SUMMARY of a shot — its picture, its words and the settings hung off it.
+ * Nothing is edited here; clicking one opens it in the panel to the right. */
+export function SceneBoard({ jobs, folderPath, references, selection, onSelect, onAddShot }: {
+ jobs: GenerationJob[];
+ folderPath: string;
+ references: ProjectReference[];
+ selection: GeneratorSelection;
+ onSelect: (selection: GeneratorSelection) => void;
+ onAddShot: (job: GenerationJob) => void;
+}) {
+ return <div className="scene-board">
+ {jobs.map((job) => {
+ const shots = sceneShots(job);
+ const duration = sceneDurationSeconds(job);
+ const order = referenceOrder(job, shots, references);
+ const named = new Map(references.map((reference) => [reference.id, reference.name]));
+ const sceneOpen = selection.jobId === job.id && selection.shotId === null;
+ return <section key={job.id} className={`scene-section ${selection.jobId === job.id ? "scene-section--current" : ""}`} aria-label={job.title}>
+ {/* The scene line: the rule that separates one scene's shots from the
+ next one's, and the control that opens the scene's own settings. */}
+ <header className="scene-rule">
+ <button
+ type="button"
+ className={`scene-rule__open ${sceneOpen ? "scene-rule__open--open" : ""}`}
+ aria-pressed={sceneOpen}
+ aria-label={`Scene settings for ${job.title}`}
+ onClick={() => onSelect({ jobId: job.id, shotId: null })}
+ >
+ <span className={`scene-rule__status scene-rule__status--${job.status}`}>{statusIcon(job.status, 15)}</span>
+ <span className="scene-rule__text">
+ <b>{job.title}</b>
+ <small>{sceneLine(job)}</small>
+ </span>
+ <span className="scene-rule__badge">{STATUS_BADGE[job.status]}</span>
+ <span className="scene-rule__settings"><SlidersHorizontal size={15} aria-hidden="true" /> Scene settings</span>
+ </button>
+ <span className="scene-rule__line" aria-hidden="true" />
+ </header>
+
+ <ol className="shot-grid">
+ {shots.map((shot, index) => <li key={shot.id}>
+ <ShotCard
+ job={job}
+ shot={shot}
+ index={index}
+ endsAt={index + 1 < shots.length ? shots[index + 1].startSeconds : duration}
+ folderPath={folderPath}
+ order={order}
+ named={named}
+ open={selection.jobId === job.id && selection.shotId === shot.id}
+ onOpen={() => onSelect({ jobId: job.id, shotId: shot.id })}
+ />
+ </li>)}
+ <li>
+ <button
+ type="button"
+ className="shot-card shot-card--add"
+ aria-label={`Add a shot to ${job.title}`}
+ onClick={() => onAddShot(job)}
+ >
+ <Plus size={18} aria-hidden="true" />
+ <span>Add a shot</span>
+ </button>
+ </li>
+ </ol>
+ </section>;
+ })}
+ </div>;
+}
+
+/** One shot, as it reads on the board. Everything on it is a summary of what
+ * the panel to the right edits — no control of its own, because a card that
+ * both opens a shot and changes it is a card you cannot click. */
+function ShotCard({ job, shot, index, endsAt, folderPath, order, named, open, onOpen }: {
+ job: GenerationJob;
+ shot: SceneShot;
+ index: number;
+ endsAt: number;
+ folderPath: string;
+ /** Reference ids in the order this scene numbers them. */
+ order: string[];
+ named: Map<string, string>;
+ open: boolean;
+ onOpen: () => void;
+}) {
+ const parts = splitActionText(shot.action);
+ const written = shot.action.trim().length > 0;
+ const chosen = selectedShotTagOptions(shot.settings ?? {});
+
+ return <button
+ type="button"
+ className={`shot-card ${open ? "shot-card--open" : ""}`}
+ aria-pressed={open}
+ aria-label={`Shot ${index + 1} of ${job.title}`}
+ onClick={onOpen}
+ >
+ <ShotThumbnail folderPath={folderPath} job={job} seconds={shot.startSeconds} shotNumber={index + 1} />
+
+ <span className="shot-card__head">
+ <b>Shot {index + 1}</b>
+ <em>{seconds(shot.startSeconds)} – {seconds(endsAt)}</em>
+ </span>
+
+ {/* The line as it was written, with each citation shown as the reference it
+ points at rather than as the token that stores it. */}
+ <span className={`shot-card__line ${written ? "" : "shot-card__line--empty"}`}>
+ {written
+ ? parts.map((part, at) => part.kind === "text"
+ ? <span key={at}>{part.value}</span>
+ : <em key={at} className="shot-card__ref">{named.get(part.value) ?? `Reference ${order.indexOf(part.value) + 1}`}</em>)
+ : "No words yet — choose this shot and write what happens."}
+ </span>
+
+ <span className="shot-card__tags">
+ {chosen.map(({ group, option }) => <em key={`${group.id}-${option.id}`} className="shot-card__tag">
+ {option.label}
+ </em>)}
+ {chosen.length === 0 && <em className="shot-card__tag shot-card__tag--none">No settings</em>}
+ </span>
+ </button>;
+}
diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsx
index 14606bb..a828f54 100644
--- a/src/components/workspace/SceneEditor.tsx
+++ b/src/components/workspace/SceneEditor.tsx
@@ -1,5 +1,5 @@
-import { Plus, Trash2, X } from "lucide-react";
-import { useCallback, useMemo, useRef, useState } from "react";
+import { Trash2, X } from "lucide-react";
+import { useMemo, useRef, useState } from "react";
import {
actionReferenceIds,
danglingReferenceTokens,
@@ -9,7 +9,6 @@ import {
referenceToken,
sceneBriefText,
sceneDurationSeconds,
- sceneShots,
splitActionText,
SCENE_MAX_SECONDS,
SCENE_MIN_SECONDS,
@@ -35,149 +34,273 @@ export const REFERENCE_DRAG_TYPE = "application/x-polstudio-reference";
/** The step the length slider and the cut handles move in. Half a second is the
* finest cut the timestamp format prints exactly (`formatSceneSeconds`), so
* nothing here can set a time the prompt then rounds behind the user's back. */
-const STEP_SECONDS = 0.5;
+export const STEP_SECONDS = 0.5;
const seconds = (value: number): string => `${value.toFixed(1)}s`;
-interface SceneEditorProps {
+/** Everything that COULD be cited: the same filter pair the compiler applies,
+ * over the whole project. See the lockstep note on `usableImageReferences`. */
+export const citableReferences = (references: readonly ProjectReference[]): ProjectReference[] =>
+ references.filter((reference) => isReferenceUsable(reference) && isVisualReference(reference));
+
+/** The reference ids of a scene in the order it NUMBERS them, which is the
+ * order the compiler numbers them in: project order, filtered by what this
+ * scene binds — not the order the boxes were ticked. Anything a line still
+ * names but the prompt can no longer use is appended, so a broken token keeps
+ * a number and survives being typed around instead of vanishing on the next
+ * keystroke.
+ *
+ * The board and the panel both read this, because "Reference 2" on a card and
+ * "Reference 2" in the field have to be the same reference. */
+export function referenceOrder(job: GenerationJob, shots: readonly SceneShot[], references: readonly ProjectReference[]): string[] {
+ const order = citableReferences(references).filter((reference) => job.referenceIds.includes(reference.id)).map((reference) => reference.id);
+ for (const shot of shots) {
+ for (const id of actionReferenceIds(shot.action)) if (!order.includes(id)) order.push(id);
+ }
+ return order;
+}
+
+/** The update that writes a new set of shots onto a scene. The shots are the
+ * truth; `prompt` and `creativeBrief` are rewritten from them as the mirror
+ * they now are, and the legacy per-job `shotTags` is cleared because its terms
+ * have just moved onto a shot — two copies of the same choice is how one of
+ * them goes stale.
+ *
+ * One function, called by every control that changes a shot, because a second
+ * place that wrote `shots` without the mirror would leave a scene whose saved
+ * prompt no longer matched its own lines. */
+export function writeShots(job: GenerationJob, next: readonly SceneShot[], extra: Partial<GenerationJob> = {}): Partial<GenerationJob> {
+ const shots = normalizeSceneShots(next);
+ const text = sceneBriefText(shots);
+ return {
+ shots,
+ shotTags: null,
+ prompt: text,
+ creativeBrief: text,
+ durationSeconds: sceneDurationSeconds(job),
+ ...extra,
+ };
+}
+
+/* --- One shot, opened on the right ---------------------------------------- */
+
+/** Everything about ONE shot: when it starts, the line the user wrote for it,
+ * the references that line cites, and the settings hung off it. This is what
+ * clicking a card on the board opens. */
+export function ShotInspector({ job, shots, shot, index, endsAt, duration, references, disabled, removable, onChange, onRemove }: {
job: GenerationJob;
+ /** Every shot of the scene, so the panel can number the references the same
+ * way the compiler does and warn about the ones no line can still cite. */
+ shots: SceneShot[];
+ shot: SceneShot;
+ index: number;
+ endsAt: number;
+ duration: number;
/** Every reference in the project. Any of them can be dropped into a line;
* doing so binds it to the scene, which is what gives it a number. */
references: ProjectReference[];
/** True once the scene is with the engine: it already has the prompt, so an
* edit now would change nothing about that run while claiming otherwise. */
disabled: boolean;
- onChange: (updates: Partial<GenerationJob>) => void;
-}
-
-export function SceneEditor({ job, references, disabled, onChange }: SceneEditorProps) {
- const shots = useMemo(() => sceneShots(job), [job]);
- const duration = sceneDurationSeconds(job);
- /* Everything that COULD be cited: the same filter pair the compiler applies,
- over the whole project. See the lockstep note on `usableImageReferences`. */
- const citable = useMemo(
- () => references.filter((reference) => isReferenceUsable(reference) && isVisualReference(reference)),
- [references],
- );
- /* And everything this scene actually cites, in the order the compiler numbers
- it: `boundRefs` in GeneratorView is `config.references` filtered by this
- scene's ids, so PROJECT order — not the order boxes were ticked — decides
- which reference is <Subject 1>. "Reference N" on screen is that number and
- nothing else, which is the whole point of numbering it here. */
- const numbered = useMemo(
- () => citable.filter((reference) => job.referenceIds.includes(reference.id)),
- [citable, job.referenceIds],
- );
- /* Numbering for the text. The cited references come first; anything a line
- still names but the prompt can no longer use is appended, so a broken token
- keeps a number and survives being typed around instead of vanishing on the
- next keystroke. */
- const tokenOrder = useMemo(() => {
- const order = numbered.map((reference) => reference.id);
- for (const shot of shots) {
- for (const id of actionReferenceIds(shot.action)) if (!order.includes(id)) order.push(id);
- }
- return order;
- }, [numbered, shots]);
+ removable: boolean;
+ onChange: (updates: Partial<SceneShot>) => void;
+ onRemove: () => void;
+}) {
+ const fieldRef = useRef<HTMLTextAreaElement | null>(null);
+ const citable = useMemo(() => citableReferences(references), [references]);
+ const numbered = useMemo(() => citable.filter((reference) => job.referenceIds.includes(reference.id)), [citable, job.referenceIds]);
+ const tokenOrder = useMemo(() => referenceOrder(job, shots, references), [job, shots, references]);
const referenceById = useMemo(() => new Map(references.map((reference) => [reference.id, reference])), [references]);
const dangling = useMemo(() => danglingReferenceTokens(shots, references), [shots, references]);
- const [activeShotId, setActiveShotId] = useState<string | null>(null);
- const active = shots.some((shot) => shot.id === activeShotId) ? activeShotId : shots[0]?.id ?? null;
-
- /* Every edit lands here. The shots are the truth; `prompt` and `creativeBrief`
- are rewritten from them as the mirror they now are, and the legacy per-job
- `shotTags` is cleared because its terms have just moved onto a shot — two
- copies of the same choice is how one of them goes stale. */
- const write = useCallback((next: SceneShot[], extra: Partial<GenerationJob> = {}) => {
- const nextShots = normalizeSceneShots(next);
- const text = sceneBriefText(nextShots);
- onChange({
- shots: nextShots,
- shotTags: null,
- prompt: text,
- creativeBrief: text,
- durationSeconds: duration,
- ...extra,
- });
- }, [duration, onChange]);
-
- const patchShot = (id: string, updates: Partial<SceneShot>) =>
- write(shots.map((shot) => shot.id === id ? { ...shot, ...updates } : shot));
-
- const setDuration = (value: number) => {
- const next = Math.min(SCENE_MAX_SECONDS, Math.max(SCENE_MIN_SECONDS, Math.round(value / STEP_SECONDS) * STEP_SECONDS));
- // A shot cannot start after the scene ends, so shortening the scene pulls
- // the later cuts back with it rather than leaving them past the end.
- write(shots.map((shot) => ({ ...shot, startSeconds: Math.min(shot.startSeconds, next) })), { durationSeconds: next });
- };
+ const settings = shot.settings ?? {};
+ const shotNumber = index + 1;
- const addShot = () => {
- const last = shots[shots.length - 1];
- const halfway = Math.round(((last.startSeconds + duration) / 2) / STEP_SECONDS) * STEP_SECONDS;
- const start = Math.min(duration, Math.max(last.startSeconds + STEP_SECONDS, halfway));
- const shot: SceneShot = { id: `shot-${crypto.randomUUID()}`, startSeconds: start, action: "" };
- write([...shots, shot]);
- setActiveShotId(shot.id);
- };
+ /* The line, written the way the user reads and types it. What is STORED is
+ `@[ref:<id>]`, which survives a rename and a reorder; what is SHOWN is
+ "[Reference N]", which is what they were promised and what they may type by
+ hand. The two are one mapping, applied in both directions here and nowhere
+ else, so the field can never show a citation the storage does not hold. */
+ const display = useMemo(() => splitActionText(shot.action).map((part) => {
+ if (part.kind === "text") return part.value;
+ const number = tokenOrder.indexOf(part.value) + 1;
+ return number > 0 ? `[Reference ${number}]` : part.value;
+ }).join(""), [shot.action, tokenOrder]);
- const removeShot = (id: string) => {
- // A scene is at least one shot: with none there is nowhere to write, and
- // the compiler would have nothing to make a [Shot 1] out of.
- if (shots.length <= 1) return;
- write(shots.filter((shot) => shot.id !== id));
- };
+ const store = (typed: string): string => typed.replace(/\[Reference (\d+)\]/g, (whole, digits: string) => {
+ const id = tokenOrder[Number(digits) - 1];
+ // A number nobody has a reference for stays exactly as typed. It is the
+ // user's own text, and turning it into a citation would invent a subject.
+ return id ? referenceToken(id) : whole;
+ });
- return <section className="scene-editor" aria-label="This scene">
- <SceneLengthBar
- shots={shots}
- duration={duration}
- disabled={disabled}
- onDuration={setDuration}
- onStart={(id, startSeconds) => patchShot(id, { startSeconds })}
- onSelect={setActiveShotId}
- activeShotId={active}
- />
+ const insertAtCaret = (referenceId: string) => {
+ const number = tokenOrder.indexOf(referenceId) + 1;
+ const field = fieldRef.current;
+ const at = field ? field.selectionStart : display.length;
+ const before = display.slice(0, at);
+ const after = display.slice(at);
+ // Both sides, not just the one in front of the caret. A drop at the START
+ // of a line has nothing before it, so `lead` is empty and the token used to
+ // fuse to the first word: "<Subject 1>walks towards the camera" — a
+ // malformed citation, sent to the model exactly as written.
+ const lead = before && !/\s$/.test(before) ? " " : "";
+ const trail = after && !/^\s/.test(after) ? " " : "";
+ // A reference this scene does not cite yet has no number, so the token is
+ // written by id and the number appears once the scene binds it.
+ const token = number > 0 ? `[Reference ${number}]` : referenceToken(referenceId);
+ onChange({ action: store(`${before}${lead}${token}${trail}${after}`) });
+ };
- <ol className="shot-list">
- {shots.map((shot, index) => <li key={shot.id}>
- <ShotCard
- shot={shot}
- index={index}
- endsAt={index + 1 < shots.length ? shots[index + 1].startSeconds : duration}
- duration={duration}
- disabled={disabled}
- removable={shots.length > 1}
- focused={shot.id === active}
- tokenOrder={tokenOrder}
- referenceById={referenceById}
- citable={citable}
- numbered={numbered}
- onFocus={() => setActiveShotId(shot.id)}
- onChange={(updates) => patchShot(shot.id, updates)}
- onRemove={() => removeShot(shot.id)}
+ return <section className="shot-inspector" aria-label={`Shot ${shotNumber}`}>
+ <div className="shot-inspector__timing">
+ <label className="shot-card__start">
+ <span>Starts at</span>
+ <input
+ type="number"
+ min={SCENE_MIN_SECONDS}
+ max={duration}
+ step={STEP_SECONDS}
+ value={shot.startSeconds}
+ disabled={disabled || index === 0}
+ aria-label={`Shot ${shotNumber} starts at, in seconds`}
+ title={index === 0 ? "The first shot always opens the scene." : undefined}
+ onChange={(event) => onChange({ startSeconds: Math.min(duration, Math.max(0, Number(event.target.value) || 0)) })}
/>
- </li>)}
- </ol>
+ <em>to {seconds(endsAt)}</em>
+ </label>
+ {removable && <button
+ type="button"
+ className="shot-card__remove"
+ disabled={disabled}
+ aria-label={`Remove shot ${shotNumber}`}
+ onClick={onRemove}
+ ><Trash2 size={15} /> Remove</button>}
+ </div>
- <button type="button" className="secondary-button scene-editor__add" disabled={disabled} onClick={addShot}>
- <Plus size={16} /> Add a shot
- </button>
+ {/* The line is the point of this screen, so it is the biggest thing on it. */}
+ <label className="shot-card__action">
+ <span className="shot-card__sublabel">What happens, in your own words</span>
+ <textarea
+ ref={fieldRef}
+ value={display}
+ disabled={disabled}
+ aria-label={`What happens in shot ${shotNumber}`}
+ placeholder="Example: she walks towards the camera and stops under the awning."
+ onChange={(event) => onChange({ action: store(event.target.value) })}
+ onDragOver={(event) => { if (event.dataTransfer.types.includes(REFERENCE_DRAG_TYPE)) event.preventDefault(); }}
+ onDrop={(event) => {
+ const referenceId = event.dataTransfer.getData(REFERENCE_DRAG_TYPE);
+ if (!referenceId) return;
+ event.preventDefault();
+ insertAtCaret(referenceId);
+ }}
+ />
+ </label>
+
+ <ActionReadback
+ action={shot.action}
+ tokenOrder={tokenOrder}
+ referenceById={referenceById}
+ citable={citable}
+ numbered={numbered}
+ disabled={disabled}
+ onRepoint={(from, to) => onChange({ action: shot.action.split(referenceToken(from)).join(referenceToken(to)) })}
+ onDrop={(from) => onChange({ action: shot.action.split(referenceToken(from)).join("") })}
+ />
<ReferencePalette
citable={citable}
numbered={numbered}
dangling={dangling}
referenceById={referenceById}
- disabled={disabled || !active}
- onInsert={(referenceId) => {
- const shot = shots.find((item) => item.id === active);
- if (!shot) return;
- const spacer = shot.action && !/\s$/.test(shot.action) ? " " : "";
- patchShot(shot.id, { action: `${shot.action}${spacer}${referenceToken(referenceId)}` });
- }}
+ disabled={disabled}
+ onInsert={insertAtCaret}
+ />
+
+ <ShotSettings
+ settings={settings}
+ disabled={disabled}
+ shotNumber={shotNumber}
+ onChange={(next) => onChange({ settings: normalizeShotTagSelection(next) })}
/>
+ </section>;
+}
+
+/* --- The scene, opened from its own line ---------------------------------- */
- <SceneSettings job={job} shots={shots} disabled={disabled} onChange={onChange} onShots={write} />
+/** What belongs to the whole scene rather than to one shot: how long it runs
+ * and where its cuts fall, the look the description opens with (base guide
+ * §4.1), and the two sound fields the guide defines per prompt (§4.6, §4.7). */
+export function SceneInspector({ job, shots, disabled, onChange, onShots, onDuration, onSelectShot }: {
+ job: GenerationJob;
+ shots: SceneShot[];
+ disabled: boolean;
+ onChange: (updates: Partial<GenerationJob>) => void;
+ onShots: (next: SceneShot[]) => void;
+ onDuration: (value: number) => void;
+ onSelectShot: (shotId: string) => void;
+}) {
+ const look = SHOT_TAG_GROUPS.find((group) => group.id === "visualStyle")!;
+ // The style is read off the first shot that carries one, so that is where it
+ // is written. One place, never a second field that could disagree with it.
+ const chosen = shots.map((shot) => shot.settings?.[look.id]?.[0]).find(Boolean) ?? "";
+
+ return <section className="scene-inspector" aria-label="This scene">
+ <SceneLengthBar
+ shots={shots}
+ duration={sceneDurationSeconds(job)}
+ disabled={disabled}
+ onDuration={onDuration}
+ onStart={(id, startSeconds) => onShots(shots.map((shot) => shot.id === id ? { ...shot, startSeconds } : shot))}
+ onSelect={onSelectShot}
+ />
+
+ <div className="scene-settings">
+ <h3>The whole scene</h3>
+ <label className="scene-settings__field">
+ <span>Look</span>
+ <select
+ value={chosen}
+ disabled={disabled}
+ aria-label="The look of this scene"
+ onChange={(event) => {
+ const value = event.target.value;
+ onShots(shots.map((shot, index) => {
+ const settings = { ...(shot.settings ?? {}) };
+ if (index === 0 && value) settings[look.id] = [value];
+ else delete settings[look.id];
+ return { ...shot, settings: normalizeShotTagSelection(settings) };
+ }));
+ }}
+ >
+ <option value="">Guessed from your words</option>
+ {look.options.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
+ </select>
+ <small>{look.help}</small>
+ </label>
+ <label className="scene-settings__field">
+ <span>Sound</span>
+ <textarea
+ value={job.soundscape ?? ""}
+ disabled={disabled}
+ aria-label="The sound of this scene"
+ placeholder="Ambience, and the sounds the action itself makes."
+ onChange={(event) => onChange({ soundscape: event.target.value })}
+ />
+ <small>Goes into <code>overall_soundscape</code>. Left blank, PolStudio writes a line that adds nothing your description has not already established.</small>
+ </label>
+ <label className="scene-settings__field">
+ <span>Music</span>
+ <textarea
+ value={job.music ?? ""}
+ disabled={disabled}
+ aria-label="The music of this scene"
+ placeholder="Instrumentation, tempo and dynamics — not a mood."
+ onChange={(event) => onChange({ music: event.target.value })}
+ />
+ <small>Goes into <code>non_diegetic_music</code>. Left blank, it is sent as N/A, because a score nobody asked for is one PolStudio would have invented.</small>
+ </label>
+ </div>
</section>;
}
@@ -185,16 +308,15 @@ export function SceneEditor({ job, references, disabled, onChange }: SceneEditor
/** The bar the scene is split on. Each shot is a segment; the line between two
* of them is the cut, and it can be dragged or nudged with the arrow keys.
- * Every shot also carries a plain number field below, because a bar cannot be
- * read by a screen reader and cannot be typed into. */
-function SceneLengthBar({ shots, duration, disabled, onDuration, onStart, onSelect, activeShotId }: {
+ * Every shot also carries a plain number field in its own panel, because a bar
+ * cannot be read by a screen reader and cannot be typed into. */
+function SceneLengthBar({ shots, duration, disabled, onDuration, onStart, onSelect }: {
shots: SceneShot[];
duration: number;
disabled: boolean;
onDuration: (value: number) => void;
onStart: (id: string, value: number) => void;
onSelect: (id: string) => void;
- activeShotId: string | null;
}) {
const trackRef = useRef<HTMLDivElement | null>(null);
const [dragging, setDragging] = useState<string | null>(null);
@@ -255,7 +377,7 @@ function SceneLengthBar({ shots, duration, disabled, onDuration, onStart, onSele
>
{shots.map((shot, index) => <div
key={shot.id}
- className={`scene-bar__shot ${shot.id === activeShotId ? "scene-bar__shot--active" : ""}`}
+ className="scene-bar__shot"
style={{ width: `${width(index)}%` }}
>
{index > 0 && <button
@@ -276,6 +398,8 @@ function SceneLengthBar({ shots, duration, disabled, onDuration, onStart, onSele
onStart(shot.id, clamp(index, shot.startSeconds + delta));
}}
/>}
+ {/* Opens the shot in the panel, which is the same thing clicking its
+ card on the board does — the bar is the other way to reach it. */}
<button type="button" className="scene-bar__label" onClick={() => onSelect(shot.id)}>
<b>Shot {index + 1}</b>
<em>{seconds(shot.startSeconds)}</em>
@@ -285,131 +409,6 @@ function SceneLengthBar({ shots, duration, disabled, onDuration, onStart, onSele
</div>;
}
-/* --- One shot ------------------------------------------------------------- */
-
-function ShotCard({ shot, index, endsAt, duration, disabled, removable, focused, tokenOrder, referenceById, citable, numbered, onFocus, onChange, onRemove }: {
- shot: SceneShot;
- index: number;
- endsAt: number;
- duration: number;
- disabled: boolean;
- removable: boolean;
- focused: boolean;
- tokenOrder: string[];
- referenceById: Map<string, ProjectReference>;
- citable: ProjectReference[];
- numbered: ProjectReference[];
- onFocus: () => void;
- onChange: (updates: Partial<SceneShot>) => void;
- onRemove: () => void;
-}) {
- const fieldRef = useRef<HTMLTextAreaElement | null>(null);
- const settings = shot.settings ?? {};
-
- /* The line, written the way the user reads and types it. What is STORED is
- `@[ref:<id>]`, which survives a rename and a reorder; what is SHOWN is
- "[Reference N]", which is what they were promised and what they may type by
- hand. The two are one mapping, applied in both directions here and nowhere
- else, so the field can never show a citation the storage does not hold. */
- const display = useMemo(() => splitActionText(shot.action).map((part) => {
- if (part.kind === "text") return part.value;
- const number = tokenOrder.indexOf(part.value) + 1;
- return number > 0 ? `[Reference ${number}]` : part.value;
- }).join(""), [shot.action, tokenOrder]);
-
- const store = (typed: string): string => typed.replace(/\[Reference (\d+)\]/g, (whole, digits: string) => {
- const id = tokenOrder[Number(digits) - 1];
- // A number nobody has a reference for stays exactly as typed. It is the
- // user's own text, and turning it into a citation would invent a subject.
- return id ? referenceToken(id) : whole;
- });
-
- const insertAtCaret = (referenceId: string) => {
- const number = tokenOrder.indexOf(referenceId) + 1;
- const field = fieldRef.current;
- const at = field ? field.selectionStart : display.length;
- const before = display.slice(0, at);
- const after = display.slice(at);
- // Both sides, not just the one in front of the caret. A drop at the START
- // of a line has nothing before it, so `lead` is empty and the token used to
- // fuse to the first word: "<Subject 1>walks towards the camera" — a
- // malformed citation, sent to the model exactly as written.
- const lead = before && !/\s$/.test(before) ? " " : "";
- const trail = after && !/^\s/.test(after) ? " " : "";
- // A reference this scene does not cite yet has no number, so the token is
- // written by id and the number appears once the scene binds it.
- const token = number > 0 ? `[Reference ${number}]` : referenceToken(referenceId);
- onChange({ action: store(`${before}${lead}${token}${trail}${after}`) });
- };
-
- return <article className={`shot-card ${focused ? "shot-card--focused" : ""}`}>
- <header className="shot-card__head">
- <b>Shot {index + 1}</b>
- <label className="shot-card__start">
- <span>Starts at</span>
- <input
- type="number"
- min={SCENE_MIN_SECONDS}
- max={duration}
- step={STEP_SECONDS}
- value={shot.startSeconds}
- disabled={disabled || index === 0}
- aria-label={`Shot ${index + 1} starts at, in seconds`}
- title={index === 0 ? "The first shot always opens the scene." : undefined}
- onChange={(event) => onChange({ startSeconds: Math.min(duration, Math.max(0, Number(event.target.value) || 0)) })}
- />
- <em>to {seconds(endsAt)}</em>
- </label>
- {removable && <button
- type="button"
- className="shot-card__remove"
- disabled={disabled}
- aria-label={`Remove shot ${index + 1}`}
- onClick={onRemove}
- ><Trash2 size={15} /></button>}
- </header>
-
- {/* The line is the point of this screen, so it is the biggest thing on it. */}
- <label className="shot-card__action">
- <span className="shot-card__sublabel">What happens, in your own words</span>
- <textarea
- ref={fieldRef}
- value={display}
- disabled={disabled}
- aria-label={`What happens in shot ${index + 1}`}
- placeholder="Example: she walks towards the camera and stops under the awning."
- onFocus={onFocus}
- onChange={(event) => onChange({ action: store(event.target.value) })}
- onDragOver={(event) => { if (event.dataTransfer.types.includes(REFERENCE_DRAG_TYPE)) event.preventDefault(); }}
- onDrop={(event) => {
- const referenceId = event.dataTransfer.getData(REFERENCE_DRAG_TYPE);
- if (!referenceId) return;
- event.preventDefault();
- insertAtCaret(referenceId);
- }}
- />
- </label>
-
- <ActionReadback
- action={shot.action}
- tokenOrder={tokenOrder}
- referenceById={referenceById}
- citable={citable}
- numbered={numbered}
- disabled={disabled}
- onRepoint={(from, to) => onChange({ action: shot.action.split(referenceToken(from)).join(referenceToken(to)) })}
- onDrop={(from) => onChange({ action: shot.action.split(referenceToken(from)).join("") })}
- />
-
- <ShotSettings
- settings={settings}
- disabled={disabled}
- shotNumber={index + 1}
- onChange={(next) => onChange({ settings: normalizeShotTagSelection(next) })}
- />
- </article>;
-}
-
/** The same line, read back with each reference as a control. This is where
* "click Reference 1 and choose another one" lives: the select IS the token,
* so re-pointing it changes which reference the sentence names without
@@ -533,69 +532,6 @@ function ShotSettings({ settings, disabled, shotNumber, onChange }: {
</div>;
}
-/** What belongs to the whole scene rather than to one shot: the look the
- * description opens with (base guide §4.1), and the two sound fields the guide
- * defines per prompt (§4.6, §4.7). */
-function SceneSettings({ job, shots, disabled, onChange, onShots }: {
- job: GenerationJob;
- shots: SceneShot[];
- disabled: boolean;
- onChange: (updates: Partial<GenerationJob>) => void;
- onShots: (next: SceneShot[]) => void;
-}) {
- const look = SHOT_TAG_GROUPS.find((group) => group.id === "visualStyle")!;
- // The style is read off the first shot that carries one, so that is where it
- // is written. One place, never a second field that could disagree with it.
- const chosen = shots.map((shot) => shot.settings?.[look.id]?.[0]).find(Boolean) ?? "";
-
- return <div className="scene-settings">
- <h3>The whole scene</h3>
- <label className="scene-settings__field">
- <span>Look</span>
- <select
- value={chosen}
- disabled={disabled}
- aria-label="The look of this scene"
- onChange={(event) => {
- const value = event.target.value;
- onShots(shots.map((shot, index) => {
- const settings = { ...(shot.settings ?? {}) };
- if (index === 0 && value) settings[look.id] = [value];
- else delete settings[look.id];
- return { ...shot, settings: normalizeShotTagSelection(settings) };
- }));
- }}
- >
- <option value="">Guessed from your words</option>
- {look.options.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
- </select>
- <small>{look.help}</small>
- </label>
- <label className="scene-settings__field">
- <span>Sound</span>
- <textarea
- value={job.soundscape ?? ""}
- disabled={disabled}
- aria-label="The sound of this scene"
- placeholder="Ambience, and the sounds the action itself makes."
- onChange={(event) => onChange({ soundscape: event.target.value })}
- />
- <small>Goes into <code>overall_soundscape</code>. Left blank, PolStudio writes a line that adds nothing your description has not already established.</small>
- </label>
- <label className="scene-settings__field">
- <span>Music</span>
- <textarea
- value={job.music ?? ""}
- disabled={disabled}
- aria-label="The music of this scene"
- placeholder="Instrumentation, tempo and dynamics — not a mood."
- onChange={(event) => onChange({ music: event.target.value })}
- />
- <small>Goes into <code>non_diegetic_music</code>. Left blank, it is sent as N/A, because a score nobody asked for is one PolStudio would have invented.</small>
- </label>
- </div>;
-}
-
/* --- The references this scene can use ------------------------------------ */
function ReferencePalette({ citable, numbered, dangling, referenceById, disabled, onInsert }: {
@@ -610,7 +546,7 @@ function ReferencePalette({ citable, numbered, dangling, referenceById, disabled
<span className="reference-palette__lead">
{citable.length === 0
? "This project has no references the prompt can use yet. Add one under References and it can be dropped into a line."
- : "Drag one into a line, or add it to the end of the shot you were last writing in."}
+ : "Drag one into the line, or click it to write it where the caret is."}
</span>
<ul>
{citable.map((reference) => {
@@ -639,7 +575,7 @@ function ReferencePalette({ citable, numbered, dangling, referenceById, disabled
{dangling.length > 0 && <p className="reference-palette__broken">
{dangling.length === 1 ? "One reference named in this scene" : `${dangling.length} references named in this scene`} can no
longer be used — {dangling.map((id) => referenceById.get(id)?.name ?? "one that was deleted").join(", ")}. Those names are
- left out of the compiled prompt below, and the scene cannot be sent until each one is swapped for another reference or taken
+ left out of the compiled prompt, and the scene cannot be sent until each one is swapped for another reference or taken
out of the line.
</p>}
</div>;
diff --git a/src/components/workspace/ShotThumbnail.test.tsx b/src/components/workspace/ShotThumbnail.test.tsx
new file mode 100644
index 0000000..6e7b85f
--- /dev/null
+++ b/src/components/workspace/ShotThumbnail.test.tsx
@@ -0,0 +1,140 @@
+// @vitest-environment jsdom
+
+import { cleanup, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { createProjectConfig, parseProjectConfig, sceneShots, type GenerationJob } from "../../lib/project";
+import { ShotThumbnail } from "./ShotThumbnail";
+
+vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));
+
+afterEach(cleanup);
+
+/** A media stack that behaves like a browser's: the desktop shell serves the
+ * bytes, blob URLs exist, a <video> reports this file's metadata, and a canvas
+ * actually draws. jsdom does none of that, so it is stood in for — and every
+ * seek the component asks for is recorded, because WHICH frame each card gets
+ * is the whole point of this component. */
+async function withFakeFile(file: { seconds: number }, body: (seen: { seeks: number[]; reads: () => number }) => Promise<void>) {
+ const { invoke } = await import("@tauri-apps/api/core");
+ (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__ = {};
+ vi.mocked(invoke).mockResolvedValue(new ArrayBuffer(8));
+ URL.createObjectURL = () => "blob:polstudio-test";
+ URL.revokeObjectURL = () => undefined;
+ const load = HTMLMediaElement.prototype.load;
+ const getContext = HTMLCanvasElement.prototype.getContext;
+ const toDataURL = HTMLCanvasElement.prototype.toDataURL;
+ HTMLMediaElement.prototype.load = () => undefined;
+ HTMLCanvasElement.prototype.getContext = (() => ({ drawImage: () => undefined })) as unknown as typeof getContext;
+ const seeks: number[] = [];
+ // The drawn frame is named after the moment it was taken from, so a test can
+ // tell one card's picture from another's.
+ HTMLCanvasElement.prototype.toDataURL = function () {
+ return `data:image/jpeg;base64,frame-${seeks.length === 0 ? 0 : seeks[seeks.length - 1]}`;
+ } as unknown as typeof toDataURL;
+ const create = document.createElement.bind(document);
+ const spy = vi.spyOn(document, "createElement").mockImplementation((tag: string, options?: ElementCreationOptions) => {
+ const element = create(tag, options);
+ if (tag === "video") {
+ for (const [name, value] of [["duration", file.seconds], ["videoWidth", 1920], ["videoHeight", 1080]] as const) {
+ Object.defineProperty(element, name, { value, configurable: true });
+ }
+ let currentTime = 0;
+ Object.defineProperty(element, "currentTime", {
+ configurable: true,
+ get: () => currentTime,
+ set: (value: number) => {
+ currentTime = value;
+ seeks.push(value);
+ setTimeout(() => element.dispatchEvent(new Event("seeked")), 0);
+ },
+ });
+ setTimeout(() => element.dispatchEvent(new Event("loadeddata")), 0);
+ }
+ return element;
+ });
+ try {
+ await body({ seeks, reads: () => vi.mocked(invoke).mock.calls.length });
+ } finally {
+ spy.mockRestore();
+ HTMLMediaElement.prototype.load = load;
+ HTMLCanvasElement.prototype.getContext = getContext;
+ HTMLCanvasElement.prototype.toDataURL = toDataURL;
+ delete (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__;
+ vi.mocked(invoke).mockReset();
+ }
+}
+
+/** A finished scene of two shots with a real file in the project folder. */
+const rendered = (folder: string): GenerationJob => {
+ const fresh = createProjectConfig({ name: folder, prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
+ return parseProjectConfig({
+ ...fresh,
+ generationJobs: [{
+ ...fresh.generationJobs[0],
+ status: "completed",
+ stage: "completed",
+ progress: 1,
+ outputRelativePath: "media/generated/first-scene.mp4",
+ durationSeconds: 9,
+ shots: [
+ { id: "a1", startSeconds: 0, action: "she walks towards the camera" },
+ { id: "a2", startSeconds: 4.5, action: "she stops at the doorway" },
+ ],
+ }],
+ }).generationJobs[0];
+};
+
+describe("a shot's picture", () => {
+ it("takes each shot's own frame out of the scene's file, opening that file once", async () => {
+ /* One .mp4 holds the whole scene, so a component that read the file per
+ card would pull the same few hundred megabytes through the webview once
+ per shot. */
+ const folder = "C:\\Opened once";
+ const job = rendered(folder);
+ await withFakeFile({ seconds: 9 }, async (seen) => {
+ render(<>{sceneShots(job).map((shot, index) =>
+ <ShotThumbnail key={shot.id} folderPath={folder} job={job} seconds={shot.startSeconds} shotNumber={index + 1} />)}</>);
+
+ /* Named "Shot N of <scene>" once a real frame is drawn; until then the
+ placeholder is named for the state instead, so this waits for the
+ picture rather than for anything with a role of img. */
+ const drawn = () => screen.getAllByRole("img", { name: /of First scene$/ }) as HTMLImageElement[];
+ await waitFor(() => expect(drawn()).toHaveLength(2));
+ const pictures = drawn();
+ expect(pictures.map((image) => image.getAttribute("alt")))
+ .toEqual(["Shot 1 of First scene", "Shot 2 of First scene"]);
+ // The file was read once, for both cards.
+ expect(seen.reads()).toBe(1);
+ /* And each card got ITS shot's frame: a quarter of a second past the cut,
+ which is inside the shot and past a fade-in that would otherwise hand
+ the first card a black rectangle. */
+ expect(seen.seeks).toEqual([0.25, 4.75]);
+ expect(pictures[0].src).not.toBe(pictures[1].src);
+ });
+ });
+
+ it("shows no picture and reads no file until the scene has been rendered", async () => {
+ const folder = "C:\\Not rendered";
+ const fresh = createProjectConfig({ name: "Draft", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
+ const job = fresh.generationJobs[0];
+ await withFakeFile({ seconds: 9 }, async (seen) => {
+ render(<ShotThumbnail folderPath={folder} job={job} seconds={0} shotNumber={1} />);
+ // A labelled placeholder that says which state the scene is in, never an
+ // invented picture and never a read of a file that does not exist.
+ expect(screen.getByRole("img", { name: "Shot 1 — Not rendered yet" })).not.toBeNull();
+ expect(screen.queryByRole("img", { name: /of / })).toBeNull();
+ expect(seen.reads()).toBe(0);
+ });
+ });
+
+ it("says a finished scene could not be previewed rather than showing nothing", async () => {
+ const folder = "C:\\Unreadable";
+ const job = rendered(folder);
+ const { invoke } = await import("@tauri-apps/api/core");
+ await withFakeFile({ seconds: 9 }, async () => {
+ vi.mocked(invoke).mockRejectedValue(new Error("That file is not in the project folder."));
+ render(<ShotThumbnail folderPath={folder} job={job} seconds={0} shotNumber={1} />);
+ await waitFor(() => expect(screen.getByRole("img", { name: "Shot 1 — No preview" })).not.toBeNull());
+ });
+ });
+});
diff --git a/src/components/workspace/ShotThumbnail.tsx b/src/components/workspace/ShotThumbnail.tsx
new file mode 100644
index 0000000..43abdff
--- /dev/null
+++ b/src/components/workspace/ShotThumbnail.tsx
@@ -0,0 +1,271 @@
+import { Ban, Clock3, Film, LoaderCircle, TriangleAlert } from "lucide-react";
+import { useEffect, useState, type ReactNode } from "react";
+import { readMediaFileUrl } from "../../lib/persistence";
+import type { GenerationJob } from "../../lib/project";
+
+/* A real frame of ONE shot, taken from the scene's own video file.
+ *
+ * A scene is rendered as a single .mp4 in the project folder, and a shot is a
+ * span inside it — so the picture of shot 3 is the frame at the moment shot 3
+ * begins. Nothing here invents art: before a scene has been rendered there is
+ * no frame to show and this says which state it is in instead, the same rule
+ * the reference cards and the media thumbs follow.
+ *
+ * The file is opened ONCE per scene, not once per card. A four-shot scene asks
+ * for four frames of the same .mp4, and a component that read the file per
+ * thumbnail would pull a few hundred megabytes through the webview four times
+ * over. Requests are queued per file: the first one opens it, seeks to every
+ * time that is waiting — including ones that arrive while it is open — and
+ * hands each card a small JPEG data URL.
+ *
+ * As in MediaThumbnail, no FFmpeg and no WebCodecs: the <video> element already
+ * owns a hardware decoder and one still frame is all this needs. */
+
+const THUMB_WIDTH = 320;
+/** How long a seek may take before the frame it was going to draw is given up
+ * on. A seek that neither lands nor errors settles nothing, and awaiting it
+ * would leave every card behind it in the queue spinning for the life of the
+ * panel. */
+const SEEK_LIMIT_MS = 4_000;
+/** How far INTO a shot its picture is taken from. The frame exactly on a cut is
+ * the first frame of the shot, which on a fade-in is a black rectangle — and a
+ * black card reads as a broken thumbnail rather than as a shot that opens
+ * dark. A quarter of a second is inside every shot there can be, because cuts
+ * move in half-second steps (`STEP_SECONDS`), and is still the shot's own
+ * picture rather than the one before it. */
+const POSTER_OFFSET_SECONDS = 0.25;
+/** Small JPEGs, but not free. Bounded like MediaThumbnail's own cache. */
+const CACHE_LIMIT = 96;
+
+/** Drawn frames, keyed by file and time. */
+const POSTERS = new Map<string, string>();
+/** Files that opened and would not give up a picture, so the next card does not
+ * read the whole thing again for the same silence. */
+const UNREADABLE = new Set<string>();
+/** Files there is nothing to read — the browser preview has no project folder.
+ * Kept apart from UNREADABLE because that is not a failure to report. */
+const ABSENT = new Set<string>();
+
+interface Waiting {
+ seconds: number;
+ settle: (result: PosterResult) => void;
+}
+
+/** Requests still waiting on a file, and the files currently open. */
+const QUEUES = new Map<string, Waiting[]>();
+const OPEN = new Set<string>();
+
+/** A drawn frame, or the reason there is none. `failed` separates "this file
+ * could not be previewed", which is worth a warning, from "there is no file to
+ * read here", which is not. */
+export interface PosterResult {
+ poster: string | null;
+ failed: boolean;
+}
+
+const NOTHING: PosterResult = { poster: null, failed: false };
+const BROKEN: PosterResult = { poster: null, failed: true };
+
+const fileKey = (folderPath: string, relativePath: string) => `${folderPath}::${relativePath}`;
+const posterKey = (file: string, seconds: number) => `${file}@${seconds.toFixed(2)}`;
+
+function remember(key: string, poster: string) {
+ if (POSTERS.size >= CACHE_LIMIT) {
+ const oldest = POSTERS.keys().next().value;
+ if (oldest !== undefined) POSTERS.delete(oldest);
+ }
+ POSTERS.set(key, poster);
+}
+
+const settled = (element: HTMLMediaElement, event: string) =>
+ new Promise<void>((resolve, reject) => {
+ element.addEventListener(event, () => resolve(), { once: true });
+ element.addEventListener("error", () => reject(new Error("This file could not be decoded.")), { once: true });
+ });
+
+const orGiveUp = (promise: Promise<void>, limitMs: number) =>
+ new Promise<void>((resolve) => {
+ const timer = setTimeout(resolve, limitMs);
+ const done = () => { clearTimeout(timer); resolve(); };
+ promise.then(done, done);
+ });
+
+/* Drawing is the part that can fail on its own — a computer with no 2D canvas,
+ a frame the decoder will not hand over — and it must not take the rest of the
+ queue down with it. */
+function tryDraw(video: HTMLVideoElement): string | null {
+ try {
+ const { videoWidth: width, videoHeight: height } = video;
+ if (!width || !height) return null;
+ const canvas = document.createElement("canvas");
+ const scale = Math.min(1, THUMB_WIDTH / width);
+ canvas.width = Math.max(1, Math.round(width * scale));
+ canvas.height = Math.max(1, Math.round(height * scale));
+ const context = canvas.getContext("2d");
+ if (!context) return null;
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
+ return canvas.toDataURL("image/jpeg", 0.72);
+ } catch {
+ return null;
+ }
+}
+
+/* Hand the file back: the decoder and the whole blob go with it. */
+const release = (element: HTMLMediaElement) => {
+ try {
+ element.removeAttribute("src");
+ element.load();
+ } catch {
+ /* nothing to do about it */
+ }
+};
+
+/** The answer for a file nothing more can be read from, given to everyone still
+ * waiting on it. */
+function abandon(file: string, result: PosterResult) {
+ const queue = QUEUES.get(file);
+ QUEUES.delete(file);
+ queue?.forEach((waiting) => waiting.settle(result));
+}
+
+async function drain(folderPath: string, relativePath: string, file: string): Promise<void> {
+ const video = document.createElement("video");
+ let url: string | null = null;
+ try {
+ url = await readMediaFileUrl(folderPath, { relativePath }, "video/mp4");
+ // Browser preview: there is no project folder, so there is nothing to show
+ // and nothing has gone wrong.
+ if (!url) {
+ ABSENT.add(file);
+ abandon(file, NOTHING);
+ return;
+ }
+ video.muted = true;
+ video.preload = "auto";
+ video.playsInline = true;
+ video.src = url;
+ await settled(video, "loadeddata");
+ /* Drained rather than iterated: a card that mounts while the file is open
+ joins this same pass instead of opening it a second time. */
+ for (;;) {
+ const next = QUEUES.get(file)?.shift();
+ if (!next) break;
+ const key = posterKey(file, next.seconds);
+ const already = POSTERS.get(key);
+ if (already) {
+ next.settle({ poster: already, failed: false });
+ continue;
+ }
+ /* The last frame is not a valid seek target in every container, and a
+ shot that starts exactly at the end of the scene would ask for it. */
+ const end = Number.isFinite(video.duration) ? Math.max(0, video.duration - 0.05) : next.seconds;
+ const target = Math.min(Math.max(next.seconds, 0), end);
+ if (Math.abs(video.currentTime - target) > 0.01) {
+ const seek = settled(video, "seeked");
+ video.currentTime = target;
+ // A seek that fails costs this frame its offset and nothing else —
+ // whatever the decoder is holding is still a frame of this scene.
+ await orGiveUp(seek, SEEK_LIMIT_MS);
+ }
+ const poster = tryDraw(video);
+ if (poster) {
+ remember(key, poster);
+ next.settle({ poster, failed: false });
+ } else {
+ next.settle(BROKEN);
+ }
+ }
+ } catch {
+ UNREADABLE.add(file);
+ abandon(file, BROKEN);
+ } finally {
+ release(video);
+ if (url) URL.revokeObjectURL(url);
+ OPEN.delete(file);
+ /* Anything that arrived while the file was being handed back. Re-opening is
+ the only way to serve it, and it cannot loop: the pass above empties the
+ queue before it ever reaches here. */
+ const left = QUEUES.get(file);
+ if (left && left.length > 0) {
+ if (UNREADABLE.has(file)) abandon(file, BROKEN);
+ else if (ABSENT.has(file)) abandon(file, NOTHING);
+ else {
+ OPEN.add(file);
+ void drain(folderPath, relativePath, file);
+ }
+ } else {
+ QUEUES.delete(file);
+ }
+ }
+}
+
+/** The frame at `seconds` into the scene's video file. Exported for tests. */
+export function shotPoster(folderPath: string, relativePath: string, seconds: number): Promise<PosterResult> {
+ const file = fileKey(folderPath, relativePath);
+ const cached = POSTERS.get(posterKey(file, seconds));
+ if (cached) return Promise.resolve({ poster: cached, failed: false });
+ if (UNREADABLE.has(file)) return Promise.resolve(BROKEN);
+ if (ABSENT.has(file)) return Promise.resolve(NOTHING);
+ return new Promise<PosterResult>((settle) => {
+ const queue = QUEUES.get(file) ?? [];
+ queue.push({ seconds, settle });
+ QUEUES.set(file, queue);
+ if (!OPEN.has(file)) {
+ OPEN.add(file);
+ void drain(folderPath, relativePath, file);
+ }
+ });
+}
+
+/** What a card says when there is no frame. Every one of these is a state of
+ * the scene the user can see and act on, never a shrug. */
+function placeholder(job: GenerationJob, failed: boolean): { icon: ReactNode; word: string } {
+ switch (job.status) {
+ case "generating": return { icon: <LoaderCircle size={18} className="spin" />, word: `Rendering ${Math.round(job.progress * 100)}%` };
+ case "queued": return { icon: <Clock3 size={18} />, word: "Waiting to render" };
+ case "ready": return { icon: <LoaderCircle size={18} className="spin" />, word: "Saving the file" };
+ case "failed": return { icon: <TriangleAlert size={18} />, word: "Didn’t finish" };
+ case "cancelled": return { icon: <Ban size={18} />, word: "Cancelled" };
+ case "completed": return job.outputRelativePath
+ ? failed
+ ? { icon: <TriangleAlert size={18} />, word: "No preview" }
+ : { icon: <Film size={18} />, word: "Opening the file…" }
+ : { icon: <TriangleAlert size={18} />, word: "No file saved" };
+ default: return { icon: <Film size={18} />, word: "Not rendered yet" };
+ }
+}
+
+export function ShotThumbnail({ folderPath, job, seconds, shotNumber }: {
+ folderPath: string;
+ /** The scene this shot belongs to: it owns the file and the status. */
+ job: GenerationJob;
+ /** Where the shot starts, in seconds from the head of the scene. */
+ seconds: number;
+ shotNumber: number;
+}) {
+ const relativePath = job.status === "completed" ? job.outputRelativePath : null;
+ const at = seconds + POSTER_OFFSET_SECONDS;
+ const [result, setResult] = useState<PosterResult>(() =>
+ relativePath ? { poster: POSTERS.get(posterKey(fileKey(folderPath, relativePath), at)) ?? null, failed: false } : NOTHING);
+
+ useEffect(() => {
+ if (!relativePath) {
+ setResult(NOTHING);
+ return;
+ }
+ let live = true;
+ void shotPoster(folderPath, relativePath, at).then((value) => { if (live) setResult(value); });
+ return () => { live = false; };
+ }, [folderPath, relativePath, at]);
+
+ if (result.poster) {
+ return <span className="shot-thumb shot-thumb--poster">
+ <img src={result.poster} alt={`Shot ${shotNumber} of ${job.title}`} loading="lazy" />
+ </span>;
+ }
+ const { icon, word } = placeholder(job, result.failed);
+ return <span className={`shot-thumb shot-thumb--${job.status}`} role="img" aria-label={`Shot ${shotNumber} — ${word}`}>
+ {icon}
+ <em>{word}</em>
+ </span>;
+}
diff --git a/src/components/workspace/sceneStatus.tsx b/src/components/workspace/sceneStatus.tsx
new file mode 100644
index 0000000..1bcd2f1
--- /dev/null
+++ b/src/components/workspace/sceneStatus.tsx
@@ -0,0 +1,84 @@
+import { AlertCircle, Ban, Check, Clock3, LoaderCircle } from "lucide-react";
+import { sceneDurationSeconds, sceneShots, type GenerationJob } from "../../lib/project";
+
+/* What a scene's status is CALLED, in one place.
+ *
+ * The board, the scene line and the inspector all say where a scene is, and
+ * three copies of the same switch is how two of them end up disagreeing — a
+ * card reading "cancelled" beside a badge still reading "in queue" is exactly
+ * the bug this file exists to make impossible. */
+
+export type JobStatus = GenerationJob["status"];
+
+export const STATUS_BADGE: Record<JobStatus, string> = {
+ draft: "DRAFT",
+ queued: "IN QUEUE",
+ generating: "RENDERING",
+ ready: "SAVING",
+ completed: "FINISHED",
+ failed: "FAILED",
+ cancelled: "CANCELLED",
+};
+
+export const STATUS_WORD: Record<JobStatus, string> = {
+ draft: "Saved as a draft",
+ queued: "Waiting to render",
+ generating: "Rendering now",
+ ready: "Saving the video file",
+ completed: "Finished",
+ failed: "Stopped by an error",
+ cancelled: "Stopped by you",
+};
+
+/* Encoding turns the same spinner as rendering: it is the app working, not the
+ app waiting, and a tick beside "saving" would say it was already done. */
+export const statusIcon = (status: JobStatus, size = 16) =>
+ status === "generating" || status === "ready" ? <LoaderCircle size={size} />
+ : status === "completed" ? <Check size={size} />
+ : status === "failed" ? <AlertCircle size={size} />
+ : status === "cancelled" ? <Ban size={size} />
+ : <Clock3 size={size} />;
+
+/** The shape of a scene — how long it runs and how many shots it is cut into. */
+export const sceneShape = (job: GenerationJob) => {
+ const shots = sceneShots(job).length;
+ return `${sceneDurationSeconds(job).toFixed(1)}s · ${shots === 1 ? "1 shot" : `${shots} shots`}`;
+};
+
+/** One line about where a scene is, for the line that separates it from the
+ * next one. */
+export const sceneLine = (job: GenerationJob) => {
+ switch (job.status) {
+ case "generating": return `Rendering · ${Math.round(job.progress * 100)}% · ${sceneShape(job)}`;
+ case "queued": return `Waiting its turn · ${sceneShape(job)}`;
+ case "draft": return `Draft — ${sceneShape(job)}`;
+ case "ready": return `Saving the video file · ${Math.round(job.progress * 100)}%`;
+ case "completed": return job.outputRelativePath ? `Ready to use · ${sceneShape(job)}` : "Finished with no file";
+ case "failed": return "Didn’t finish";
+ case "cancelled": return "Cancelled";
+ }
+};
+
+export const progressTitle = (job: GenerationJob) => {
+ switch (job.status) {
+ case "generating": return `${Math.round(job.progress * 100)}% rendered`;
+ case "queued": return "Waiting to start";
+ case "draft": return "Draft saved";
+ case "ready": return "Saving the video file";
+ case "completed": return job.outputRelativePath ? "Ready for your edit" : "Finished with no file";
+ case "failed": return "Didn’t finish";
+ case "cancelled": return "Generation stopped";
+ }
+};
+
+export const stageCopy = (job: GenerationJob) => {
+ switch (job.status) {
+ case "generating": return "The video engine is building the motion and the sound.";
+ case "queued": return "Waiting for the scene ahead of it to finish.";
+ case "draft": return "Saved with your project. Nothing has been rendered yet.";
+ case "ready": return "The pictures are rendered. They are being encoded into a video file in your project folder.";
+ case "completed": return job.outputRelativePath ? "Saved in your project and ready to drop into the timeline." : "This run ended without saving a video file.";
+ case "failed": return "The run stopped before it finished. You can try it again.";
+ case "cancelled": return "You stopped this one. You can run it again.";
+ }
+};
diff --git a/src/styles/generator.css b/src/styles/generator.css
index 8ff67d4..015137f 100644
--- a/src/styles/generator.css
+++ b/src/styles/generator.css
@@ -1,5 +1,6 @@
/* ============================================================================
- generator.css — the Generator screen: shot queue, composer, job detail.
+ generator.css — the Generator screen: a board of shot cards, and the panel
+ that edits whatever is open on it.
Legibility contract: body copy is --text-base, the smallest text anywhere is
--text-2xs (12px) and only for mono micro-labels, every interactive element
@@ -10,334 +11,243 @@
height: 100%;
min-height: 0;
display: grid;
- grid-template-columns: 320px minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr) 380px;
background: var(--bg);
}
-/* --- Queue rail ------------------------------------------------------------ */
-
-.queue-panel {
- min-width: 0;
- min-height: 0;
- display: flex;
- flex-direction: column;
- border-right: 1px solid var(--line);
- background: var(--panel);
+/* Nothing to inspect until there is a scene, so the board takes the width. */
+.generator-view--empty {
+ grid-template-columns: minmax(0, 1fr);
}
+/* --- The runtime pill -------------------------------------------------------
+ The user's single source of truth about whether a scene can be generated at
+ all. It used to sit at the foot of the scene rail; with the rail gone it sits
+ beside the button it governs.
+ ========================================================================== */
-.queue-panel__title {
- min-height: var(--topbar-height);
- flex: 0 0 auto;
- display: flex;
+.generator-runtime {
+ display: inline-flex;
align-items: center;
- justify-content: space-between;
gap: var(--space-2);
- padding: var(--space-3) var(--space-4);
- border-bottom: 1px solid var(--line);
-}
-
-/* The name over its count, with the new-shot button beside the pair. */
-.queue-panel__title > div {
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: var(--space-1);
+ min-height: var(--control-sm);
+ padding: 0 var(--space-3);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-pill);
+ color: var(--text-muted);
+ background: var(--panel);
+ font-size: var(--text-xs);
+ font-weight: var(--weight-medium);
+ line-height: var(--leading-snug);
}
-.queue-panel__new {
- width: var(--space-6);
- height: var(--space-6);
+.generator-runtime i {
+ width: 8px;
+ height: 8px;
flex: 0 0 auto;
- display: grid;
- place-items: center;
- padding: 0;
- border: 1px solid var(--line);
- border-radius: var(--radius-sm);
- color: var(--text-secondary);
- background: var(--panel-2);
+ border-radius: 50%;
+ background: currentColor;
}
-.queue-panel__new:hover {
- color: var(--text-primary);
- border-color: var(--accent-bright);
- background: var(--accent-soft);
+.generator-runtime--ready {
+ border-color: var(--success-line);
+ color: var(--success);
+ background: var(--success-soft);
}
-.queue-panel__title span {
- color: var(--text-primary);
- font-size: var(--text-md);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- letter-spacing: var(--tracking-tight);
+.generator-runtime--demo {
+ border-color: var(--warning-line);
+ color: var(--warning);
+ background: var(--warning-soft);
}
-.queue-panel__title b {
- color: var(--text-muted);
- font-size: var(--text-xs);
- font-weight: var(--weight-regular);
- line-height: var(--leading-snug);
+.generator-runtime--runtimeMissing,
+.generator-runtime--modelsMissing,
+.generator-runtime--incompatible {
+ border-color: var(--danger-line);
+ color: var(--danger);
+ background: color-mix(in srgb, var(--danger) 10%, transparent);
}
-.queue-panel__scroll {
- flex: 1 1 auto;
+/* --- The board column ------------------------------------------------------ */
+
+.generator-main {
+ min-width: 0;
min-height: 0;
overflow-y: auto;
- padding-bottom: var(--space-3);
+ padding: var(--space-6) var(--space-7) var(--space-8);
+}
+
+.generator-heading {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-end;
+ gap: var(--space-5);
+ max-width: var(--content-max);
+ margin: 0 auto var(--space-5);
+}
+
+.generator-heading__title h1 {
+ margin: var(--space-2) 0 var(--space-1);
+ font-size: var(--text-2xl);
+ font-weight: var(--weight-semibold);
+ line-height: var(--leading-tight);
+ letter-spacing: var(--tracking-hero);
}
-.queue-empty {
- margin: var(--space-5) var(--space-4);
+.generator-heading__title p {
+ margin: 0;
color: var(--text-muted);
font-size: var(--text-sm);
- line-height: var(--leading-normal);
+ line-height: var(--leading-snug);
}
-.queue-group {
- padding: var(--space-4) var(--space-3) 0;
+.generator-heading__actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-3);
}
-/* Not a heading: the rail precedes the page <h1> in the DOM, so these are
- labelled groups. See QueueGroup in GeneratorView.tsx. */
-.queue-group__label {
+/* --- The board -------------------------------------------------------------
+
+ Every scene in the project, each one a row of shot cards reading left to
+ right in the order they play, with the scene's own line drawn between one
+ row and the next.
+ ========================================================================== */
+
+.scene-board {
+ max-width: var(--content-max);
+ margin: 0 auto;
display: flex;
- align-items: center;
- justify-content: space-between;
- gap: var(--space-2);
- min-height: var(--space-5);
- margin: 0 var(--space-1) var(--space-2);
- color: var(--text-secondary);
- font-size: var(--text-xs);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- letter-spacing: 0;
- text-transform: none;
+ flex-direction: column;
+ gap: var(--space-6);
+ padding-bottom: var(--space-6);
}
-.queue-group__label span {
- min-width: var(--space-5);
- padding: 0 var(--space-2);
- border-radius: var(--radius-pill);
- color: var(--text-muted);
- background: var(--panel-3);
- font: var(--weight-medium) var(--text-2xs) / var(--space-5) var(--font-mono);
- text-align: center;
+.scene-section {
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-3);
}
-.queue-group > button {
- width: 100%;
- min-height: 68px;
- display: grid;
- grid-template-columns: 48px minmax(0, 1fr) 18px;
+/* --- The scene line ---------------------------------------------------------
+ The rule that separates one scene's shots from the next one's, and the only
+ way into the scene's own settings. */
+
+.scene-rule {
+ display: flex;
align-items: center;
gap: var(--space-3);
- margin-bottom: var(--space-2);
- padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
+}
+
+.scene-rule__open {
+ min-width: 0;
+ min-height: var(--control-sm);
+ display: flex;
+ align-items: center;
+ gap: var(--space-3);
+ padding: var(--space-2) var(--space-3);
border: 1px solid transparent;
border-radius: var(--radius-md);
+ color: inherit;
+ background: none;
text-align: left;
- color: var(--text-muted);
- background: transparent;
- transition: 0.16s ease;
}
-.queue-group > button:hover {
- border-color: var(--line);
- background: var(--panel-2);
+.scene-rule__open:hover {
+ border-color: var(--line-strong);
+ background: var(--panel);
}
-.queue-group > button.selected {
- border-color: var(--accent-line);
+.scene-rule__open--open {
+ border-color: var(--accent);
background: var(--accent-soft);
}
-.queue-group > button.selected b {
- color: var(--text-primary);
-}
-
-.queue-thumb {
- width: 48px;
- height: 48px;
+.scene-rule__status {
+ width: var(--space-6);
+ height: var(--space-6);
+ flex: 0 0 auto;
display: grid;
place-items: center;
- border-radius: var(--radius-md);
+ border-radius: var(--radius-sm);
color: var(--accent-bright);
- background: color-mix(in srgb, var(--accent) 20%, var(--panel-3));
+ background: color-mix(in srgb, var(--accent) 22%, var(--panel-3));
}
-.queue-thumb--generating svg {
+.scene-rule__status--generating svg,
+.scene-rule__status--ready svg {
animation: spin 1.4s linear infinite;
}
-.queue-thumb--completed,
-.queue-thumb--ready {
+.scene-rule__status--completed,
+.scene-rule__status--ready {
color: var(--success);
background: color-mix(in srgb, var(--success) 16%, var(--panel-3));
}
-.queue-thumb--failed,
-.queue-thumb--cancelled {
+.scene-rule__status--failed,
+.scene-rule__status--cancelled {
color: var(--danger);
background: color-mix(in srgb, var(--danger) 16%, var(--panel-3));
}
-.queue-thumb--draft {
+.scene-rule__status--draft {
color: var(--text-muted);
background: var(--panel-3);
}
-.queue-row__text {
+.scene-rule__text {
min-width: 0;
+ display: flex;
+ flex-direction: column;
}
-.queue-group button b,
-.queue-group button small {
- display: block;
+.scene-rule__text b {
overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-.queue-group button b {
- color: var(--text-secondary);
- font-size: var(--text-base);
+ color: var(--text-primary);
+ font-size: var(--text-md);
font-weight: var(--weight-semibold);
line-height: var(--leading-snug);
+ letter-spacing: var(--tracking-tight);
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
-.queue-group button small {
- margin-top: var(--space-1);
+.scene-rule__text small {
color: var(--text-muted);
font-size: var(--text-xs);
line-height: var(--leading-snug);
}
-.queue-group button .mini-progress {
- height: 6px;
- margin-top: var(--space-2);
- background: var(--panel-3);
-}
-
-.queue-group > button > svg {
- color: var(--text-faint);
-}
-
-/* The runtime pill is the user's single source of truth about whether a shot
- can actually be rendered, so it stays pinned to the bottom of the rail. */
-
-.queue-runtime {
- position: sticky;
- bottom: 0;
+.scene-rule__badge {
flex: 0 0 auto;
- margin: 0;
- padding: var(--space-4);
- border-top: 1px solid var(--line);
- background: var(--panel-2);
+ color: var(--text-muted);
+ font: var(--weight-semibold) var(--text-2xs) / var(--leading-snug) var(--font-mono);
+ letter-spacing: var(--tracking-label);
}
-.queue-runtime__state {
- display: flex;
+.scene-rule__settings {
+ flex: 0 0 auto;
+ display: inline-flex;
align-items: center;
gap: var(--space-2);
- color: var(--text-primary);
- font-size: var(--text-base);
+ color: var(--text-muted);
+ font-size: var(--text-xs);
font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-.queue-runtime__state i {
- width: 10px;
- height: 10px;
- flex: 0 0 auto;
- border-radius: 50%;
- background: var(--text-muted);
-}
-
-.queue-runtime--ready {
- border-top-color: color-mix(in srgb, var(--success) 35%, transparent);
-}
-
-.queue-runtime--ready .queue-runtime__state {
- color: var(--success);
-}
-
-.queue-runtime--ready .queue-runtime__state i {
- background: var(--success);
- box-shadow: 0 0 8px color-mix(in srgb, var(--success) 60%, transparent);
-}
-
-.queue-runtime--demo {
- border-top-color: color-mix(in srgb, var(--warning) 35%, transparent);
-}
-
-.queue-runtime--demo .queue-runtime__state {
- color: var(--warning);
-}
-
-.queue-runtime--demo .queue-runtime__state i {
- background: var(--warning);
-}
-
-.queue-runtime--runtimeMissing,
-.queue-runtime--modelsMissing,
-.queue-runtime--incompatible {
- border-top-color: color-mix(in srgb, var(--danger) 35%, transparent);
-}
-
-.queue-runtime--runtimeMissing .queue-runtime__state,
-.queue-runtime--modelsMissing .queue-runtime__state,
-.queue-runtime--incompatible .queue-runtime__state {
- color: var(--danger);
-}
-
-.queue-runtime--runtimeMissing .queue-runtime__state i,
-.queue-runtime--modelsMissing .queue-runtime__state i,
-.queue-runtime--incompatible .queue-runtime__state i {
- background: var(--danger);
-}
-
-.queue-runtime--checking .queue-runtime__state {
- color: var(--text-secondary);
-}
-
-/* --- Main column ----------------------------------------------------------- */
-
-.generator-main {
- min-width: 0;
- min-height: 0;
- overflow-y: auto;
- padding: var(--space-6) var(--space-7) var(--space-8);
-}
-
-.generator-heading {
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- gap: var(--space-5);
- max-width: var(--content-max);
- margin: 0 auto var(--space-5);
}
-.generator-heading h1 {
- margin: var(--space-2) 0 var(--space-2);
- font-size: var(--text-2xl);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-tight);
- letter-spacing: var(--tracking-hero);
+.scene-rule__open:hover .scene-rule__settings,
+.scene-rule__open--open .scene-rule__settings {
+ color: var(--accent-bright);
}
-/* --- The scene editor ------------------------------------------------------
-
- The main control on this screen. The lines the user writes are the largest
- thing in it; everything else — the bar, the settings, the reference chips —
- sits around them without competing for the eye.
- ========================================================================== */
-
-.scene-editor {
- display: flex;
- flex-direction: column;
- gap: var(--space-4);
+/* The line itself: what actually separates one scene from the next. */
+.scene-rule__line {
+ flex: 1 1 auto;
+ height: 1px;
+ background: var(--line-strong);
}
-
/* --- Length, and the bar the scene is split on ----------------------------- */
.scene-bar {
@@ -412,10 +322,6 @@
border-left: 1px solid var(--line-strong);
}
-.scene-bar__shot--active {
- background: var(--accent-soft);
-}
-
.scene-bar__label {
flex: 1 1 auto;
min-width: 0;
@@ -485,34 +391,56 @@
cursor: default;
}
-/* --- The shots ------------------------------------------------------------- */
+/* --- One shot, as a card ----------------------------------------------------
-.shot-list {
- display: flex;
- flex-direction: column;
+ The card is a SUMMARY and a target: a picture, the line, the settings. It
+ carries no control of its own, because a card that both opens a shot and
+ changes it is a card you cannot click.
+ ========================================================================== */
+
+.shot-grid {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
gap: var(--space-3);
margin: 0;
padding: 0;
list-style: none;
}
+.shot-grid > li {
+ min-width: 0;
+ display: flex;
+}
+
.shot-card {
- padding: var(--space-4);
+ width: 100%;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-2);
+ padding: var(--space-3);
border: 1px solid var(--line);
border-radius: var(--radius-lg);
+ color: inherit;
background: var(--panel);
+ text-align: left;
+}
+
+.shot-card:hover {
+ border-color: var(--line-hover);
+ background: var(--panel-2);
}
-.shot-card--focused {
+.shot-card--open {
border-color: var(--accent);
+ background: var(--accent-soft);
}
.shot-card__head {
display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: var(--space-3);
- margin-bottom: var(--space-3);
+ align-items: baseline;
+ justify-content: space-between;
+ gap: var(--space-2);
}
.shot-card__head > b {
@@ -522,6 +450,148 @@
line-height: var(--leading-snug);
}
+.shot-card__head > em {
+ color: var(--text-faint);
+ font-family: var(--font-mono);
+ font-size: var(--text-2xs);
+ font-style: normal;
+}
+
+/* Three lines of the shot's own words. Clamped rather than scrolled: the whole
+ line is one click away in the panel, and a card that scrolls is a card that
+ eats the gesture meant to open it. */
+.shot-card__line {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
+ line-clamp: 3;
+ overflow: hidden;
+ min-height: calc(3 * var(--text-sm) * var(--leading-normal));
+ color: var(--text-secondary);
+ font-size: var(--text-sm);
+ line-height: var(--leading-normal);
+}
+
+.shot-card__line--empty {
+ color: var(--text-faint);
+ font-style: italic;
+}
+
+/* A cited reference reads as the thing it points at, not as the token that
+ stores it — the same promise the field makes with "[Reference N]". */
+.shot-card__ref {
+ color: var(--accent-bright);
+ font-style: normal;
+ font-weight: var(--weight-semibold);
+}
+
+.shot-card__tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-1);
+}
+
+.shot-card__tag {
+ padding: 2px var(--space-2);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-pill);
+ color: var(--text-secondary);
+ background: var(--panel-2);
+ font-size: var(--text-2xs);
+ font-style: normal;
+ line-height: 1.6;
+}
+
+.shot-card__tag--none {
+ border-color: transparent;
+ background: none;
+ color: var(--text-faint);
+}
+
+/* The one card that is a control: it adds the next shot to this scene. Drawn
+ as an outline so it never reads as a shot that already exists. */
+.shot-card--add {
+ min-height: 100%;
+ align-items: center;
+ justify-content: center;
+ gap: var(--space-2);
+ border-style: dashed;
+ color: var(--text-muted);
+ background: none;
+}
+
+.shot-card--add:hover {
+ border-color: var(--accent-bright);
+ color: var(--accent-bright);
+ background: var(--accent-soft);
+}
+
+.shot-card--add span {
+ font-size: var(--text-sm);
+ font-weight: var(--weight-semibold);
+}
+
+/* --- The frame a card shows -------------------------------------------------
+
+ A real frame of the shot once the scene has been rendered, and nothing
+ invented before that: the placeholder says which state the scene is in
+ instead. Same rule as the media thumb and the reference card.
+ ========================================================================== */
+
+.shot-thumb {
+ position: relative;
+ aspect-ratio: 16 / 9;
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: var(--space-1);
+ overflow: hidden;
+ border-radius: var(--radius-md);
+ color: var(--text-muted);
+ background-color: var(--panel-3);
+ background-image: repeating-linear-gradient(
+ 135deg,
+ var(--hatch) 0 6px,
+ transparent 6px 12px
+ );
+}
+
+.shot-thumb img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.shot-thumb--poster {
+ background-image: none;
+}
+
+.shot-thumb em {
+ padding: 0 var(--space-2);
+ color: inherit;
+ font-size: var(--text-2xs);
+ font-style: normal;
+ text-align: center;
+}
+
+.shot-thumb--generating,
+.shot-thumb--ready {
+ color: var(--accent-bright);
+}
+
+.shot-thumb--failed,
+.shot-thumb--cancelled {
+ color: var(--danger);
+}
+
+.shot-thumb .spin {
+ animation: spin 1.4s linear infinite;
+}
+
+/* --- The controls a shot's panel is made of -------------------------------- */
+
.shot-card__start {
display: flex;
align-items: center;
@@ -889,16 +959,6 @@
line-height: var(--leading-normal);
}
-.scene-editor__add {
- align-self: flex-start;
-}
-
-/* The placeholder moved into the status column when the scene editor took the
- main one, so it sits between two bordered blocks rather than leading a page. */
-.job-detail__info .generation-preview {
- min-height: 148px;
- margin: var(--space-4) 0;
-}
/* --- The compiled prompt --------------------------------------------------- */
@@ -991,162 +1051,119 @@
line-height: var(--leading-snug);
}
-/* Read-only facts about how every shot is made — deliberately not buttons,
- because none of these values can be changed from here yet. */
+/* --- The panel -------------------------------------------------------------
-.generation-settings {
+ One shot, or one scene. Which one is showing is decided by what was clicked
+ on the board, and the two never appear at once: a screen that edits a shot
+ and its scene side by side is a screen where nobody knows which "length"
+ they are looking at.
+ ========================================================================== */
+
+.generator-panel {
+ min-width: 0;
+ min-height: 0;
display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: var(--space-2) var(--space-3);
+ flex-direction: column;
+ border-left: 1px solid var(--line);
+ background: var(--panel);
}
-.generation-settings__lead {
- color: var(--text-muted);
- font-size: var(--text-sm);
- line-height: var(--leading-snug);
+.panel-head {
+ flex: 0 0 auto;
+ padding: var(--space-5);
+ border-bottom: 1px solid var(--line);
}
-.setting-chip {
- display: inline-flex;
- flex-direction: column;
- gap: 2px;
- padding: var(--space-2) var(--space-3);
- border: 1px solid var(--line);
- border-radius: var(--radius-md);
- background: var(--panel);
+.panel-head h2 {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: var(--space-2);
+ margin: 0;
+ color: var(--text-primary);
+ font-size: var(--text-lg);
+ font-weight: var(--weight-semibold);
+ line-height: var(--leading-snug);
+ letter-spacing: var(--tracking-tight);
}
-.setting-chip em {
+.panel-head h2 small {
color: var(--text-muted);
- font: var(--weight-medium) var(--text-2xs) / var(--leading-snug) var(--font-mono);
- font-style: normal;
- letter-spacing: var(--tracking-label);
- text-transform: uppercase;
+ font-size: var(--text-xs);
+ font-weight: var(--weight-regular);
+ letter-spacing: 0;
}
-.setting-chip b {
- color: var(--text-secondary);
- font-size: var(--text-sm);
+/* The way back up to the scene, which is the same place its line on the board
+ opens — so a shot is never a dead end. */
+.panel-head__up {
+ display: block;
+ max-width: 100%;
+ margin-bottom: var(--space-2);
+ padding: 0;
+ overflow: hidden;
+ border: 0;
+ border-radius: var(--radius-xs);
+ color: var(--accent-bright);
+ background: none;
+ font-size: var(--text-xs);
font-weight: var(--weight-semibold);
line-height: var(--leading-snug);
+ text-align: left;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
-/* --- Job detail ------------------------------------------------------------ */
-
-.job-detail {
- max-width: var(--content-max);
- margin: 0 auto;
- display: grid;
- grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
- overflow: hidden;
- border: 1px solid var(--line);
- border-radius: var(--radius-xl);
- background: var(--panel);
+.panel-head__up:hover {
+ text-decoration: underline;
}
-.job-detail__visual {
- min-width: 0;
- padding: var(--space-5);
- border-right: 1px solid var(--line);
+/* The scene panel keeps the title block it always had; in the shot panel the
+ heading is the shot number itself. */
+.panel-head .job-title {
+ padding-bottom: 0;
+ border-bottom: 0;
}
-/* Same rule as the scene thumb, the media thumb and the reference card: a
- labelled placeholder, never invented art. PolStudio cannot display a
- rendered frame yet, so this surface must never imply one exists. The state
- chip and the caption below it are the only content. */
+/* --- One shot, opened -------------------------------------------------------
+ The panel is a single column, so the pieces a shot is made of stack rather
+ than sitting inside a card of their own. */
-.generation-preview {
- position: relative;
- min-height: 200px;
+.shot-inspector {
display: flex;
flex-direction: column;
- align-items: center;
- justify-content: center;
gap: var(--space-3);
- padding: var(--space-5);
- overflow: hidden;
- text-align: center;
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-lg);
- background-color: var(--panel-3);
- background-image: repeating-linear-gradient(
- 135deg,
- var(--hatch) 0 6px,
- transparent 6px 12px
- );
-}
-
-/* Activity indicator only, and only while rendering — a soft band travelling
- over the hatch, never anything that could be mistaken for picture. */
-
-.generation-scanner {
- position: absolute;
- inset: -40% 0 auto;
- height: 40%;
- background: linear-gradient(transparent, color-mix(in srgb, var(--accent-bright) 14%, transparent), transparent);
- animation: scan 2.5s ease-in-out infinite;
}
-.preview-status {
- position: relative;
- min-height: var(--control-sm);
- display: inline-flex;
+.shot-inspector__timing {
+ display: flex;
+ flex-wrap: wrap;
align-items: center;
gap: var(--space-2);
- padding: 0 var(--space-3);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-md);
- color: var(--text-primary);
- background: var(--panel);
- font-size: var(--text-sm);
- font-weight: var(--weight-medium);
- line-height: var(--leading-snug);
-}
-
-.preview-status svg {
- flex: 0 0 auto;
- color: var(--accent-bright);
-}
-
-.generation-preview__caption {
- position: relative;
- max-width: 48ch;
- margin: 0;
- color: var(--text-muted);
- font-size: var(--text-sm);
- line-height: var(--leading-normal);
-}
-
-.generation-preview--generating .preview-status svg {
- animation: spin 1.4s linear infinite;
-}
-
-.generation-preview--completed .preview-status svg,
-.generation-preview--ready .preview-status svg {
- color: var(--success);
}
-.generation-preview--failed .preview-status svg,
-.generation-preview--cancelled .preview-status svg {
- color: var(--danger);
+.shot-inspector__timing .shot-card__start {
+ margin-left: 0;
}
-.generation-preview--draft .preview-status svg,
-.generation-preview--queued .preview-status svg {
- color: var(--text-muted);
+.shot-inspector__timing .shot-card__remove {
+ width: auto;
+ gap: var(--space-2);
+ padding: 0 var(--space-3);
+ margin-left: auto;
+ font-size: var(--text-xs);
+ font-weight: var(--weight-semibold);
}
-@media (prefers-reduced-motion: reduce) {
- .generation-scanner {
- display: none;
- }
+.scene-inspector {
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-4);
}
-
/* --- Progress block -------------------------------------------------------- */
.job-progress-block {
- padding: var(--space-5) 0 0;
+ padding: 0;
}
.job-progress-block__head {
@@ -1243,10 +1260,17 @@
line-height: var(--leading-snug);
}
-/* --- Job info column ------------------------------------------------------- */
+/* --- The panel's scrolling middle ----------------------------------------- */
-.job-detail__info {
+.panel-scroll {
+ /* Takes what the head and the actions leave, and scrolls inside it — without
+ the grow the actions row is pushed off the bottom of the panel. */
+ flex: 1 1 auto;
min-width: 0;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-4);
padding: var(--space-5);
overflow-y: auto;
}
@@ -1500,10 +1524,17 @@
line-height: var(--leading-snug);
}
-/* --- Actions: the one obvious next step ------------------------------------ */
+/* --- Actions: the one obvious next step ------------------------------------
+
+ Pinned under the scrolling middle of the panel rather than carried along by
+ it: "Generate this scene" is the whole point of the screen and must not be
+ somewhere the user has to scroll to find. */
.job-actions {
- margin-top: var(--space-4);
+ flex: 0 0 auto;
+ padding: var(--space-4) var(--space-5);
+ border-top: 1px solid var(--line);
+ background: var(--panel);
}
.job-actions .primary-button,
@@ -1633,24 +1664,19 @@
/* --- Responsive -------------------------------------------------------------
The window can be resized down to 900px (tauri.conf.json minWidth), so the
- 320px rail + main column has to keep working the whole way down without a
- horizontal scrollbar. The rail narrows in two steps and the job detail is
- already single-column well before 1180px. */
+ board and the 380px panel have to keep working the whole way down without a
+ horizontal scrollbar. The panel narrows in two steps and then drops under the
+ board; the card grid steps from three across to two and finally to one. */
-@media (max-width: 1280px) {
- .job-detail {
- grid-template-columns: minmax(0, 1fr);
- }
-
- .job-detail__visual {
- border-right: 0;
- border-bottom: 1px solid var(--line);
+@media (max-width: 1400px) {
+ .shot-grid {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 1180px) {
.generator-view {
- grid-template-columns: 288px minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr) 340px;
}
.generator-main {
@@ -1661,20 +1687,16 @@
flex-direction: column;
align-items: flex-start;
}
-
}
@media (max-width: 1040px) {
- .generator-view {
- grid-template-columns: 256px minmax(0, 1fr);
- }
-
.generator-main {
padding: var(--space-5) var(--space-4) var(--space-7);
}
- .job-detail__visual,
- .job-detail__info {
+ .panel-head,
+ .panel-scroll,
+ .generator-panel .job-actions {
padding: var(--space-4);
}
@@ -1687,37 +1709,26 @@
}
}
+/* Under 960 the panel has nowhere left to go sideways, so it goes under the
+ board rather than squeezing the cards out of readability. */
@media (max-width: 960px) {
.generator-view {
- grid-template-columns: 228px minmax(0, 1fr);
- }
-
- .queue-panel__title,
- .queue-runtime {
- padding: var(--space-3);
- }
-
- .queue-group {
- padding-inline: var(--space-2);
+ grid-template-columns: minmax(0, 1fr);
+ grid-template-rows: minmax(0, 1fr) auto;
}
- .queue-group > button {
- grid-template-columns: 40px minmax(0, 1fr) 16px;
- gap: var(--space-2);
- padding-inline: var(--space-2);
+ .generator-panel {
+ max-height: 60vh;
+ border-left: 0;
+ border-top: 1px solid var(--line);
}
- .queue-thumb {
- width: 40px;
- height: 40px;
+ .shot-grid {
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.job-meta {
grid-template-columns: minmax(0, 1fr);
gap: var(--space-3);
}
-
- .generation-preview {
- padding: var(--space-4);
- }
-}
+}
\ No newline at end of file