Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Save, Undo and Redo follow the project name in the title bar

Bitti9b6450c5cd5b
diff --git a/src/components/ProjectWorkspace.tsx b/src/components/ProjectWorkspace.tsx
index e7079ec..8576441 100644
--- a/src/components/ProjectWorkspace.tsx
+++ b/src/components/ProjectWorkspace.tsx
@@ -92,8 +92,8 @@ function useWindowWidth(): number {
└───────────────────────────────────────────────────┘┃└─────────────────┘
The title bar is the caption AND the app's header (i-frame-1): Back, the
- project name (click for project settings), the view switcher as a
- SelectorBar (tabs, not links; Ctrl+1…4), Undo/Redo, Save, and the pane and
+ project name (click for project settings), Save, Undo/Redo, the view
+ switcher as a SelectorBar (tabs, not links; Ctrl+1…4), and the pane and
app buttons. The agent is a docked pane on the right with a Splitter;
Ctrl+Shift+A or the title-bar button shows and hides it, and both its width
and whether it is open are remembered.
@@ -240,10 +240,9 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
className="project-titlebar"
leading={<button type="button" className="icon-button" onClick={goBack} aria-label="Back to project library" data-tooltip="Back to projects" data-tooltip-shortcut="Alt+Left" aria-keyshortcuts="Alt+ArrowLeft"><Back16 /></button>}
title={<button type="button" className="project-title" aria-label={`Edit project settings for ${config.name}`} aria-haspopup="dialog" aria-expanded={editingProject} data-tooltip="Project settings" onClick={() => { session.dismissError(); setEditingProject(true); }}><span className="project-title__name">{config.name}</span><ChevronDown12 aria-hidden="true" /></button>}
- actions={<>
- <button type="button" className="icon-button" disabled={!canUndo} onClick={() => session.undo()} aria-label="Undo" data-tooltip="Undo" data-tooltip-shortcut="Ctrl+Z" aria-keyshortcuts="Control+Z"><Undo16 /></button>
- <button type="button" className="icon-button" disabled={!canRedo} onClick={() => session.redo()} aria-label="Redo" data-tooltip="Redo" data-tooltip-shortcut="Ctrl+Y" aria-keyshortcuts="Control+Y Control+Shift+Z"><Redo16 /></button>
- <span className="titlebar-separator" aria-hidden="true" />
+ /* Save, then Undo and Redo, right after the project's name: the commands
+ about the document sit with the document's title. */
+ afterTitle={<>
<div className="project-commands">
{/* The standing "All changes saved" pill is gone; the button itself is
the save state. Off means the file on disk already matches what is
@@ -252,7 +251,10 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
<Save16 aria-hidden="true" /> {saving ? "Saving…" : "Save"}
</button>
</div>
- <span className="titlebar-separator" aria-hidden="true" />
+ <button type="button" className="icon-button" disabled={!canUndo} onClick={() => session.undo()} aria-label="Undo" data-tooltip="Undo" data-tooltip-shortcut="Ctrl+Z" aria-keyshortcuts="Control+Z"><Undo16 /></button>
+ <button type="button" className="icon-button" disabled={!canRedo} onClick={() => session.redo()} aria-label="Redo" data-tooltip="Redo" data-tooltip-shortcut="Ctrl+Y" aria-keyshortcuts="Control+Y Control+Shift+Z"><Redo16 /></button>
+ </>}
+ actions={<>
<button ref={agentToggle} type="button" className={`icon-button${agentOpen ? " icon-button--checked" : ""}${agentBusy ? " icon-button--busy" : ""}`} aria-label="Agent" aria-pressed={agentOpen} aria-busy={agentBusy} aria-controls={`${panelId}-agent`} data-tooltip={`${agentOpen ? "Hide agent" : "Show agent"}${agentBusy ? " · working" : ""}`} data-tooltip-shortcut="Ctrl+Shift+A" aria-keyshortcuts="Control+Shift+A" onClick={toggleAgent}>{agentOpen ? <Agent16Filled /> : <Agent16 />}</button>
{titleBarActions}
</>}
diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsx
index 6864131..2cc246d 100644
--- a/src/components/TitleBar.tsx
+++ b/src/components/TitleBar.tsx
@@ -28,6 +28,8 @@ export interface TitleBarProps {
icon?: ReactNode | false;
/** Before the icon, e.g. a Back button. */
leading?: ReactNode;
+ /** Right after the title, e.g. a project's Save and Undo/Redo. */
+ afterTitle?: ReactNode;
/** The flexible middle, e.g. a search box or tabs. Fills the free width. */
children?: ReactNode;
/** Right-aligned, just before the caption buttons, e.g. Save. */
@@ -62,6 +64,7 @@ export function TitleBar({
secondary,
icon: customIcon,
leading,
+ afterTitle,
children,
actions,
className,
@@ -83,6 +86,7 @@ export function TitleBar({
<span className="titlebar__title">{title}</span>
{secondary && <span className="titlebar__secondary">{secondary}</span>}
</div>
+ {afterTitle && <div className="titlebar__after-title">{afterTitle}</div>}
<div className="titlebar__middle">{children}</div>
{actions && <div className="titlebar__actions">{actions}</div>}
{/* Not tab stops, like Windows' own: the keyboard reaches them through
diff --git a/src/styles/titlebar.css b/src/styles/titlebar.css
index 6b7adda..ce96bae 100644
--- a/src/styles/titlebar.css
+++ b/src/styles/titlebar.css
@@ -34,6 +34,7 @@
}
.titlebar__leading,
+.titlebar__after-title,
.titlebar__actions {
display: flex;
align-items: center;
@@ -50,6 +51,10 @@
padding: 0 var(--space-2);
}
+.titlebar__after-title {
+ padding-right: var(--space-2);
+}
+
.titlebar__identity {
display: flex;
align-items: center;