Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Polish Video folder cards and list spacing

Bitti80ed153949e1
diff --git a/src/components/workspace/VideoLibraryView.tsx b/src/components/workspace/VideoLibraryView.tsx
index a32ed3f..c250761 100644
--- a/src/components/workspace/VideoLibraryView.tsx
+++ b/src/components/workspace/VideoLibraryView.tsx
@@ -6,7 +6,7 @@ import { mergeVideoScenes, newVideo, resolveVideoSource, songScenes, videoLibrar
import { newMusicFolder } from "../../lib/music";
import { askNative } from "../../lib/nativeShell";
import { CommandBarButton, ComboBox, PropRow, PropSection, Splitter, useContextMenu, usePaneSize, type MenuEntry } from "../ui";
-import { Add16, Delete16, Film32, FolderAdd16, FolderOpen16, GridView16, ListView16, OpenExternal16, Play16 } from "../ui/icons";
+import { Add16, Delete16, Film32, FolderAdd16, FolderOpen48, GridView16, ListView16, OpenExternal16, Play16 } from "../ui/icons";
import { GeneratorView } from "./GeneratorView";
import { VideoPlayback, videoPlaylist } from "./VideoPlayback";
import { VideoPoster } from "./VideoPoster";
@@ -36,6 +36,11 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {
useBackNavigation(props.onBackNavigationChange, open ? "Back to Video" : null, () => setOpenId(undefined));
useEffect(() => { props.onOpenVideoChange?.(open?.id); }, [open?.id, props.onOpenVideoChange]);
const playing = videos.find((video) => video.id === playback?.id);
+ const folderContents = (id: string) => {
+ const videoCount = videos.filter((video) => video.folderId === id).length;
+ const folderCount = folders.filter((folder) => folder.parentId === id).length;
+ return [videoCount ? `${videoCount} video${videoCount === 1 ? "" : "s"}` : "", folderCount ? `${folderCount} folder${folderCount === 1 ? "" : "s"}` : ""].filter(Boolean).join(" \u00b7 ") || "Empty folder";
+ };
const breadcrumbs: { id: string | null; name: string }[] = [];
const visited = new Set<string>();
let ancestor = currentFolder;
@@ -105,8 +110,8 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {
<button className="primary-button" disabled={!folderName.trim()}>Create folder</button><button type="button" className="secondary-button" onClick={() => setCreatingFolder(false)}>Cancel</button>
</form>}
<div className={`music-songs music-songs--${view}`} role="list" aria-label="Video contents">
- {folders.filter((folder) => (folder.parentId ?? null) === currentFolderId).map((folder) => <div className="music-song music-folder" role="listitem" key={folder.id} {...dropProps(folder.id)} onContextMenu={(event) => menu.open(event, [...newItems(), { separator: true }, { label: "Remove folder", icon: <Delete16 />, onSelect: () => update((current) => ({ ...current, videoFolders: current.videoFolders?.filter((item) => item.id !== folder.id).map((item) => item.parentId === folder.id ? { ...item, parentId: folder.parentId } : item), videos: current.videos!.map((video) => video.folderId === folder.id ? { ...video, folderId: folder.parentId } : video) })) }])}>
- <button type="button" className="music-song__select" aria-label={`Open ${folder.name}`} onClick={() => browse(folder.id)}><span className="music-song__art"><FolderOpen16 /></span><span className="music-song__info"><strong>{folder.name}</strong></span></button>
+ {folders.filter((folder) => (folder.parentId ?? null) === currentFolderId).map((folder) => <div className="music-song music-folder video-folder" role="listitem" key={folder.id} {...dropProps(folder.id)} onContextMenu={(event) => menu.open(event, [...newItems(), { separator: true }, { label: "Remove folder", icon: <Delete16 />, onSelect: () => update((current) => ({ ...current, videoFolders: current.videoFolders?.filter((item) => item.id !== folder.id).map((item) => item.parentId === folder.id ? { ...item, parentId: folder.parentId } : item), videos: current.videos!.map((video) => video.folderId === folder.id ? { ...video, folderId: folder.parentId } : video) })) }])}>
+ <button type="button" className="music-song__select" aria-label={`Open ${folder.name}`} onClick={() => browse(folder.id)}><span className="music-song__art"><FolderOpen48 /></span><span className="music-song__info"><strong title={folder.name}>{folder.name}</strong><span>{folderContents(folder.id)}</span></span></button>
</div>)}
{visible.map((video) => {
const scenes = videoScenes(video, config), playlist = videoPlaylist(video, config), playable = playlist.length, first = playlist[0];
diff --git a/src/styles/video-library.css b/src/styles/video-library.css
index 496f397..623778e 100644
--- a/src/styles/video-library.css
+++ b/src/styles/video-library.css
@@ -10,11 +10,12 @@
.video-reference-help { color: var(--text-secondary); font-size: var(--text-xs); }
.video-reference-range { display: block; margin-block: var(--space-1); }
.video-library-stage .music-songs--grid { grid-template-columns: repeat(auto-fill, minmax(0, min(300px, 100%))); gap: var(--space-2); }
-.video-card { overflow: hidden; container-type: inline-size; border-radius: var(--radius-sm); }
-.video-card > .music-song__select { height: auto; padding: 6px; }
+.video-card, .video-folder { overflow: hidden; container-type: inline-size; border-radius: var(--radius-sm); }
+.video-card > .music-song__select, .video-folder > .music-song__select { height: auto; padding: 6px; }
.video-card .music-song__art { aspect-ratio: var(--video-card-aspect, 16 / 9); overflow: hidden; }
.video-card .music-song__art img { display: block; width: 100%; height: 100%; object-fit: contain; }
-.video-library-stage .music-folder .music-song__art { aspect-ratio: 16 / 9; }
+.video-folder .music-song__art { flex: none; aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--accent) 8%, var(--surface-pane)); }
+.video-folder .music-song__art svg { width: 64px; height: 64px; }
.video-card__controls { position: absolute; top: calc((100cqw - 12px) / var(--video-card-aspect, 1.7777778) / 2 + 6px); left: 50%; transform: translate(-50%, -50%); display: flex; gap: var(--space-2); }
.video-card__controls button { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #ffffff80; border-radius: 50%; background: #15191fe6; color: #fff; box-shadow: 0 1px 6px #0008; }
.video-card__controls button:hover { background: #363d48; }
@@ -23,5 +24,8 @@
.video-card__position { position: absolute; left: var(--space-2); top: var(--space-2); color: #fff; background: #000b; padding: 2px 5px; font-size: var(--text-xs); pointer-events: none; max-width: 70%; }
.music-songs--list .video-card > .music-song__select { padding-right: 100px; min-height: 82px; }
.music-songs--list .video-card .music-song__art { width: 120px; height: 67.5px; }
+.music-songs--list .video-folder > .music-song__select { min-height: 82px; padding-right: 6px; }
+.music-songs--list .video-folder .music-song__art { width: 120px; height: 67.5px; }
+.music-songs--list .video-folder .music-song__art svg { width: 32px; height: 32px; }
.music-songs--list .video-card__controls { top: 50%; left: auto; right: 12px; transform: translateY(-50%); }
.music-songs--list .video-card__player { inset: 0; aspect-ratio: auto; }