Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Program monitor: labelled control strip, safe-area icon, four corner handles, empty state

Bitti8e04093ea4b8
diff --git a/src/components/workspace/ProgramMonitor.tsx b/src/components/workspace/ProgramMonitor.tsx
index ebf67fe..7b75dcd 100644
--- a/src/components/workspace/ProgramMonitor.tsx
+++ b/src/components/workspace/ProgramMonitor.tsx
@@ -353,7 +353,17 @@ export function ProgramMonitor({ config, folderPath, playheadMs, playing, rate =
onPointerCancel={endTransform}
>
<button className="program-transform__rotate" type="button" aria-label="Rotate clip" data-tooltip="Drag to rotate" onPointerDown={(event) => beginTransform("rotate", event)} />
- <button className="program-transform__scale" type="button" aria-label="Scale clip" data-tooltip="Drag to scale" onPointerDown={(event) => beginTransform("scale", event)} />
+ <button className="program-transform__scale program-transform__scale--br" type="button" aria-label="Scale clip" data-tooltip="Drag to scale" onPointerDown={(event) => beginTransform("scale", event)} />
+ {/* Scale is uniform and measured from the centre, so every corner is the
+ same gesture: the other three are pointer targets for the one named
+ above, not further controls. There are no edge handles because
+ there is no one-axis stretch to give them. */}
+ {(["tl", "tr", "bl"] as const).map((corner) => <span
+ key={corner}
+ className={`program-transform__scale program-transform__scale--${corner}`}
+ aria-hidden="true"
+ onPointerDown={(event) => beginTransform("scale", event)}
+ />)}
<span className="sr-only">Drag inside the frame to move the clip.</span>
</div>}
{audioClips.map((audioClip) => {
diff --git a/src/components/workspace/TimelineView.test.tsx b/src/components/workspace/TimelineView.test.tsx
index 7066f1b..1bc68da 100644
--- a/src/components/workspace/TimelineView.test.tsx
+++ b/src/components/workspace/TimelineView.test.tsx
@@ -262,9 +262,9 @@ describe("the media and scene panels", () => {
expect(cardFor(config.assets[1]).classList.contains("is-selected")).toBe(true);
expect(cardFor(config.assets[0]).classList.contains("is-selected")).toBe(false);
cleanup();
- mediaPanel(parseProjectConfig({ ...config, assets: [] }));
- expect(screen.getByText("No media yet")).toBeTruthy();
- expect(screen.getByRole("button", { name: "Import media" })).toBeTruthy();
+ const empty = mediaPanel(parseProjectConfig({ ...config, assets: [] })).container.querySelector(".media-grid") as HTMLElement;
+ expect(within(empty).getByText("No media yet")).toBeTruthy();
+ expect(within(empty).getByRole("button", { name: "Import media" })).toBeTruthy();
});
it("offers Add scene as a plain button that opens the unstarted draft", () => {
@@ -678,6 +678,7 @@ describe("the transport and the playhead", () => {
const range = container.querySelector(".time-ruler__range") as HTMLElement;
expect(range.style.left).toBe(`${(1000 / 40_000) * 100}%`);
expect(range.style.width).toBe(`${(2000 / 40_000) * 100}%`);
+ expect(screen.getByLabelText("In to out").textContent).toBe("00:00:02:00");
fireEvent.contextMenu(container.querySelector(".time-ruler")!);
fireEvent.click(screen.getByRole("menuitem", { name: /Clear in and out/ }));
expect(container.querySelector(".time-ruler__range")).toBeNull();
@@ -752,9 +753,16 @@ describe("zoom and the wheel", () => {
describe("the program monitor", () => {
it("shows a muted line on an empty timeline and a footer with time, duration, zoom and safe areas", () => {
const { container } = render_(projectWithMedia());
- expect(container.querySelector(".program-empty")!.textContent).toBe("Drop media on a track, or generate a scene.");
+ const empty = container.querySelector(".program-empty") as HTMLElement;
+ expect(within(empty).getByText("Nothing on the timeline yet")).toBeTruthy();
+ expect(within(empty).getByText("Drop media on a track, or generate a scene.")).toBeTruthy();
+ expect(within(empty).getByRole("button", { name: "Import media" })).toBeTruthy();
+ expect(container.querySelector(".program-panel h2:not(.sr-only), .program-panel header")).toBeNull();
const footer = container.querySelector(".program-footer") as HTMLElement;
expect(within(footer).getByLabelText("Playhead").textContent).toBe("00:00:00:00");
+ expect(within(footer).getByText("Playhead")).toBeTruthy();
+ expect(within(footer).getByText("Duration")).toBeTruthy();
+ expect(within(footer).queryByText("In–out")).toBeNull();
expect(screen.getByRole("combobox", { name: "Monitor zoom" }).textContent).toContain("Fit");
fireEvent.click(screen.getByRole("button", { name: "Safe areas" }));
expect(container.querySelector(".program-safe")).not.toBeNull();
diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsx
index ea79c7b..7f1d1c2 100644
--- a/src/components/workspace/TimelineView.tsx
+++ b/src/components/workspace/TimelineView.tsx
@@ -1,7 +1,7 @@
import { ClipEffects } from "./ClipEffects";
import {
- ChevronFirst, ChevronLast, Copy, Film, LayoutGrid, List, Lock, LockOpen,
- PanelLeft, PanelRight, Pause, Play, Plus, Scissors, StepBack, StepForward, Trash2, Upload,
+ ChevronFirst, ChevronLast, Clapperboard, Copy, Film, LayoutGrid, List, Lock, LockOpen,
+ PanelLeft, PanelRight, Pause, Play, Plus, Scan, Scissors, StepBack, StepForward, Trash2, Upload,
Volume2, VolumeX, ZoomIn, ZoomOut,
} from "lucide-react";
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type MutableRefObject } from "react";
@@ -1246,13 +1246,37 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {
onSelectClip={setSelectedId}
onTransformChange={(clipId, transform) => updateClip(clipId, { transform: roundClipTransform(transform) }, `transform:${clipId}:gesture`)}
/>
- : <div className="program-empty"><span>Drop media on a track, or generate a scene.</span></div>}
+ : <EmptyState
+ className="program-empty"
+ icon={<Clapperboard />}
+ title="Nothing on the timeline yet"
+ description="Drop media on a track, or generate a scene."
+ action={<button
+ type="button"
+ className="secondary-button"
+ onClick={() => void importMedia()}
+ disabled={importing || !isTauri()}
+ {...tooltipProps(isTauri() ? undefined : "Importing files is available in the desktop app")}
+ ><Upload size={16} aria-hidden="true" /> Import media</button>}
+ />}
{safeArea && <div className="program-safe" aria-hidden="true"><i className="program-safe__frame"><b className="program-safe__action" /><b className="program-safe__title" /></i></div>}
</div>
</div>
+ {/* No header: the stage is the pane. The footer is its control strip —
+ labelled values on the leading edge, view controls trailing. */}
<footer className="program-footer">
- <span className="program-footer__time" aria-label="Playhead">{formatTimecode(playhead, fps)}</span>
- <span className="program-footer__duration" aria-label="Timeline duration">{formatTimecode(contentEndMs, fps)}</span>
+ <span className="program-footer__value">
+ <span className="program-footer__label" aria-hidden="true">Playhead</span>
+ <span className="program-footer__time" aria-label="Playhead">{formatTimecode(playhead, fps)}</span>
+ </span>
+ <span className="program-footer__value">
+ <span className="program-footer__label" aria-hidden="true">Duration</span>
+ <span className="program-footer__duration" aria-label="Timeline duration">{formatTimecode(contentEndMs, fps)}</span>
+ </span>
+ {(inMs !== null || outMs !== null) && <span className="program-footer__value">
+ <span className="program-footer__label" aria-hidden="true">In–out</span>
+ <span className="program-footer__range" aria-label="In to out">{formatTimecode(Math.max(0, (outMs ?? duration) - (inMs ?? 0)), fps)}</span>
+ </span>}
<span className="program-footer__spacer" />
<ComboBox
className="program-footer__zoom"
@@ -1263,12 +1287,12 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {
/>
<button
type="button"
- className={`program-footer__toggle${safeArea ? " active" : ""}`}
+ className="ui-toggle-button program-footer__toggle"
aria-pressed={safeArea}
aria-label="Safe areas"
{...tooltipProps("Title and action safe areas")}
onClick={() => setSafeArea((value) => !value)}
- ><LayoutGrid size={14} aria-hidden="true" /></button>
+ ><Scan size={16} aria-hidden="true" /></button>
</footer>
</main>
diff --git a/src/styles/timeline.css b/src/styles/timeline.css
index 1f3c81a..30b1d3c 100644
--- a/src/styles/timeline.css
+++ b/src/styles/timeline.css
@@ -402,9 +402,10 @@
.program-panel {
min-width: 0;
min-height: 0;
+ container: program-panel / inline-size;
display: grid;
- grid-template-rows: minmax(0, 1fr) 24px;
- background: var(--stage-bg);
+ grid-template-rows: minmax(0, 1fr) auto;
+ background: var(--surface-stage);
}
/* A flat stage, no dot grid. At 50% / 100% the stage has a fixed size and
@@ -477,7 +478,8 @@
background: var(--accent-bright);
}
-.program-transform button {
+.program-transform__rotate,
+.program-transform__scale {
position: absolute;
z-index: 1;
width: 12px;
@@ -487,21 +489,27 @@
border-radius: 2px;
background: var(--panel);
touch-action: none;
+ transition: background-color var(--motion-fast) linear;
+}
+
+/* Hover fills the handle, so it is clear which one the press will take. */
+.program-transform__rotate:hover,
+.program-transform__scale:hover {
+ background: var(--accent-bright);
}
.program-transform__rotate {
left: 50%;
top: -24px;
translate: -50% 0;
- border-radius: var(--radius-pill) !important;
+ border-radius: var(--radius-pill);
cursor: grab;
}
-.program-transform__scale {
- right: -7px;
- bottom: -7px;
- cursor: nwse-resize;
-}
+.program-transform__scale--tl { left: -7px; top: -7px; cursor: nwse-resize; }
+.program-transform__scale--tr { right: -7px; top: -7px; cursor: nesw-resize; }
+.program-transform__scale--bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
+.program-transform__scale--br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.program-transform:active,
.program-transform__rotate:active {
@@ -529,17 +537,19 @@
background: var(--stage-alert-bg);
}
-/* An empty timeline: one muted line on the black stage. */
-.program-empty {
- width: 100%;
+/* An empty timeline: the shared empty state, in stage ink — the stage is
+ dark in both themes. */
+.program-empty.ui-empty-state {
height: 100%;
- display: grid;
- place-items: center;
- padding: var(--space-4);
- text-align: center;
+}
+
+.program-empty .ui-empty-state__icon,
+.program-empty .ui-empty-state__description {
color: color-mix(in srgb, var(--on-stage) 62%, transparent);
- font-size: var(--text-xs);
- line-height: var(--leading-snug);
+}
+
+.program-empty .ui-empty-state__title {
+ color: var(--on-stage);
}
/* Title-safe (80%) and action-safe (90%) guides, drawn over the project's
@@ -569,12 +579,15 @@
.program-safe__action { inset: 5%; }
.program-safe__title { inset: 10%; }
+/* The monitor's control strip: labelled mono values leading, the zoom and
+ the safe-area toggle trailing, all at the 24px compact size. */
.program-footer {
min-width: 0;
+ min-height: var(--chrome-row-sm);
display: flex;
align-items: center;
- gap: var(--space-3);
- padding: 0 var(--space-1) 0 var(--space-2);
+ gap: var(--space-4);
+ padding: 0 0 0 var(--space-2);
border-top: 1px solid var(--stroke-divider);
color: var(--text-secondary);
background: var(--surface-chrome);
@@ -584,11 +597,24 @@
white-space: nowrap;
}
+.program-footer__value {
+ display: inline-flex;
+ align-items: baseline;
+ gap: var(--space-1);
+ font-family: var(--font-mono);
+}
+
+.program-footer__label {
+ color: var(--text-muted);
+ font-family: var(--font-sans);
+}
+
.program-footer__time { color: var(--text-primary); }
.program-footer__spacer { flex: 1; }
.program-footer .ui-combo {
- height: 20px;
+ height: var(--control-sm);
+ min-height: 0;
min-width: 72px;
padding: 0 var(--space-1) 0 var(--space-2);
border-radius: var(--radius-sm);
@@ -596,8 +622,9 @@
}
.program-footer__toggle {
- width: 20px;
- height: 20px;
+ width: var(--control-sm);
+ height: var(--control-sm);
+ flex: none;
display: grid;
place-items: center;
padding: 0;
@@ -610,9 +637,9 @@
.program-footer__toggle:hover { background: var(--fill-subtle-hover); }
-.program-footer__toggle.active {
- color: var(--text-primary);
- background: var(--fill-subtle-pressed);
+/* A narrow monitor keeps the values and drops their labels first. */
+@container program-panel (max-width: 360px) {
+ .program-footer__label { display: none; }
}
/* --- Clip inspector ----------------------------------------------------------