Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Rename a shot from its detail panel

Bittif51357678f5f
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.ts
index 2e46804..0e2eabb 100644
--- a/src/components/ProjectWorkspace.test.ts
+++ b/src/components/ProjectWorkspace.test.ts
@@ -198,6 +198,19 @@ describe("project workspace timecode", () => {
expect(screen.getByText(/sound note/)).not.toBeNull();
});
+ it("renames a shot, and never saves it nameless", () => {
+ const config = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
+ const onChange = vi.fn();
+ render(createElement(GeneratorView, { config, folderPath: "C:\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: config.generationJobs[0].id }));
+ const field = screen.getByRole("textbox", { name: "Rename First scene" });
+ fireEvent.change(field, { target: { value: "Clay on the wheel" } });
+ expect(onChange.mock.calls[0][0].generationJobs[0].title).toBe("Clay on the wheel");
+ // The schema has no room for an empty title, so an emptied field falls back.
+ fireEvent.change(field, { target: { value: "" } });
+ expect(onChange.mock.calls[1][0].generationJobs[0].title).toBe("Untitled shot");
+ expect(parseProjectConfig(onChange.mock.calls[1][0])).toBeTruthy();
+ });
+
it("links and unlinks a reference to the selected shot", () => {
const fresh = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
const createdAt = fresh.createdAt;
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index 5215c36..5414969 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -267,7 +267,17 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
<span className={`status-icon status-icon--${selected.status}`}>{statusIcon(selected.status)}</span>
<div>
<span className="job-title__badge">{STATUS_BADGE[selected.status]}</span>
- <h2>{selected.title}</h2>
+ {/* The title is the one part of a shot 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 shot the schema would reject. */}
+ <h2><input
+ className="job-title__name"
+ value={selected.title}
+ aria-label={`Rename ${selected.title}`}
+ title="Rename this shot"
+ onChange={(event) => updateJob(selected.id, { title: event.target.value || "Untitled shot", updatedAt: new Date().toISOString() })}
+ /></h2>
</div>
</div>
diff --git a/src/styles/generator.css b/src/styles/generator.css
index 0a5f0a1..2ab16cf 100644
--- a/src/styles/generator.css
+++ b/src/styles/generator.css
@@ -761,6 +761,32 @@
letter-spacing: var(--tracking-tight);
}
+/* Reads as the heading it sits in until it is hovered or focused — the same
+ rule the track names follow. */
+.job-title__name {
+ width: 100%;
+ min-width: 0;
+ padding: 2px var(--space-1);
+ margin-left: calc(var(--space-1) * -1);
+ border: 1px solid transparent;
+ border-radius: var(--radius-sm);
+ color: inherit;
+ background: none;
+ font: inherit;
+ letter-spacing: inherit;
+ text-overflow: ellipsis;
+}
+
+.job-title__name:hover {
+ border-color: var(--line-strong);
+}
+
+.job-title__name:focus {
+ outline: none;
+ border-color: var(--accent-bright);
+ background: var(--panel-2);
+}
+
.job-prompt,
.job-runtime-note {
padding: var(--space-4) 0;