Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Center video generation toolbar action

Bitti6c1a4d851a06
diff --git a/src/components/ui/Chrome.tsx b/src/components/ui/Chrome.tsx
index b8fa159..26ac558 100644
--- a/src/components/ui/Chrome.tsx
+++ b/src/components/ui/Chrome.tsx
@@ -18,11 +18,13 @@ export interface CommandBarProps {
children: ReactNode;
"aria-label"?: string;
className?: string;
+ /** Content centered between the leading and trailing groups. */
+ center?: ReactNode;
/** Content pushed to the trailing edge. */
end?: ReactNode;
}
-export function CommandBar({ children, end, className, ...aria }: CommandBarProps) {
+export function CommandBar({ children, center, end, className, ...aria }: CommandBarProps) {
const bar = useRef<HTMLDivElement>(null);
const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
@@ -35,8 +37,9 @@ export function CommandBar({ children, end, className, ...aria }: CommandBarProp
buttons[(index + (event.key === "ArrowRight" ? 1 : -1) + buttons.length) % buttons.length]?.focus();
};
return (
- <div ref={bar} role="toolbar" aria-label={aria["aria-label"]} className={cx("ui-command-bar", className)} onKeyDown={onKeyDown}>
+ <div ref={bar} role="toolbar" aria-label={aria["aria-label"]} className={cx("ui-command-bar", Boolean(center) && "ui-command-bar--centered", className)} onKeyDown={onKeyDown}>
<div className="ui-command-bar__primary">{children}</div>
+ {center && <div className="ui-command-bar__center">{center}</div>}
{end && <div className="ui-command-bar__end">{end}</div>}
</div>
);
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index 492651c..21adb6d 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -492,11 +492,12 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
aria-label="Generator"
className="generator-command"
end={<>
+ <CommandBarButton icon={<Add16 />} label="Add scene" showLabel onClick={newScene} />
+ <CommandBarSeparator />
<CommandBarButton icon={density === "tiles" ? <GridView16Filled /> : <GridView16 />} label="Tiles" pressed={density === "tiles"} onClick={() => chooseDensity("tiles")} />
<CommandBarButton icon={density === "list" ? <ListView16Filled /> : <ListView16 />} label="List" pressed={density === "list"} onClick={() => chooseDensity("list")} />
</>}
- >
- {cancellable.length > 0
+ center={cancellable.length > 0
? <CommandBarButton
className="generator-command__cancel"
icon={<Stop14 />}
@@ -514,7 +515,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
disabled={active.length > 0}
onClick={() => void generateAll()}
/>}
- <CommandBarSeparator />
+ >
{/* The generator the next render uses, with its readiness as a glyph
beside the name; the words for a state that needs attention are
in the tooltip and the status bar. */}
@@ -532,8 +533,6 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
onChange={chooseGeneratorTemplate}
/>
</span>
- <CommandBarSeparator />
- <CommandBarButton icon={<Add16 />} label="Add scene" showLabel onClick={newScene} />
</CommandBar>
<div className="generator-board">
diff --git a/src/styles/generator.css b/src/styles/generator.css
index 43c03e1..123e468 100644
--- a/src/styles/generator.css
+++ b/src/styles/generator.css
@@ -46,6 +46,9 @@
background: var(--surface-chrome);
}
+.generator-command .generator-runtime { flex: 0 1 auto; }
+.generator-command .generator-template { min-width: 0; }
+
/* "Generate all" is the screen's one accent button, as in the mock: an accent
fill on the command bar's otherwise subtle row. */
.generator-command .generator-command__generate:not(:disabled) {
@@ -926,6 +929,7 @@
picker narrows, and the scene rows keep the title by dropping the caption
and the status chip — the status glyph beside the title still carries it. */
@container generator-main (max-width: 440px) {
+ .generator-command .generator-runtime__label { display: none; }
/* Visually hidden, not display:none — the label is the button's
accessible name. */
.generator-command .ui-cmd--labelled .ui-cmd__label {
diff --git a/src/styles/ui.css b/src/styles/ui.css
index 52a9173..813c7a0 100644
--- a/src/styles/ui.css
+++ b/src/styles/ui.css
@@ -1455,7 +1455,13 @@
padding: 0 var(--space-1);
}
+.ui-command-bar--centered {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
+}
+
.ui-command-bar__primary,
+.ui-command-bar__center,
.ui-command-bar__end {
min-width: 0;
display: flex;