AI media harness for planning, generating, and editing locally
TypeScript
Rename clips from the inspector header
Bittif7a69eba90d2
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex 4d6c8e8..a15c043 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -632,7 +632,7 @@ describe("project workspace timecode", () => {expect(droppedClip(second.onChange, unknown).durationMs).toBe(5_000);});- it("keeps the clip inspector without its two old headers", () => {+ it("uses an editable clip name as the inspector heading", () => {const config = withClip(measuredVideo(projectWithMedia(), 40_000), {});const onChange = vi.fn();const { container } = render(createElement(TimelineView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenGenerator: () => undefined }));@@ -640,11 +640,18 @@ describe("project workspace timecode", () => {expect(container.querySelector(".clip-inspector")).not.toBeNull();expect(screen.queryByText("Clip details")).toBeNull();expect(container.querySelector(".inspector-summary")).toBeNull();- expect(screen.getByRole("heading", { name: "Clip" })).not.toBeNull();+ const heading = screen.getByRole("heading", { name: "Macro footage" });+ const name = within(heading).getByRole("textbox", { name: "Clip name" });+ expect((name as HTMLInputElement).value).toBe("Macro footage");+ expect(screen.queryByRole("heading", { name: "Clip" })).toBeNull();fireEvent.change(screen.getByTitle(/^How long this clip lasts/), { target: { value: "8" } });const next = wrote(onChange.mock.calls[0][0], config);expect(next.timeline.tracks.flatMap((track) => track.clips)[0].durationMs).toBe(8_000);+ fireEvent.change(name, { target: { value: "Opening detail" } });+ expect(wrote(onChange.mock.calls.at(-1)![0], config).timeline.tracks.flatMap((track) => track.clips)[0].label).toBe("Opening detail");+ fireEvent.change(name, { target: { value: "" } });+ expect(wrote(onChange.mock.calls.at(-1)![0], config).timeline.tracks.flatMap((track) => track.clips)[0].label).toBe("Untitled clip");});/* --- Dragging clips on the timeline --------------------------------------diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsxindex 252dcda..93dc6d1 100644--- a/src/components/workspace/TimelineView.tsx+++ b/src/components/workspace/TimelineView.tsx@@ -848,8 +848,13 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {<aside className="clip-inspector" aria-label="Clip inspector">{selected ? <><section className="inspector-section">- <h3>Clip</h3>- <label><span>Name</span><input value={selected.label} onChange={(event) => updateClip(selected.id, { label: event.target.value || "Untitled clip" })} /></label>+ <h3 aria-label={selected.label}><input+ className="clip-title__name"+ value={selected.label}+ aria-label="Clip name"+ title="Rename this clip"+ onChange={(event) => updateClip(selected.id, { label: event.target.value || "Untitled clip" })}+ /></h3><div className="field-pair"><label><span>Starts at</span><input value={timecode(selected.startMs).slice(3)} readOnly /></label><label><span>Lasts</span><inputdiff --git a/src/styles/index.css b/src/styles/index.cssindex c0050b1..fa0f1f3 100644--- a/src/styles/index.css+++ b/src/styles/index.css@@ -45,7 +45,8 @@line-height: var(--leading-snug);}-:root .reference-inspector .reference-title__name {+:root .reference-inspector .reference-title__name,+:root .clip-inspector .clip-title__name {font-size: var(--text-md);font-weight: var(--weight-semibold);line-height: var(--leading-snug);diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 05a79e2..c49a772 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -730,6 +730,26 @@.inspector-section input:disabled,.inspector-section select:disabled { color: var(--text-faint); cursor: not-allowed; }+.clip-inspector .inspector-section .clip-title__name {+ width: 100%;+ min-width: 0;+ height: auto;+ 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;+}++.clip-inspector .inspector-section .clip-title__name:hover,+.clip-inspector .inspector-section .clip-title__name:focus {+ border-color: var(--accent-bright);+ background: var(--panel-2);+ outline: none;+}+.field-pair {display: grid;grid-template-columns: 1fr 1fr;