AI media harness for planning, generating, and editing locally
TypeScript
Refine shot inspector
Bitti27fb247d16e3
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 0b74fee..1793bda 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -314,11 +314,15 @@ describe("Generator scene controls", () => {const state = setup();fireEvent.click(screen.getByRole("button", { name: "Shot 2 of First scene" }));fireEvent.change(screen.getByRole("textbox", { name: "Rename shot 2" }), { target: { value: "Doorway reveal" } });+ const shotHeader = screen.getByRole("textbox", { name: "Rename shot 2" }).closest("header");+ const removeButton = within(shotHeader!).getByRole("button", { name: "Remove shot 2" });+ expect(removeButton).toHaveClass("inspector-remove-button");+ expect(removeButton).toHaveTextContent("");expect(sceneShots(state.latest().generationJobs[0])[1].name).toBe("Doorway reveal");expect(parseProjectConfig(state.latest()).generationJobs[0].shots?.[1].name).toBe("Doorway reveal");expect(screen.getByRole("button", { name: "Doorway reveal of First scene" })).toBeInTheDocument();- fireEvent.click(screen.getByRole("button", { name: "Remove shot 2" }));+ fireEvent.click(removeButton);expect(screen.getByRole("alertdialog", { name: "Remove shot?" })).toBeInTheDocument();fireEvent.click(screen.getByRole("button", { name: "Cancel" }));expect(sceneShots(state.latest().generationJobs[0])).toHaveLength(2);diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex 92e7fd4..9359276 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -1,4 +1,4 @@-import { Plus, Sparkles, Square, WandSparkles } from "lucide-react";+import { Plus, Sparkles, Square, Trash2, WandSparkles } from "lucide-react";import { invoke } from "@tauri-apps/api/core";import { useEffect, useMemo, useRef, useState } from "react";import { actionReferenceIds, compileGenerationJobPrompt, compileGenerationJobSegments, createDraftGenerationJob, danglingReferenceTokens, GENERATION_FRAME_RATE, sceneDurationSeconds, sceneGenerationReferences, sceneGenerationSeed, sceneGenerationSnapshot, sceneGenerationSteps, sceneShots, SCENE_MAX_SECONDS, SCENE_MIN_SECONDS, projectItemPath, usableImageReferences, type GenerationJob, type ProjectConfig, type ProjectReference, type PromptSegment, type SceneShot } from "../../lib/project";@@ -507,14 +507,23 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo<button type="button" className="panel-head__up" onClick={() => setSelection({ jobId: selected.id, shotId: null })}>{selected.title}</button>- <h2><input- className="shot-title__name"- value={openShot.name ?? ""}- placeholder={`Shot ${shotIndex + 1}`}- aria-label={`Rename shot ${shotIndex + 1}`}- title="Rename this shot"- onChange={(event) => patchShot(selected, openShot.id, { name: event.target.value || null })}- /></h2>+ <div className="panel-head__shot-title">+ <h2><input+ className="shot-title__name"+ value={openShot.name ?? ""}+ placeholder={`Shot ${shotIndex + 1}`}+ aria-label={`Rename shot ${shotIndex + 1}`}+ title="Rename this shot"+ onChange={(event) => patchShot(selected, openShot.id, { name: event.target.value || null })}+ /></h2>+ {selectedShots.length > 1 && <button+ type="button"+ className="inspector-remove-button"+ aria-label={`Remove shot ${shotIndex + 1}`}+ title="Remove this shot"+ onClick={() => setRemovalTarget({ kind: "shot", job: selected, shotId: openShot.id, shotName: openShot.name ?? `Shot ${shotIndex + 1}` })}+ ><Trash2 size={16} aria-hidden="true" /></button>}+ </div></header><div className="panel-scroll"><ShotInspector@@ -527,9 +536,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoduration={sceneDurationSeconds(selected)}references={config.references}disabled={false}- removable={selectedShots.length > 1}onChange={(updates) => patchShot(selected, openShot.id, updates)}- onRemove={() => setRemovalTarget({ kind: "shot", job: selected, shotId: openShot.id, shotName: openShot.name ?? `Shot ${shotIndex + 1}` })}/></div></>diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxindex ea1efc8..7293425 100644--- a/src/components/workspace/ReferencesView.test.tsx+++ b/src/components/workspace/ReferencesView.test.tsx@@ -50,7 +50,7 @@ describe("Reference type presets", () => {expect(name).toHaveValue("Hero");expect(header).not.toBeNull();- expect(within(header!).getByRole("button", { name: "Remove reference" })).toBeInTheDocument();+ expect(within(header!).getByRole("button", { name: "Remove reference" })).toHaveClass("inspector-remove-button");fireEvent.change(name, { target: { value: "Lead traveler" } });expect(state.latest().references[0].name).toBe("Lead traveler");diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex 3e704b5..3696be4 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -172,7 +172,7 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Projetitle="Rename this reference"onChange={(event) => update(selected.id, { name: event.target.value || "Untitled reference" })}/></h2>- <button onClick={remove} aria-label="Remove reference" title="Remove this reference"><Trash2 size={16} /></button>+ <button className="inspector-remove-button" onClick={remove} aria-label="Remove reference" title="Remove this reference"><Trash2 size={16} aria-hidden="true" /></button></> : <h2>Reference details</h2>}</header><div className="reference-inspector__scroll">{selected ? <>diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex 7eea3b9..e644ca7 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -1,4 +1,4 @@-import { ImagePlus, Trash2, X } from "lucide-react";+import { ImagePlus, X } from "lucide-react";import { useMemo, useRef, useState } from "react";import {actionReferenceIds,@@ -92,7 +92,7 @@ export function writeShots(job: GenerationJob, next: readonly SceneShot[], extra/** 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 }: {+export function ShotInspector({ job, shots, shot, index, endsAt, duration, references, disabled, onChange }: {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. */@@ -108,9 +108,7 @@ export function ShotInspector({ job, shots, shot, index, endsAt, duration, refer* this: the current run keeps its captured snapshot while edits prepare the* next one. */disabled: boolean;- removable: boolean;onChange: (updates: Partial<SceneShot>) => void;- onRemove: () => void;}) {const fieldRef = useRef<HTMLTextAreaElement | null>(null);const citable = useMemo(() => citableReferences(references), [references]);@@ -178,13 +176,6 @@ export function ShotInspector({ job, shots, shot, index, endsAt, duration, refer/><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><div className="shot-card__action">diff --git a/src/styles/controls.css b/src/styles/controls.cssindex 7c51c27..5159878 100644--- a/src/styles/controls.css+++ b/src/styles/controls.css@@ -141,6 +141,25 @@border-color: var(--line);}+/* Destructive icon action shared by inspector headers. */+.inspector-remove-button {+ width: var(--control-sm);+ height: var(--control-sm);+ flex: 0 0 auto;+ display: grid;+ place-items: center;+ padding: 0;+ border: 0;+ border-radius: var(--radius-xs);+ color: var(--text-muted);+ background: none;+}++.inspector-remove-button:hover:not(:disabled) {+ color: var(--danger);+ background: var(--danger-soft);+}+/* --- Search field ---------------------------------------------------------- */.search-field {diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 7624f08..0b7c335 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -780,31 +780,6 @@font-style: normal;}-.shot-card__remove {- display: inline-flex;- align-items: center;- justify-content: center;- gap: var(--space-2);- width: auto;- min-width: var(--control-sm);- height: var(--control-sm);- padding: 0 var(--space-3);- border: 1px solid var(--line);- border-radius: var(--radius-sm);- color: var(--text-muted);- background: var(--panel-2);- white-space: nowrap;-}--.shot-card__remove svg {- flex: 0 0 auto;-}--.shot-card__remove:hover:not(:disabled) {- border-color: var(--danger);- color: var(--danger);-}-/* The line itself. Biggest type on the screen after the page title, because itis the thing the whole screen exists to collect. */.shot-card__action {@@ -846,7 +821,7 @@color: var(--text-primary);background: transparent;font-family: var(--font-sans);- font-size: var(--text-base);+ font-size: var(--text-sm);line-height: var(--leading-normal);resize: vertical;}@@ -1368,6 +1343,17 @@letter-spacing: 0;}+.panel-head__shot-title {+ display: flex;+ align-items: center;+ gap: var(--space-2);+}++.panel-head__shot-title h2 {+ min-width: 0;+ flex: 1 1 auto;+}+.shot-title__name {width: 100%;min-width: 0;@@ -1445,15 +1431,6 @@margin-left: 0;}-.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);-}-.scene-inspector {display: flex;flex-direction: column;diff --git a/src/styles/references.css b/src/styles/references.cssindex f67cdab..65f9205 100644--- a/src/styles/references.css+++ b/src/styles/references.css@@ -104,24 +104,6 @@outline: none;}-.reference-inspector__head button {- width: var(--control-sm);- height: var(--control-sm);- flex: 0 0 auto;- display: grid;- place-items: center;- padding: 0;- border: 0;- border-radius: var(--radius-xs);- color: var(--text-muted);- background: none;-}--.reference-inspector__head button:hover {- color: var(--danger);- background: var(--danger-soft);-}-/* --- Reference cards ------------------------------------------------------- */.reference-grid {