Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Library: chrome command strip, selectable cards, 4px corners, token padding

Bitti81de57531949
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 8799042..c62eb49 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -37,6 +37,15 @@ describe("how long ago a project was edited", () => {
expect(container.querySelector(".project-card__meta")!.textContent).toContain("Edited just now");
});
+ it("states its selection through the shared selectable-card rule", () => {
+ const config = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
+ render(<ProjectCard project={{ folderPath: "C:\\Ceramic Lamp", config }} selected onOpen={() => undefined} />);
+ const card = screen.getByRole("option", { name: "Ceramic lamp" });
+ expect(card).toHaveAttribute("aria-selected", "true");
+ expect(card).toHaveClass("ui-selectable", "ui-selectable--card");
+ expect(card).not.toHaveClass("project-card--selected");
+ });
+
it("uses the first visual timeline asset as the project cover", () => {
const config = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
config.assets = [{
diff --git a/src/App.tsx b/src/App.tsx
index 88364c9..6b92f8e 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -13,7 +13,7 @@ import { PromptComposer } from "./components/PromptComposer";
import { SettingsView } from "./components/SettingsView";
import { TitleBar } from "./components/TitleBar";
import { UpdateInfoBar, UpdatePanel, updateNeedsAttention } from "./components/UpdatePanel";
-import { CommandBar, CommandBarButton, CommandBarSeparator, InfoBadge, InfoBar, TextField } from "./components/ui";
+import { CommandBar, CommandBarButton, CommandBarSeparator, EmptyState, InfoBadge, InfoBar, TextField } from "./components/ui";
import { AppUpdater } from "./lib/updater";
import { useShortcut } from "./lib/commands";
import { useRunningExportName } from "./lib/exportJob";
@@ -393,39 +393,45 @@ function App() {
<div className="app-screen" hidden={settingsOpen}>
<TitleBar title="Slopus" secondary="Preview" actions={shellActions} />
<main className="library" aria-labelledby="library-title">
- <h1 id="library-title" className="library__title">Projects</h1>
- {(error || showUpdateInfo) && <div className="library__infobars">
- {showUpdateInfo && <UpdateInfoBar updater={updater} onOpen={() => openSettings("updates")} onDismiss={() => setUpdateInfoDismissed(true)} />}
- {error && <InfoBar severity="error" title={error.title} message={error.detail} onClose={() => setError(null)} />}
- </div>}
- <CommandBar
- aria-label="Library commands"
- className="library__commands"
- end={<TextField
- className="library__search"
- inputRef={searchInput}
- type="search"
- value={query}
- onChange={setQuery}
- placeholder="Search projects"
- aria-label="Search projects"
- aria-keyshortcuts="Control+F"
- trailing={<span className="ui-textfield__icon" aria-hidden="true"><Search size={16} /></span>}
- />}
- >
- {newProjectButton}
- <CommandBarButton icon={<FolderOpen size={16} />} label="Open…" showLabel tooltip="Open project" shortcut="Ctrl+O" aria-label="Open project" disabled={busy} onClick={() => void openFromFolder()} />
- <CommandBarSeparator />
- <CommandBarButton icon={<Grid2X2 size={16} />} label="Grid view" pressed={projectLayout === "grid"} onClick={() => setProjectLayout("grid")} />
- <CommandBarButton icon={<List size={16} />} label="List view" pressed={projectLayout === "list"} onClick={() => setProjectLayout("list")} />
- </CommandBar>
-
- {/* An empty library says so in its empty state; a heading counting
- "0 projects" above it would only repeat that. */}
- <section className="library__section" {...(showLibraryHeading ? { "aria-labelledby": "all-projects-heading" } : { "aria-label": "All projects" })}>
+ <div className="library__head">
+ <h1 id="library-title" className="library__title">Projects</h1>
+ {(error || showUpdateInfo) && <div className="library__infobars">
+ {showUpdateInfo && <UpdateInfoBar updater={updater} onOpen={() => openSettings("updates")} onDismiss={() => setUpdateInfoDismissed(true)} />}
+ {error && <InfoBar severity="error" title={error.title} message={error.detail} onClose={() => setError(null)} />}
+ </div>}
+ </div>
+ {/* The command bar and the list's heading row share one chrome strip;
+ the tiles scroll on the pane under it. */}
+ <div className="library__bar">
+ <CommandBar
+ aria-label="Library commands"
+ className="library__commands"
+ end={<TextField
+ className="library__search"
+ inputRef={searchInput}
+ type="search"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search projects"
+ aria-label="Search projects"
+ aria-keyshortcuts="Control+F"
+ trailing={<span className="ui-textfield__icon" aria-hidden="true"><Search size={16} /></span>}
+ />}
+ >
+ {newProjectButton}
+ <CommandBarButton icon={<FolderOpen size={16} />} label="Open…" showLabel tooltip="Open project" shortcut="Ctrl+O" aria-label="Open project" disabled={busy} onClick={() => void openFromFolder()} />
+ <CommandBarSeparator />
+ <CommandBarButton icon={<Grid2X2 size={16} />} label="Grid view" pressed={projectLayout === "grid"} onClick={() => setProjectLayout("grid")} />
+ <CommandBarButton icon={<List size={16} />} label="List view" pressed={projectLayout === "list"} onClick={() => setProjectLayout("list")} />
+ </CommandBar>
+ {/* An empty library says so in its empty state; a heading counting
+ "0 projects" above it would only repeat that. */}
{showLibraryHeading && <h2 id="all-projects-heading" className="library__subtitle">
{query.trim() ? "Results" : "All projects"} <span className="library__count">{filteredProjects.length} {filteredProjects.length === 1 ? "project" : "projects"}</span>
</h2>}
+ </div>
+
+ <section className="library__section" {...(showLibraryHeading ? { "aria-labelledby": "all-projects-heading" } : { "aria-label": "All projects" })}>
{loading ? (
<div className={`project-grid project-grid--${projectLayout}`} aria-busy="true">{[0, 1, 2].map((item) => <div className="project-skeleton" key={item}><i /><span /><small /></div>)}</div>
) : filteredProjects.length ? (
@@ -447,12 +453,14 @@ function App() {
})}
</div>
) : query ? (
- <div className="library-empty">
- <Search size={48} aria-hidden="true" />
- <h3>No results for “{query}”</h3>
- <p>Search looks at project names, descriptions and folders.</p>
- <div className="library-empty__actions"><button type="button" className="secondary-button" onClick={() => setQuery("")}>Clear search</button></div>
- </div>
+ /* The compact shared empty state: only the first-run hero below
+ is large. */
+ <EmptyState
+ icon={<Search size={32} />}
+ title={`No results for “${query}”`}
+ description="Search looks at project names, descriptions and folders."
+ action={<button type="button" className="secondary-button" onClick={() => setQuery("")}>Clear search</button>}
+ />
) : (
<div className="library-empty">
<FolderOpen size={48} aria-hidden="true" />
diff --git a/src/components/ProjectCard.tsx b/src/components/ProjectCard.tsx
index ee05fe8..2b12386 100644
--- a/src/components/ProjectCard.tsx
+++ b/src/components/ProjectCard.tsx
@@ -47,8 +47,8 @@ function durationLabel(seconds: number) {
/* A project in the library, as a GridView item: a plain tile with the real
first frame (or a neutral glyph on --panel-3), the name and one caption
- line. Hover changes the fill and nothing else. A click selects it; a
- double-click or Enter opens it. The prompt it was made from is its tooltip.
+ line. Hover and selection are the shared .ui-selectable--card rule. A click
+ selects it; a double-click or Enter opens it. The prompt it was made from is its tooltip.
Right-click, Shift+F10 or the ⋯ button opens the same context menu.
The tile is an option in the library's listbox (App.tsx owns the list, the
@@ -95,7 +95,7 @@ export const ProjectCard = forwardRef(function ProjectCard(
aria-selected={selected}
aria-label={config.name}
tabIndex={tabIndex}
- className={`project-card project-card--${layout}${selected ? " project-card--selected" : ""}`}
+ className={`project-card project-card--${layout} ui-selectable ui-selectable--card`}
data-tooltip={prompt || undefined}
onClick={() => onSelect?.(project)}
onDoubleClick={() => onOpen(project)}
diff --git a/src/styles/library.css b/src/styles/library.css
index 5e76b78..fb85367 100644
--- a/src/styles/library.css
+++ b/src/styles/library.css
@@ -3,14 +3,16 @@
project / Project settings dialog (PromptComposer.tsx).
The library is a Windows page, not a website: it fills the window edge to
- edge (24px 36px padding) under the title bar, with a 28px "Projects" title,
- a command bar (New project in accent, Open…, the view toggle, the search
- box at the trailing end) and an auto-fill grid of plain tiles. There is no
- centred 1180px column, no frosted sticky header, and no generated cover
- art: a tile shows the project's real first frame, or a neutral glyph.
-
- Tile rhythm: thumbnail at 16:9 with 4px corners, then a 14px name and a
- 12px caption. `.project-skeleton` reproduces the same thumbnail ratio and
+ edge (--space-6 at the sides) under the title bar, with a 28px "Projects"
+ title on the pane, then a chrome strip holding the command bar (New project
+ in accent, Open…, the view toggle, the search box at the trailing end) and
+ the "All projects" row, then an auto-fill grid of plain tiles scrolling on
+ the pane. There is no centred 1180px column, no frosted sticky header, and
+ no generated cover art: a tile shows the project's real first frame, or a
+ neutral glyph.
+
+ Tile rhythm: 4px corners like every card, thumbnail at 16:9, then a 14px
+ name and a 12px caption. `.project-skeleton` reproduces the same thumbnail ratio and
text height so the grid does not jump when loading finishes.
========================================================================== */
@@ -20,30 +22,46 @@
flex: 1 1 auto;
min-width: 0;
min-height: 0;
- overflow-y: auto;
- padding: var(--space-5) 36px var(--space-6);
border-top: 1px solid var(--stroke-card);
- background: var(--layer);
+ background: var(--surface-pane);
+}
+
+.library__head {
+ flex: none;
+ padding: var(--space-5) var(--space-6) var(--space-4);
}
/* Fluent Title: 28/36 semibold in the Display cut. */
.library__title {
- margin: 0 0 var(--space-4);
+ margin: 0;
color: var(--text-primary);
font-family: var(--font-display);
font-size: var(--text-2xl);
font-weight: var(--weight-semibold);
- line-height: 36px;
+ line-height: var(--leading-tight);
}
.library__infobars {
display: grid;
gap: var(--space-1);
- margin-bottom: var(--space-3);
+ margin-top: var(--space-3);
+}
+
+/* --- Command strip ------------------------------------------------------------
+ Chrome, like every toolbar: the command bar row and, when there are
+ projects, the "All projects" row, with the divider edge under both. */
+
+.library__bar {
+ flex: none;
+ padding: 0 var(--space-6);
+ border-top: 1px solid var(--stroke-divider);
+ border-bottom: 1px solid var(--stroke-divider);
+ background: var(--surface-chrome);
}
.library__commands {
- margin: 0 calc(-1 * var(--space-1)) var(--space-4);
+ min-height: var(--chrome-row);
+ margin: 0 calc(-1 * var(--space-1));
}
.library__commands .ui-command-bar__primary {
@@ -59,16 +77,28 @@
width: 100%;
}
+/* The tiles scroll here, under the strip. A flex column so the compact empty
+ state can centre itself in what is left. */
.library__section {
+ flex: 1 1 auto;
min-width: 0;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+ overflow-y: auto;
+ padding: var(--space-4) var(--space-6) var(--space-6);
}
-/* "All projects" with its count in secondary text. */
+/* "All projects" with its count in secondary text: the strip's second row. */
.library__subtitle {
+ min-height: var(--chrome-row);
display: flex;
align-items: baseline;
gap: var(--space-2);
- margin: 0 0 var(--space-3);
+ margin: 0;
+ padding-block: var(--space-2); /* 20px line + 16 = the 36px row */
+ box-sizing: border-box;
+ border-top: 1px solid var(--line);
color: var(--text-primary);
font-size: var(--text-base);
font-weight: var(--weight-semibold);
@@ -96,9 +126,9 @@
}
/* --- Tile -------------------------------------------------------------------
- A GridView item: the card fill and 1px stroke, 8px corners, the fill
- changing on hover and press and nothing else — no lift, no glow, no accent
- border. Selection is an inset accent edge, as in File Explorer's grid. */
+ A GridView item: a 1px stroke and 4px corners like every card. Rest, hover
+ and selection (accent-soft plus the accent ring) are the shared
+ .ui-selectable--card rule in ui.css, so nothing here sets a fill. */
.project-card {
position: relative;
@@ -108,27 +138,13 @@
min-width: 0;
padding: var(--space-2);
border: 1px solid var(--stroke-card);
- border-radius: var(--radius-lg);
- background: var(--card);
+ border-radius: var(--radius-sm);
color: var(--text-primary);
outline: none;
- transition: var(--transition-control);
-webkit-user-select: none;
user-select: none;
}
-.project-card:hover {
- background: var(--card-hover);
-}
-
-.project-card:active {
- background: var(--card-pressed);
-}
-
-.project-card--selected {
- box-shadow: inset 0 0 0 2px var(--accent);
-}
-
.project-card:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-outer);
outline-offset: 1px;
@@ -186,7 +202,7 @@
background: var(--layer);
color: var(--text-secondary);
font-size: var(--text-xs);
- line-height: 16px;
+ line-height: var(--leading-snug);
font-variant-numeric: tabular-nums;
}
@@ -214,7 +230,7 @@
.project-card__meta {
color: var(--text-secondary);
font-size: var(--text-xs);
- line-height: 16px;
+ line-height: var(--leading-snug);
}
/* ⋯ sits over the text row's trailing end; it is not a tab stop (Shift+F10
@@ -228,7 +244,7 @@
}
.project-card:hover .project-card__more,
-.project-card--selected .project-card__more,
+.project-card[aria-selected="true"] .project-card__more,
.project-card:focus-within .project-card__more {
opacity: 1;
}
@@ -264,8 +280,7 @@
gap: var(--space-2);
padding: var(--space-2);
border: 1px solid var(--stroke-card);
- border-radius: var(--radius-lg);
- background: var(--card);
+ border-radius: var(--radius-sm);
}
.project-skeleton i {
@@ -299,8 +314,10 @@
}
/* --- Empty ---------------------------------------------------------------------
- No box, no dashed border (that reads as a file drop zone): a 48px glyph, a
- 20px line, one sentence and the two ways forward side by side. */
+ The first-run hero, the one large empty state in the app (a search with no
+ results uses the compact shared EmptyState). No box, no dashed border (that
+ reads as a file drop zone): a 48px glyph, a 20px line, one sentence and the
+ two ways forward side by side. */
.library-empty {
display: grid;
@@ -316,7 +333,7 @@
color: var(--text-primary);
font-size: var(--text-lg);
font-weight: var(--weight-semibold);
- line-height: 28px;
+ line-height: 1.4; /* 28/20, Fluent Subtitle */
}
.library-empty p {