Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Move media import to toolbar

Bitti6fec4335e5dc
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.ts
index 86e2bd0..3f8719c 100644
--- a/src/components/ProjectWorkspace.test.ts
+++ b/src/components/ProjectWorkspace.test.ts
@@ -327,6 +327,9 @@ describe("project workspace timecode", () => {
expect(screen.queryByRole("heading", { name: "Generator scenes" })).toBeNull();
fireEvent.click(screen.getByRole("button", { name: "Media" }));
const media = container.querySelector(".media-grid")! as HTMLElement;
+ expect(screen.queryByRole("heading", { name: "Project media" })).toBeNull();
+ expect(screen.getByRole("button", { name: "Import" })).not.toBeNull();
+ expect(media.querySelector(".media-import")).toBeNull();
expect(within(media).getByText("Macro footage")).not.toBeNull();
expect(within(media).getByText("Room tone")).not.toBeNull();
});
diff --git a/src/components/workspace/TimelineView.tsx b/src/components/workspace/TimelineView.tsx
index 2ce60a0..1ccf47f 100644
--- a/src/components/workspace/TimelineView.tsx
+++ b/src/components/workspace/TimelineView.tsx
@@ -723,8 +723,13 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {
<button className={panelTab === "media" ? "active" : ""} onClick={() => setPanelTab("media")}><Film size={16} /> Media</button>
</div>
{panelTab === "media" && <div className="scene-panel__head">
- <h2>Project media</h2>
- <div className="layout-toggle" role="group" aria-label="Media layout">
+ <button
+ className="media-import-button"
+ onClick={() => void importMedia()}
+ disabled={importing || !isTauri()}
+ title={isTauri() ? "Add video, sound, or image files — video and sound stay where they are, images are copied in" : "Importing files is available in the desktop app"}
+ ><Upload size={16} /> {importing ? "Importing…" : "Import"}</button>
+ <div className="layout-toggle" role="group" aria-label="Media layout">
<button
className={mediaLayout === "grid" ? "active" : ""}
aria-pressed={mediaLayout === "grid"}
@@ -800,14 +805,6 @@ export function TimelineView({ config, folderPath, generationCompletionTimes = {
onClick={() => removeMediaAsset(asset.id)}
><X size={14} /></button>
</div>)}
- <button
- className="media-import"
- onClick={() => void importMedia()}
- disabled={importing || !isTauri()}
- title={isTauri() ? "Add video, sound, or image files — video and sound stay where they are, images are copied in" : "Importing files is available in the desktop app"}
- >
- <Upload size={20} /><b>{importing ? "Importing…" : "Import media"}</b>
- </button>
{importError && <p className="panel-hint panel-hint--error" role="alert">{importError}</p>}
</div>
)}
diff --git a/src/styles/timeline.css b/src/styles/timeline.css
index cdd9693..eb527e0 100644
--- a/src/styles/timeline.css
+++ b/src/styles/timeline.css
@@ -90,10 +90,9 @@
}
/* --- Region headings -------------------------------------------------------
- Media and the program monitor retain real h2 headings; Scenes starts
- directly below its already-labelled tab. */
+ The program monitor retains its h2; the asset tabs already name the left
+ panel's two regions. */
-.scene-panel__head h2,
.program-panel > .panel-chrome h2 {
display: flex;
align-items: center;
@@ -119,6 +118,29 @@
line-height: var(--leading-snug);
}
+.media-import-button {
+ min-height: var(--control-sm);
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-2);
+ padding: 0 var(--space-3);
+ border: 1px solid var(--line-strong);
+ border-radius: var(--radius-sm);
+ color: var(--text-primary);
+ background: var(--wash-1);
+ font-size: var(--text-sm);
+ font-weight: var(--weight-semibold);
+}
+
+.media-import-button:hover:not(:disabled) {
+ border-color: var(--line-hover);
+ background: var(--wash-2);
+}
+
+.media-import-button:disabled {
+ opacity: 0.6;
+}
+
/* Scenes start directly below the tabs; they do not need a second heading. */
.scene-list {
height: calc(100% - var(--control-lg));
@@ -313,8 +335,7 @@
grid-column: 1 / -1;
}
-.media-grid .media-card__source,
-.media-grid .media-import {
+.media-grid .media-card__source {
min-width: 0;
/* Floor the hit target even if a card ever renders without its labels. */
min-height: var(--control-sm);
@@ -326,15 +347,12 @@
background: var(--panel-2);
}
-.media-grid .media-card__source:hover:not(:disabled),
-.media-grid .media-import:hover:not(:disabled) {
+.media-grid .media-card__source:hover:not(:disabled) {
border-color: var(--line-strong);
}
.media-grid .media-card__source b,
-.media-grid .media-card__source small,
-.media-grid .media-import b,
-.media-grid .media-import small {
+.media-grid .media-card__source small {
display: block;
padding: 0 var(--space-2);
overflow: hidden;
@@ -342,8 +360,7 @@
text-overflow: ellipsis;
}
-.media-grid .media-card__source b,
-.media-grid .media-import b {
+.media-grid .media-card__source b {
margin-top: var(--space-2);
color: var(--text-primary);
font-size: var(--text-sm);
@@ -351,8 +368,7 @@
line-height: var(--leading-snug);
}
-.media-grid .media-card__source small,
-.media-grid .media-import small {
+.media-grid .media-card__source small {
margin-top: var(--space-1);
color: var(--text-muted);
font-size: var(--text-xs);
@@ -463,74 +479,10 @@
cursor: grabbing;
}
-.media-grid .media-import {
- min-height: 120px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- gap: var(--space-2);
- color: var(--text-muted);
- border-style: dashed;
- background: none;
-}
-
-.media-grid .media-import:hover:not(:disabled) {
- color: var(--text-primary);
- border-color: var(--accent-bright);
- background: var(--accent-soft);
-}
-
-/* Only in the browser preview, where there is no project folder to copy into. */
-.media-grid .media-import:disabled {
- opacity: 0.6;
-}
-
.panel-hint--error {
color: var(--danger);
}
-.media-import b {
- width: auto;
- margin-top: 0 !important;
- padding: 0 !important;
- text-align: center;
-}
-
-/* In list mode the import control is one row like every other, not the tall
- dashed plate the grid needs — and not a centred label either: it reuses the
- row grid above, so its words start on the same pixel as every file name
- beside it and its icon sits in the same column as their stills. These have
- the same specificity as the grid rules above, so they MUST stay below them —
- moved up, the 120px plate won. */
-.media-grid--list .media-import {
- /* The rows beside it are 42px tall: a 40px still between two 1px borders.
- This row carries the same border, so it has to add the same two pixels. */
- min-height: calc(var(--space-7) + 2px);
- display: flex;
- align-items: center;
- justify-content: flex-start;
- /* The grid-mode plate packs its icon and label together; a row uses the same
- column gap as the file rows, or the name lands four pixels short of theirs. */
- gap: var(--space-2);
- padding: 0 var(--space-3);
-}
-
-.media-grid--list .media-import svg {
- justify-self: center;
-}
-
-/* The file rows push their name down onto the baseline of a two-line stack.
- This row has one line, so it centres instead — bottom-aligned, it sat ten
- pixels below its own icon. */
-.media-grid--list .media-import b {
- width: auto;
- margin-top: 0;
- padding-left: 0;
- text-align: left;
- align-self: center;
-}
-
/* --- Program monitor ------------------------------------------------------- */
.program-panel {