AI media harness for planning, generating, and editing locally
TypeScript
Restore clip inspector
Bitti73d32743a0b5
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex ab38071..b0d297f 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -450,6 +450,21 @@ describe("project workspace timecode", () => {expect(droppedClip(second.onChange, unknown).durationMs).toBe(5_000);});+ it("keeps the clip inspector without its two old headers", () => {+ const config = withClip(measuredVideo(projectWithMedia(), 40_000), {});+ const onChange = vi.fn();+ const { container } = render(createElement(TimelineView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenGenerator: () => undefined }));++ 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();++ 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);+ });+/* --- Dragging clips on the timeline --------------------------------------jsdom lays nothing out and has no PointerEvent, so both are supplied here:diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsxindex 47e0dd8..cc7d9da 100644--- a/src/components/workspace/TimelineView.tsx+++ b/src/components/workspace/TimelineView.tsx@@ -26,6 +26,7 @@ import { sceneShape, STATUS_WORD } from "./sceneStatus";import { ShotThumbnail } from "./ShotThumbnail";const MIN_DURATION = 10_000;+const NOT_YET = "Not available yet. This control doesn’t change your project.";/* How long a dropped clip is when the file itself cannot say.A drop normally lasts as long as the footage: the media panel decodes eachfile to draw its thumbnail and records the duration it read there (see@@ -115,6 +116,15 @@ const timecode = (ms: number) => {return `00:${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}:${String(frames).padStart(2, "0")}`;};+const parseDuration = (value: string, frameRate: number): number | null => {+ const parts = value.trim().split(":");+ if (parts.length > 3 || parts.some((part) => !/^\d+(\.\d+)?$/.test(part.trim()))) return null;+ const numbers = parts.map((part) => Number(part));+ const frames = parts.length === 3 ? numbers[2] * (1000 / frameRate) : 0;+ const seconds = parts.length === 1 ? numbers[0] : numbers[0] * 60 + numbers[1];+ return Math.round(seconds * 1000 + frames);+};+/** How a view hands a project back. An updater rather than a plain value is* the only safe form for a write built from something asynchronous: the* holder applies it to its LATEST config, so a write does not depend on the@@ -154,6 +164,7 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGput there is the only way to know whether this lane can take it. */const [draggedAsset, setDraggedAsset] = useState<ProjectAsset | undefined>(undefined);const [draggedScene, setDraggedScene] = useState<GenerationJob | undefined>(undefined);+ const [durationDraft, setDurationDraft] = useState<string | null>(null);/* What the user is typing into Lasts, while they are typing it. The fieldotherwise shows the clip's own length, and "00:0" on the way to "00:08"must not be snapped back to a formatted timecode mid-keystroke. Null means@@ -197,6 +208,8 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGconst seek = useCallback((ms: number) => setPlayhead(ms), []);const setPlayingFromMonitor = useCallback((value: boolean) => setPlaying(value), []);+ useEffect(() => { setDurationDraft(null); }, [selectedId]);+// Another clip, another length: what was being typed belonged to the old one./* Wheel over the timeline scrubs it. Registered by hand rather than with@@ -254,6 +267,7 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGconst updateTracks = (nextTracks: ProjectConfig["timeline"]["tracks"]) =>onChange((current) => ({ ...current, timeline: { tracks: nextTracks } }));const renameTrack = (trackId: string, name: string) => updateTracks(tracks.map((track) => track.id === trackId ? { ...track, name } : track));+ const updateClip = (clipId: string, updates: Partial<TimelineClip>) => updateTracks(tracks.map((track) => ({ ...track, clips: track.clips.map((clip) => clip.id === clipId ? { ...clip, ...updates } : clip) })));const toggleTrack = (trackId: string, key: "muted" | "locked") => updateTracks(tracks.map((track) => track.id === trackId ? { ...track, [key]: !track[key] } : track));/* Every removal — the toolbar, the key, the × on the clip itself — goesthrough one function, so a locked track refuses all three. */@@ -414,6 +428,10 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGbecause zod wants a positive whole number of milliseconds and a clipshorter than a frame cannot be shown. A still has no source length, so itis only bounded from below. */+ const selectedAsset = selected ? assetById(selected.assetId) : undefined;+ const sourceLimitMs = selected && selectedAsset?.kind !== "image" && selectedAsset?.durationMs+ ? Math.max(1, selectedAsset.durationMs - selected.sourceStartMs)+ : null;const minClipMs = Math.max(1, Math.round(1000 / config.settings.frameRate));/** What the FILE has left at each end of a clip. A still image and a file* nothing has measured have no source timeline to run out of, and get no@@ -422,6 +440,13 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenGconst asset = assetById(clip.assetId);return sourceRoom(clip, asset && asset.kind !== "image" ? asset.durationMs ?? null : null);};+ const typeDuration = (value: string) => {+ setDurationDraft(value);+ const parsed = selected ? parseDuration(value, config.settings.frameRate) : null;+ if (parsed === null || !selected) return;+ const next = trimClip(tracks, selected.id, "end", selected.startMs + parsed, { minClipMs, room: roomFor(selected) });+ if (next) updateTracks(next);+ };/* Typing a length is trimming the tail, so it is the same operation theright-hand handle performs — same floor of one frame, same ceiling in thefootage, and the same refusal to grow over the next clip on the track. */@@ -795,6 +820,42 @@ export function TimelineView({ config, folderPath, onChange, onMeasured, onOpenG</div></main>+ <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>+ <div className="field-pair">+ <label><span>Starts at</span><input value={timecode(selected.startMs).slice(3)} readOnly /></label>+ <label><span>Lasts</span><input+ value={durationDraft ?? timecode(selected.durationMs).slice(3)}+ onChange={(event) => typeDuration(event.target.value)}+ onBlur={() => setDurationDraft(null)}+ title={`How long this clip lasts — minutes:seconds:frames, or just seconds.${sourceLimitMs === null ? "" : ` This footage has ${(sourceLimitMs / 1000).toFixed(1)}s left from where the clip starts in it.`}`}+ inputMode="decimal"+ /></label>+ </div>+ </section>+ <section className="inspector-section inspector-section--pending">+ <h3>Transform <em>Not available yet</em></h3>+ <div className="field-pair">+ <label><span>Scale</span><input defaultValue="100%" disabled title={NOT_YET} /></label>+ <label><span>Rotation</span><input defaultValue="0°" disabled title={NOT_YET} /></label>+ </div>+ <div className="field-pair">+ <label><span>Position X</span><input defaultValue="0" disabled title={NOT_YET} /></label>+ <label><span>Position Y</span><input defaultValue="0" disabled title={NOT_YET} /></label>+ </div>+ </section>+ <section className="inspector-section inspector-section--pending">+ <h3>Look <em>Not available yet</em></h3>+ <label className="range-field"><span>Opacity <b>100%</b></span><input type="range" defaultValue="100" disabled title={NOT_YET} /></label>+ <label className="range-field"><span>Temperature <b>+4</b></span><input type="range" defaultValue="54" disabled title={NOT_YET} /></label>+ </section>+ </> : clipCount === 0+ ? <div className="inspector-empty"><MouseSelection /><b>Nothing to edit yet</b><span>Once a scene lands on the timeline, select it here to rename it and check its timing.</span></div>+ : <div className="inspector-empty"><MouseSelection /><b>Select a clip to edit it</b><span>Pick any clip on the timeline below to rename it, check its timing, and see how it was made.</span></div>}+ </aside></div><section className="pro-timeline">@@ -1012,3 +1073,5 @@ function TrackRow({ track, duration, selectedId, draggingId, dropActive, dropBlo</div></>;}++function MouseSelection() { return <div className="selection-glyph"><span /><i /></div>; }diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 427b163..5eb7ec4 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -14,9 +14,7 @@vertically if a project carries more tracks than that. */grid-template-rows: minmax(340px, 1fr) 372px;- /* The program monitor begins after the 296px scene panel and runs to the- right edge, so its centre is 148px right of the full-width toolbar's. */- --video-centre-shift: 148px;+ --video-centre-shift: -22px;}/* The view itself is focusable (tabIndex={0}) so Space and Delete reach the@@ -30,11 +28,12 @@.edit-panels {min-height: 0;display: grid;- grid-template-columns: 296px minmax(520px, 1fr);+ grid-template-columns: 296px minmax(520px, 1fr) 340px;border-bottom: 1px solid var(--line-strong);}-.scene-panel {+.scene-panel,+.clip-inspector {min-width: 0;overflow: hidden;background: var(--panel);@@ -44,6 +43,11 @@border-right: 1px solid var(--line);}+.clip-inspector {+ border-left: 1px solid var(--line);+ overflow-y: auto;+}+/* --- Panel tabs ------------------------------------------------------------ */.panel-tabs {@@ -646,6 +650,130 @@line-height: var(--leading-normal);}+/* --- Clip inspector -------------------------------------------------------- */++.inspector-section {+ padding: var(--space-4);+ border-bottom: 1px solid var(--line);+}++.inspector-section h3 {+ display: flex;+ align-items: center;+ gap: var(--space-2);+ margin: 0;+ color: var(--text-primary);+ font-size: var(--text-md);+ font-weight: var(--weight-semibold);+ line-height: var(--leading-snug);+}++.inspector-section h3 em {+ padding: 2px var(--space-2);+ border: 1px solid var(--line-strong);+ border-radius: var(--radius-pill);+ color: var(--text-muted);+ background: var(--panel-3);+ font-size: var(--text-2xs);+ font-style: normal;+ font-weight: var(--weight-medium);+ line-height: var(--leading-snug);+}++.inspector-section label {+ display: block;+ margin-top: var(--space-3);+}++.inspector-section label > span {+ display: block;+ margin-bottom: var(--space-1);+ color: var(--text-secondary);+ font-size: var(--text-sm);+ line-height: var(--leading-snug);+}++.inspector-section input:not([type="range"]) {+ width: 100%;+ height: var(--field-height);+ padding: 0 var(--space-3);+ border: 1px solid var(--line);+ border-radius: var(--radius-sm);+ color: var(--text-primary);+ background: var(--bg);+ font-family: var(--font-sans);+ font-size: var(--text-base);+}++.inspector-section input:focus { border-color: var(--accent); }+.inspector-section input[readonly] { color: var(--text-muted); }+.inspector-section--pending { opacity: 0.72; }+.inspector-section input:disabled { color: var(--text-faint); cursor: not-allowed; }++.field-pair {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: var(--space-2);+}++.range-field > span {+ display: flex !important;+ justify-content: space-between;+}++.range-field b { color: var(--text-primary); font-weight: var(--weight-medium); }+.range-field input { width: 100%; height: var(--control-sm); accent-color: var(--accent-bright); }+.range-field input:disabled { cursor: not-allowed; }++.inspector-empty {+ min-height: 280px;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: var(--space-5);+ text-align: center;+ color: var(--text-muted);+}++.inspector-empty b {+ margin: var(--space-3) 0 var(--space-2);+ color: var(--text-primary);+ font-size: var(--text-md);+ font-weight: var(--weight-semibold);+ line-height: var(--leading-snug);+}++.inspector-empty > span {+ max-width: 34ch;+ font-size: var(--text-base);+ line-height: var(--leading-normal);+}++.selection-glyph {+ position: relative;+ width: var(--control-md);+ height: var(--control-md);+ border: 1px solid var(--line-strong);+ border-radius: var(--radius-md);+}++.selection-glyph span {+ position: absolute;+ inset: var(--space-2);+ border: 1px dashed var(--accent-bright);+}++.selection-glyph i {+ position: absolute;+ width: 5px;+ height: 5px;+ right: var(--space-1);+ bottom: var(--space-1);+ border-radius: 1px;+ background: var(--accent-bright);+}+/* --- Timeline toolbar ------------------------------------------------------ */.pro-timeline {@@ -1245,20 +1373,20 @@/* The Tauri window may be resized down to 900px (see tauri.conf.json), so theeditor has to survive 900–1180px without ever scrolling sideways. The old`minmax(460px, 1fr)` centre column alone forced a 1036px floor. Each step- below narrows or removes the scene panel; the program monitor always survives.+ below drops the least essential column; the program monitor always survives.- 1180px narrower scene panel, monitor floor removed- 1040px scene panel narrows again- 840px one column — the scene panel goes (below the 900px window+ 1180px three columns, narrower sides, monitor floor removed+ 1040px two columns — the clip inspector goes first+ 840px one column — the scene panel goes too (below the 900px windowminimum, kept so an odd DPI/zoom combination still lays out) */@media (max-width: 1180px) {.edit-panels {- grid-template-columns: 256px minmax(0, 1fr);+ grid-template-columns: 256px minmax(0, 1fr) 300px;}.timeline-view {- --video-centre-shift: 128px;+ --video-centre-shift: -22px;}.scene-card {@@ -1277,8 +1405,12 @@grid-template-columns: 232px minmax(0, 1fr);}+ .clip-inspector {+ display: none;+ }+.timeline-view {- --video-centre-shift: 116px;+ --video-centre-shift: 0px;}.timeline-grid {