Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Library: New project and Open beside the title, grid/list on the All projects strip

Bitti3106655b9e35
diff --git a/src/App.tsx b/src/App.tsx
index c3ee605..3afc0c8 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -407,32 +407,32 @@ function App() {
</TitleBar>
<main className="library" aria-labelledby="library-title">
<div className="library__head">
- <h1 id="library-title" className="library__title">Projects</h1>
+ {/* The title and the library's commands share one line. */}
+ <div className="library__title-row">
+ <h1 id="library-title" className="library__title">Projects</h1>
+ <CommandBar aria-label="Library commands" className="library__commands">
+ {newProjectButton}
+ <CommandBarButton icon={<FolderOpen16 />} label="Open…" showLabel tooltip="Open project" shortcut="Ctrl+O" aria-label="Open project" disabled={busy} onClick={() => void openFromFolder()} />
+ </CommandBar>
+ </div>
{(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={<>
- <CommandBarButton icon={projectLayout === "grid" ? <GridView16Filled /> : <GridView16 />} label="Grid view" pressed={projectLayout === "grid"} onClick={() => setProjectLayout("grid")} />
- <CommandBarButton icon={projectLayout === "list" ? <ListView16Filled /> : <ListView16 />} label="List view" pressed={projectLayout === "list"} onClick={() => setProjectLayout("list")} />
- </>}
- >
- {newProjectButton}
- <CommandBarButton icon={<FolderOpen16 />} label="Open…" showLabel tooltip="Open project" shortcut="Ctrl+O" aria-label="Open project" disabled={busy} onClick={() => void openFromFolder()} />
- </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">
+ {/* The list's heading row is a chrome strip with the layout toggle at
+ its end; the tiles scroll on the pane under it. An empty library
+ says so in its empty state, so it has no strip: a heading counting
+ "0 projects" would only repeat that. */}
+ {showLibraryHeading && <div className="library__bar">
+ <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>
+ </h2>
+ <div className="library__layout" role="group" aria-label="Project layout">
+ <CommandBarButton icon={projectLayout === "grid" ? <GridView16Filled /> : <GridView16 />} label="Grid view" pressed={projectLayout === "grid"} onClick={() => setProjectLayout("grid")} />
+ <CommandBarButton icon={projectLayout === "list" ? <ListView16Filled /> : <ListView16 />} label="List view" pressed={projectLayout === "list"} onClick={() => setProjectLayout("list")} />
+ </div>
+ </div>}
<section className="library__section" {...(showLibraryHeading ? { "aria-labelledby": "all-projects-heading" } : { "aria-label": "All projects" })}>
{loading ? (
diff --git a/src/styles/library.css b/src/styles/library.css
index 1784a82..ac8fdc0 100644
--- a/src/styles/library.css
+++ b/src/styles/library.css
@@ -47,27 +47,45 @@
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__title-row {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-2) var(--space-4);
}
+/* The commands sit at the end of the title's line. */
.library__commands {
- min-height: var(--chrome-row);
- margin: 0 calc(-1 * var(--space-1));
+ min-height: var(--command-row);
+ margin: 0 calc(-1 * var(--space-1)) 0 auto;
+ padding: 0;
}
.library__commands .ui-command-bar__primary {
gap: var(--space-1);
}
+/* --- List strip ---------------------------------------------------------------
+ Chrome, like every toolbar: the "All projects" heading and, at its end, the
+ grid/list toggle, with divider edges above and below. */
+
+.library__bar {
+ flex: none;
+ min-height: var(--command-row);
+ display: flex;
+ align-items: center;
+ gap: var(--space-2);
+ padding: 0 var(--space-5) 0 var(--space-6);
+ border-top: 1px solid var(--stroke-divider);
+ border-bottom: 1px solid var(--stroke-divider);
+ background: var(--surface-chrome);
+}
+
+.library__layout {
+ display: flex;
+ gap: 2px;
+ margin-left: auto;
+}
/* The tiles scroll here, under the strip. A flex column so the compact empty
state can centre itself in what is left. */
@@ -83,14 +101,11 @@
/* "All projects" with its count in secondary text: the strip's second row. */
.library__subtitle {
- min-height: var(--chrome-row);
+ min-width: 0;
display: flex;
align-items: baseline;
gap: var(--space-2);
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);