Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Rebuild the app frame on the title bar, Fluent dialogs and flyouts

Bitti6f9d996d0998
diff --git a/src/App.tsx b/src/App.tsx
index 86365c2..5f6613c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -4,19 +4,20 @@ import { ReferenceIconGenerationDialog } from "./components/ReferenceIconGenerat
import { CudaSetupDialog } from "./components/CudaSetupDialog";
import { missingCudaDownload } from "./lib/cudaSupport";
import { getWeightDownloadState, subscribeWeightDownloads } from "./lib/weightDownloads";
-import { invoke } from "@tauri-apps/api/core";
-import { listen } from "@tauri-apps/api/event";
import { FolderOpen, Grid2X2, List, ListTodo, Plus, Search, Settings } from "lucide-react";
-import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
-import { Brand } from "./components/Brand";
-import { DeleteProjectDialog } from "./components/DeleteProjectDialog";
-import { ExitGuardDialog, type OngoingGeneration } from "./components/ExitGuardDialog";
+import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type KeyboardEvent, type RefObject } from "react";
+import { DeleteProjectDialog, canConfirmNatively, confirmProjectDeletionNatively } from "./components/DeleteProjectDialog";
import { ProjectCard } from "./components/ProjectCard";
import { ProjectWorkspace, type ProjectView } from "./components/ProjectWorkspace";
import { PromptComposer } from "./components/PromptComposer";
import { SettingsView } from "./components/SettingsView";
-import { UpdatePanel, UpdateProgress } from "./components/UpdatePanel";
+import { TitleBar } from "./components/TitleBar";
+import { UpdateInfoBar, UpdatePanel, updateNeedsAttention } from "./components/UpdatePanel";
+import { CommandBar, CommandBarButton, CommandBarSeparator, InfoBadge, InfoBar, TextField } from "./components/ui";
import { AppUpdater } from "./lib/updater";
+import { useShortcut } from "./lib/commands";
+import { useGuardedShortcut } from "./lib/shellKeys";
+import { reportGenerationJobs, revealInExplorer, type GuardJob } from "./lib/nativeShell";
import { describeDiagnosticError, errorContext, writeDiagnostic } from "./lib/diagnostics";
import { chooseAndOpenProject, chooseNewProjectFolder, inspectNewProjectFolder, createProject, deleteProject, isTauri, listRecentProjects, saveProject, type NewProjectFolder } from "./lib/persistence";
import type { CreateProjectInput, ProjectRecord } from "./lib/project";
@@ -34,6 +35,14 @@ const logFailure = (event: string, reason: unknown, context: Record<string, unkn
writeDiagnostic("error", "app", event, describeDiagnosticError(reason), { ...context, ...errorContext(reason) });
};
+/* ── The app frame ────────────────────────────────────────────────────────
+ The window is frameless, so every top-level screen — the library, an open
+ project, Settings — carries a <TitleBar> as its first row: it is what drags,
+ maximizes and closes the window. App-wide commands live at the trailing end
+ of it, just before the caption buttons: Settings (with a dot when an update
+ is waiting) and the Work queue (with an InfoBadge counting what is
+ running). Nothing floats in a corner of the window any more (i-frame-5). */
+
function App() {
const [projects, setProjects] = useState<ProjectRecord[]>([]);
const [workQueue] = useState(() => new WorkQueue(async (record) => {
@@ -52,6 +61,7 @@ function App() {
const [busy, setBusy] = useState(false);
const [query, setQuery] = useState("");
const [projectLayout, setProjectLayout] = useState<"grid" | "list">("grid");
+ const [selectedKey, setSelectedKey] = useState<string | null>(null);
const [error, setError] = useState<LibraryError | null>(null);
const [newProjectOpen, setNewProjectOpen] = useState(false);
const [newProjectFolder, setNewProjectFolder] = useState<NewProjectFolder | null>(null);
@@ -84,6 +94,7 @@ function App() {
const [settingsInitialTab, setSettingsInitialTab] = useState<"engine" | "updates">("engine");
const [updater] = useState(() => new AppUpdater());
const updateState = useSyncExternalStore(updater.subscribe, updater.getSnapshot);
+ const [updateInfoDismissed, setUpdateInfoDismissed] = useState(false);
useEffect(() => { void updater.start(); }, [updater]);
const updateGuard = useRef<() => string | null>(() => null);
updateGuard.current = () => activeProject
@@ -93,10 +104,15 @@ function App() {
: workQueue.updateBlockReason();
const updateBlockReason = useCallback(() => updateGuard.current(), []);
const updatePanel = <UpdatePanel updater={updater} blockReason={updateBlockReason} />;
- const updateNotice = ["available", "restart"].includes(updateState.stage) && !settingsOpen
- ? <button className="secondary-button update-notice" onClick={() => { setSettingsInitialTab("updates"); setSettingsOpen(true); }}>{updateState.stage === "restart" ? "Restart to finish updating Slopus" : `Slopus ${updateState.version} is available`}</button> : null;
const [settingsRevision, setSettingsRevision] = useState(0);
const settingsButton = useRef<HTMLButtonElement>(null);
+ const queueButton = useRef<HTMLButtonElement>(null);
+ const settingsQueueButton = useRef<HTMLButtonElement>(null);
+ const openSettings = (tab: "engine" | "updates" = "engine") => {
+ setWorkQueueOpen(false);
+ setSettingsInitialTab(tab);
+ setSettingsOpen(true);
+ };
const closeSettings = () => {
setSettingsOpen(false);
setSettingsRevision((value) => value + 1);
@@ -111,42 +127,21 @@ function App() {
const cudaDownload = !cudaNoticeDismissed && isTauri() ? missingCudaDownload(runtime?.slopfab) : null;
const searchInput = useRef<HTMLInputElement>(null);
- /* ── Exit guard: the window's close button ───────────────────────────────
+ /* ── Exit guard ─────────────────────────────────────────────────────────
The video engine runs inside this process, so closing the window ends a
- generation outright, and nothing partial is written on the way. The app
- queue reports work across all projects; Rust holds the close request back
- only for video work. Icons can be interrupted safely. This is where the question is put
- and answered. See the fenced block in src-tauri/src/window.rs. */
- const ongoingGenerations: OngoingGeneration[] = workItems.filter((item) => item.kind !== "reference-icons" && isWorkActive(item)).map((item) => ({ id: item.id, title: `${item.title} · ${item.projectName}`, running: item.status !== "queued" }));
- const [closeRequested, setCloseRequested] = useState(false);
-
- const answerClose = useCallback((confirmed: boolean) => {
- setCloseRequested(false);
- if (isTauri()) void invoke("answer_app_close", { confirmed }).catch(() => undefined);
- }, []);
-
+ generation outright, and nothing partial is written on the way. Rust asks
+ the question itself, as a native message box, when the close button is
+ pressed (src-tauri/src/window.rs); all the page does is keep it told
+ which jobs would be lost. Icons are not on the list: they can be
+ interrupted safely. */
+ const guardJobs: GuardJob[] = workItems
+ .filter((item) => item.kind !== "reference-icons" && isWorkActive(item))
+ .map((item) => ({ title: `${item.title} · ${item.projectName}`, running: item.status !== "queued" }));
+ const guardKey = JSON.stringify(guardJobs);
useEffect(() => {
- if (!isTauri()) return;
- void invoke("set_generation_active", { active: ongoingGenerations.length > 0 }).catch(() => undefined);
- }, [ongoingGenerations.length]);
-
- useEffect(() => {
- if (!isTauri()) return;
- let disposed = false;
- const subscription = listen("app-close-requested", () => { if (!disposed) setCloseRequested(true); });
- return () => { disposed = true; void subscription.then((stop) => stop()).catch(() => undefined); };
- }, []);
-
- /* The last shot can finish between the click on the close button and this
- question reaching the screen. There is then nothing to warn about, and a
- dialog listing no shots would be the app refusing to close for no reason. */
- useEffect(() => {
- if (closeRequested && ongoingGenerations.length === 0) answerClose(true);
- }, [closeRequested, ongoingGenerations.length, answerClose]);
-
- const exitGuard = closeRequested && ongoingGenerations.length > 0
- ? <ExitGuardDialog jobs={ongoingGenerations} onConfirm={() => answerClose(true)} onCancel={() => answerClose(false)} />
- : null;
+ void reportGenerationJobs(JSON.parse(guardKey) as GuardJob[]).catch(() => undefined);
+ }, [guardKey]);
+ const queueCount = guardJobs.length + Number(weightDownloadActive);
useEffect(() => {
void listRecentProjects()
@@ -184,18 +179,6 @@ function App() {
return () => { live = false; };
}, [settingsRevision]);
- useEffect(() => {
- const focusSearch = (event: KeyboardEvent) => {
- if (settingsOpen) return;
- if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "k") {
- event.preventDefault();
- searchInput.current?.focus();
- }
- };
- window.addEventListener("keydown", focusSearch);
- return () => window.removeEventListener("keydown", focusSearch);
- }, [settingsOpen]);
-
const filteredProjects = useMemo(() => {
const normalized = query.trim().toLowerCase();
if (!normalized) return projects;
@@ -204,6 +187,13 @@ function App() {
);
}, [projects, query]);
+ const openProject = (project: ProjectRecord, view: ProjectView = "timeline") => {
+ setWorkQueueOpen(false);
+ setSelectedKey(projectQueueKey(project));
+ setActiveProjectInitialView(view);
+ setActiveProject(project);
+ };
+
const openFromFolder = async () => {
setBusy(true);
setError(null);
@@ -211,8 +201,7 @@ function App() {
const project = await chooseAndOpenProject();
if (!project) return;
setProjects((current) => [project, ...current.filter((item) => item.config.id !== project.config.id)]);
- setActiveProjectInitialView("timeline");
- setActiveProject(project);
+ openProject(project);
} catch (reason) {
logFailure("project.open_failed", reason);
setError({ title: "Couldn’t open that folder", detail: describe(reason) });
@@ -246,10 +235,10 @@ function App() {
if (!project) return;
setProjects((current) => [project, ...current]);
setNewProjectOpen(false);
- // Creative direction now begins in the Agent page; project creation only
- // establishes the empty workspace and its format.
- setActiveProjectInitialView("agent");
- setActiveProject(project);
+ // Creative direction begins with the Agent; project creation only
+ // establishes the empty workspace and its format, so the new project
+ // opens with the agent pane showing.
+ openProject(project, "agent");
} catch (reason) {
logFailure("project.create_failed", reason);
setNewProjectError(describe(reason));
@@ -261,9 +250,8 @@ function App() {
}
};
- const confirmProjectDeletion = async () => {
- if (!projectToDelete || deletingProject) return;
- const target = projectToDelete;
+ const deleteNow = async (target: ProjectRecord) => {
+ if (deletingProject) return;
setDeletingProject(true);
setError(null);
try {
@@ -274,105 +262,209 @@ function App() {
setProjectToDelete(null);
} catch (reason) {
logFailure("project.delete_failed", reason, { projectId: target.config.id });
+ setProjectToDelete(null);
setError({ title: "Couldn’t delete that project", detail: describe(reason) });
} finally {
setDeletingProject(false);
}
};
- /* Anchored bottom-left in every view, project editor included: the engine
- paths it holds are what makes generation work at all, and finding out they
- are wrong happens inside a project, not in the library. */
- const settingsLauncher = (
- <button ref={settingsButton} className="settings-launcher" type="button" onClick={() => { setSettingsInitialTab("engine"); setSettingsOpen(true); }} title="Settings" aria-label="Settings">
- <Settings size={22} aria-hidden="true" />
- </button>
- );
+ /* A yes/no question, so the desktop app asks it with the system's message
+ box; the browser build falls back to the same question as a dialog. */
+ const requestDelete = async (project: ProjectRecord) => {
+ if (!canConfirmNatively()) { setProjectToDelete(project); return; }
+ if (await confirmProjectDeletionNatively(project)) await deleteNow(project);
+ };
- const queueLauncher = <button className="settings-launcher work-queue-launcher" type="button" onClick={() => setWorkQueueOpen(true)} title="Work Queue" aria-label="Work Queue" aria-haspopup="dialog" aria-expanded={workQueueOpen}>
- <ListTodo size={22} aria-hidden="true" />{ongoingGenerations.length + Number(weightDownloadActive) > 0 && <b>{ongoingGenerations.length + Number(weightDownloadActive)}</b>}
- </button>;
- const queuePanel = workQueueOpen ? <WorkQueuePanel queue={workQueue} items={workItems} onClose={() => setWorkQueueOpen(false)} /> : null;
- const cudaNotice = cudaDownload && !settingsOpen && !workQueueOpen && !closeRequested && !projectToDelete && !newProjectOpen
+ const revealProject = (project: ProjectRecord) => {
+ void revealInExplorer(project.folderPath).catch((reason: unknown) => {
+ setError({ title: "Couldn’t show the project folder", detail: describe(reason) });
+ });
+ };
+
+ /* ── Accelerators (i-frame-4) ─────────────────────────────────────────── */
+ const inLibrary = !activeProject && !settingsOpen;
+ useShortcut("Ctrl+,", () => openSettings(), { enabled: !settingsOpen, allowInInput: true });
+ useShortcut("Ctrl+N", () => { if (!busy) void chooseCreationFolder(); }, { enabled: inLibrary, allowInInput: true });
+ useShortcut("Ctrl+O", () => { if (!busy) void openFromFolder(); }, { enabled: inLibrary, allowInInput: true });
+ useGuardedShortcut("Ctrl+F", () => { searchInput.current?.focus(); searchInput.current?.select(); }, { enabled: inLibrary, allowInInput: true });
+ useGuardedShortcut("Alt+ArrowLeft", closeSettings, { enabled: settingsOpen });
+
+ const queueFlyout = <WorkQueuePanel queue={workQueue} items={workItems} open={workQueueOpen} anchor={settingsOpen ? settingsQueueButton : queueButton} onClose={() => setWorkQueueOpen(false)} />;
+ const cudaNotice = cudaDownload && !settingsOpen && !workQueueOpen && !projectToDelete && !newProjectOpen
? <CudaSetupDialog download={cudaDownload} onContinue={() => setCudaNoticeDismissed(true)} /> : null;
- const iconConfirmation = iconConfirmationCount > 0 && !cudaNotice && !settingsOpen && !workQueueOpen && !closeRequested && !projectToDelete && !newProjectOpen
+ const iconConfirmation = iconConfirmationCount > 0 && !cudaNotice && !settingsOpen && !workQueueOpen && !projectToDelete && !newProjectOpen
? <ReferenceIconGenerationDialog count={iconConfirmationCount} onAnswer={workQueue.answerIconConfirmation} /> : null;
+ const queueTrigger = (ref: RefObject<HTMLButtonElement>) => (
+ <button ref={ref} type="button" className="icon-button titlebar-command" onClick={() => setWorkQueueOpen((open) => !open)}
+ aria-label="Work queue" aria-haspopup="dialog" aria-expanded={workQueueOpen} data-tooltip={queueCount ? `Work queue · ${queueCount} running or queued` : "Work queue"}>
+ <ListTodo size={16} aria-hidden="true" />
+ {queueCount > 0 && <InfoBadge className="titlebar-command__badge" value={queueCount} />}
+ </button>
+ );
+ const shellActions = <>
+ <button ref={settingsButton} type="button" className="icon-button titlebar-command" onClick={() => openSettings(updateNeedsAttention(updateState.stage) ? "updates" : "engine")}
+ aria-label="Settings" data-tooltip={updateNeedsAttention(updateState.stage) ? "Settings · update available" : "Settings"} data-tooltip-shortcut="Ctrl+," aria-keyshortcuts="Control+,">
+ <Settings size={16} aria-hidden="true" />
+ {updateNeedsAttention(updateState.stage) && <InfoBadge className="titlebar-command__badge titlebar-command__badge--dot" />}
+ </button>
+ {queueTrigger(queueButton)}
+ </>;
+
+ /* Settings is a page of its own under its own title bar, not an overlay.
+ The screen behind it stays mounted and hidden, so an open project keeps
+ its unsaved edits, the agent its draft, and the library its search. */
+ const settingsPage = settingsOpen ? (
+ <div className="app-screen app-screen--settings">
+ <TitleBar title="Settings" actions={queueTrigger(settingsQueueButton)} />
+ <div className="app-screen__content">
+ <SettingsView onClose={closeSettings} updates={updatePanel} initialTab={settingsInitialTab} />
+ </div>
+ </div>
+ ) : null;
+
if (activeProject) {
- return <>
- <div hidden={settingsOpen}>
- <ProjectWorkspace key={projectQueueKey(activeProject)} project={activeProject} initialView={activeProjectInitialView} runtime={runtime} workQueue={workQueue} onGeneratorRuntimeChange={(slopfab) => setRuntime((current) => ({ providers: current?.providers ?? CHECKING_PROVIDERS, slopfab }))} onBack={() => setActiveProject(null)} onSave={async () => { await workQueue.project(activeProject).save(); }} />
- {settingsLauncher}
- {queueLauncher}
- {queuePanel}
+ return <div className="app-shell">
+ <div className="app-screen" hidden={settingsOpen}>
+ <ProjectWorkspace
+ key={projectQueueKey(activeProject)}
+ project={activeProject}
+ initialView={activeProjectInitialView}
+ runtime={runtime}
+ workQueue={workQueue}
+ active={!settingsOpen}
+ titleBarActions={shellActions}
+ onGeneratorRuntimeChange={(slopfab) => setRuntime((current) => ({ providers: current?.providers ?? CHECKING_PROVIDERS, slopfab }))}
+ onBack={() => setActiveProject(null)}
+ onSave={async () => { await workQueue.project(activeProject).save(); }}
+ />
</div>
- {settingsOpen && <SettingsView onClose={closeSettings} updates={updatePanel} initialTab={settingsInitialTab} />}
- {updateNotice}
- <UpdateProgress updater={updater} />
+ {settingsPage}
+ {queueFlyout}
{iconConfirmation}
{cudaNotice}
- {exitGuard}
- </>;
+ </div>;
}
+ /* Library keyboard: the tiles are one listbox with a roving tab stop.
+ Arrows move (Up/Down by a row of the grid), Home/End jump, Enter opens,
+ Delete asks to delete. */
+ const selectedIndex = filteredProjects.findIndex((project) => projectQueueKey(project) === selectedKey);
+ const focusTile = (index: number, grid: HTMLElement) => {
+ const project = filteredProjects[index];
+ if (!project) return;
+ setSelectedKey(projectQueueKey(project));
+ grid.querySelectorAll<HTMLElement>("[role=option]")[index]?.focus();
+ };
+ const onGridKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
+ const tiles = [...event.currentTarget.querySelectorAll<HTMLElement>("[role=option]")];
+ const at = tiles.indexOf(document.activeElement as HTMLElement);
+ if (at < 0) return;
+ const columns = projectLayout === "list" ? 1 : Math.max(1, tiles.filter((tile) => tile.offsetTop === tiles[0].offsetTop).length);
+ let next: number | undefined;
+ if (event.key === "ArrowRight") next = Math.min(tiles.length - 1, at + 1);
+ else if (event.key === "ArrowLeft") next = Math.max(0, at - 1);
+ else if (event.key === "ArrowDown") next = Math.min(tiles.length - 1, at + columns);
+ else if (event.key === "ArrowUp") next = Math.max(0, at - columns);
+ else if (event.key === "Home") next = 0;
+ else if (event.key === "End") next = tiles.length - 1;
+ else if (event.key === "Delete" && filteredProjects[at]) { event.preventDefault(); void requestDelete(filteredProjects[at]); return; }
+ if (next === undefined) return;
+ event.preventDefault();
+ focusTile(next, event.currentTarget);
+ };
+
+ const showUpdateInfo = ["downloading", "installing", "restart"].includes(updateState.stage) || (updateState.stage === "available" && !updateInfoDismissed);
+ const newProjectButton = (
+ <button type="button" className="primary-button" disabled={busy} onClick={() => void chooseCreationFolder()} data-tooltip="New project" data-tooltip-shortcut="Ctrl+N" aria-keyshortcuts="Control+N">
+ <Plus size={16} aria-hidden="true" /> New project
+ </button>
+ );
+
return (
<div className="app-shell">
- <div hidden={settingsOpen}>
- <main className="library">
- <header className="library__topbar">
- <Brand />
- <div className="search-field"><Search size={17} /><input ref={searchInput} value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Search projects" aria-label="Search projects" /><kbd>Ctrl K</kbd></div>
- <button className="secondary-button" onClick={() => void openFromFolder()}><FolderOpen size={17} /> Open project</button>
- <button className="primary-button" disabled={busy} onClick={() => void chooseCreationFolder()}><Plus size={17} /> New project</button>
- </header>
- <div className="library__content">
- <section className="recent-projects" aria-labelledby="recent-heading">
- <div className="section-heading">
- <div>
- <h2 id="recent-heading">Your projects</h2>
- <span>{filteredProjects.length} {filteredProjects.length === 1 ? "project" : "projects"}</span>
- </div>
- <div className="view-controls" aria-label="Project layout">
- <button className={`icon-button ${projectLayout === "grid" ? "icon-button--active" : ""}`} aria-label="Grid view" aria-pressed={projectLayout === "grid"} onClick={() => setProjectLayout("grid")}><Grid2X2 size={17} /></button>
- <button className={`icon-button ${projectLayout === "list" ? "icon-button--active" : ""}`} aria-label="List view" aria-pressed={projectLayout === "list"} onClick={() => setProjectLayout("list")}><List size={17} /></button>
- </div>
- </div>
+ <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>
+
+ <section className="library__section" aria-labelledby="all-projects-heading">
+ <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>
{loading ? (
- <div className="project-grid">{[0, 1, 2].map((item) => <div className="project-skeleton" key={item}><i /><span /><small /></div>)}</div>
+ <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 ? (
- <div className={`project-grid project-grid--${projectLayout}`}>{filteredProjects.map((project, index) => <ProjectCard key={`${project.config.id}-${project.folderPath}`} project={project} index={index} onOpen={(selected) => { setActiveProjectInitialView("timeline"); setActiveProject(selected); }} onDelete={setProjectToDelete} />)}</div>
+ <div className={`project-grid project-grid--${projectLayout}`} role="listbox" aria-label="Projects" onKeyDown={onGridKeyDown}>
+ {filteredProjects.map((project, index) => {
+ const key = projectQueueKey(project);
+ const selected = key === selectedKey;
+ return <ProjectCard
+ key={`${project.config.id}-${project.folderPath}`}
+ project={project}
+ layout={projectLayout}
+ selected={selected}
+ tabIndex={selected || (selectedIndex < 0 && index === 0) ? 0 : -1}
+ onSelect={(chosen) => setSelectedKey(projectQueueKey(chosen))}
+ onOpen={(chosen) => openProject(chosen)}
+ onDelete={(chosen) => void requestDelete(chosen)}
+ onReveal={isTauri() ? revealProject : undefined}
+ />;
+ })}
+ </div>
) : query ? (
<div className="library-empty">
- <FolderOpen size={28} />
- <h3>Nothing matches “{query}”</h3>
- <p>Search looks at project names, descriptions, and folder paths. Try a shorter word, or clear the search to see everything.</p>
- <button className="secondary-button" onClick={() => setQuery("")}>Clear search</button>
+ <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>
) : (
<div className="library-empty">
- <FolderOpen size={28} />
+ <FolderOpen size={48} aria-hidden="true" />
<h3>No projects yet</h3>
- <p>Create a project, then tell the Agent what you want to make.</p>
- <p className="library-empty__aside">Already made one on this computer?</p>
- <button className="secondary-button" onClick={() => void openFromFolder()}><FolderOpen size={17} /> Open project</button>
+ <p>Create a project or open an existing project folder.</p>
+ <div className="library-empty__actions">
+ {newProjectButton}
+ <button type="button" className="secondary-button" disabled={busy} onClick={() => void openFromFolder()}><FolderOpen size={16} aria-hidden="true" /> Open project…</button>
+ </div>
</div>
)}
</section>
- </div>
- </main>
- {settingsLauncher}
- {queueLauncher}
- {queuePanel}
- {newProjectOpen && <PromptComposer busy={busy} folderPath={newProjectFolder?.folderPath} folderError={newProjectFolder?.error} checkingFolder={checkingProjectFolder} onChooseFolder={chooseCreationFolder} error={newProjectError} onCreate={createFromPrompt} onClose={() => { setNewProjectOpen(false); setNewProjectFolder(null); setNewProjectError(null); }} />}
+ </main>
+ {newProjectOpen && <PromptComposer busy={busy} folderPath={newProjectFolder?.folderPath} folderError={newProjectFolder?.error} checkingFolder={checkingProjectFolder} onChooseFolder={chooseCreationFolder} error={newProjectError} onCreate={createFromPrompt} onClose={() => { setNewProjectOpen(false); setNewProjectFolder(null); setNewProjectError(null); }} />}
</div>
- {settingsOpen && <SettingsView onClose={closeSettings} updates={updatePanel} initialTab={settingsInitialTab} />}
- {updateNotice}
- <UpdateProgress updater={updater} />
- {projectToDelete && <DeleteProjectDialog project={projectToDelete} deleting={deletingProject} onConfirm={() => void confirmProjectDeletion()} onCancel={() => setProjectToDelete(null)} />}
+ {settingsPage}
+ {queueFlyout}
+ {projectToDelete && <DeleteProjectDialog project={projectToDelete} deleting={deletingProject} onConfirm={() => void deleteNow(projectToDelete)} onCancel={() => setProjectToDelete(null)} />}
{iconConfirmation}
{cudaNotice}
- {exitGuard}
- {error && <div className="toast" role="alert"><strong>{error.title}</strong><span>{error.detail}</span><button onClick={() => setError(null)}>Dismiss</button></div>}
</div>
);
}
diff --git a/src/components/Brand.tsx b/src/components/Brand.tsx
deleted file mode 100644
index 8bc0267..0000000
--- a/src/components/Brand.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { SlopusLogo } from "./SlopusLogo";
-
-export function Brand({ compact = false }: { compact?: boolean }) {
- return (
- <div className={compact ? "brand brand--compact" : "brand"} role="img" aria-label="Slopus">
- <SlopusLogo compact={compact} decorative />
- {!compact && <span className="brand__wordmark">Slopus</span>}
- {!compact && <span className="brand__edition">ALPHA</span>}
- </div>
- );
-}
diff --git a/src/components/CudaSetupDialog.tsx b/src/components/CudaSetupDialog.tsx
index bfdba76..47502d6 100644
--- a/src/components/CudaSetupDialog.tsx
+++ b/src/components/CudaSetupDialog.tsx
@@ -1,67 +1,38 @@
import { invoke } from "@tauri-apps/api/core";
-import { Info } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { useState } from "react";
import type { CudaDownload } from "../lib/cudaSupport";
+import { ContentDialog, InfoBar } from "./ui";
+/* Shown once at startup when an NVIDIA card is present but no usable CUDA is.
+ [Download CUDA] opens NVIDIA's page in the browser and closes the dialog;
+ [Continue with Vulkan] (and Esc) just closes it. If the browser cannot be
+ opened the dialog stays, with the reason, and the link as text. */
export function CudaSetupDialog({ download, onContinue }: { download: CudaDownload; onContinue: () => void }) {
- const dialog = useRef<HTMLDivElement>(null);
- const proceed = useRef<HTMLButtonElement>(null);
const [error, setError] = useState<string | null>(null);
-
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- proceed.current?.focus();
- return () => opener?.focus?.();
- }, []);
-
- useEffect(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- event.preventDefault();
- event.stopImmediatePropagation();
- onContinue();
- }
- if (event.key !== "Tab" || !dialog.current) return;
- const stops = Array.from(dialog.current.querySelectorAll<HTMLElement>("a[href], button"));
- const first = stops[0], last = stops[stops.length - 1];
- const active = document.activeElement as HTMLElement | null;
- if (!event.shiftKey && (active === last || !dialog.current.contains(active))) {
- event.preventDefault();
- first.focus();
- } else if (event.shiftKey && (active === first || !dialog.current.contains(active))) {
- event.preventDefault();
- last.focus();
- }
- };
- window.addEventListener("keydown", onKeyDown, true);
- return () => window.removeEventListener("keydown", onKeyDown, true);
- }, [onContinue]);
+ const cuda = download.version === "12.8" ? "CUDA 12.8" : "CUDA";
const openDownload = async () => {
setError(null);
try {
await invoke("open_cuda_download", { version: download.version });
+ onContinue();
} catch (reason) {
setError(reason instanceof Error ? reason.message : String(reason));
}
};
- return <div className="exit-guard-backdrop">
- <div className="exit-guard" ref={dialog} role="dialog" aria-modal="true" aria-labelledby="cuda-setup-title" aria-describedby="cuda-setup-description">
- <div className="exit-guard__head">
- <span className="exit-guard__mark" aria-hidden="true"><Info size={20} /></span>
- <h2 id="cuda-setup-title">Install CUDA for faster generation</h2>
- </div>
- <div className="exit-guard__body" id="cuda-setup-description">
- <p>Slopus detected your {download.gpuName}, but could not find a usable CUDA installation.</p>
- <p>You can continue using the Vulkan fallback backend, with longer generation times.</p>
- <p>For faster generation, install {download.version === "12.8" ? "CUDA 12.8" : "CUDA"} and restart Slopus.</p>
- <p><a className="cuda-setup-download" href={download.url} target="_blank" rel="noreferrer" onClick={(event) => { event.preventDefault(); void openDownload(); }}>Download {download.version === "12.8" ? "CUDA 12.8" : "CUDA"} from NVIDIA</a></p>
- {error && <p role="alert">{error}</p>}
- </div>
- <div className="exit-guard__actions">
- <button className="primary-button" type="button" ref={proceed} onClick={onContinue}>Continue with Vulkan</button>
- </div>
- </div>
- </div>;
+ return (
+ <ContentDialog
+ title="Install CUDA for faster generation"
+ primaryText={`Download ${cuda}`}
+ onPrimary={() => void openDownload()}
+ closeText="Continue with Vulkan"
+ onClose={onContinue}
+ defaultButton="primary"
+ >
+ <p>Slopus found your {download.gpuName} but no usable CUDA installation.</p>
+ <p>Slopus can use the Vulkan fallback backend, with longer generation times. For faster generation, install {cuda} from NVIDIA and restart Slopus.</p>
+ {error && <InfoBar severity="error" title="Couldn’t open the browser" message={<>{error} Go to <span className="dialog-path">{download.url}</span></>} />}
+ </ContentDialog>
+ );
}
diff --git a/src/components/DeleteProjectDialog.tsx b/src/components/DeleteProjectDialog.tsx
index e0ed76a..b287f23 100644
--- a/src/components/DeleteProjectDialog.tsx
+++ b/src/components/DeleteProjectDialog.tsx
@@ -1,8 +1,25 @@
-import { AlertTriangle, LoaderCircle, Trash2 } from "lucide-react";
-import { useEffect, useRef } from "react";
import type { ProjectRecord } from "../lib/project";
+import { askNative, inTauri } from "../lib/nativeShell";
+import { ContentDialog } from "./ui";
-const FOCUSABLE = "button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])";
+const question = (project: ProjectRecord) => ({
+ title: `Delete “${project.config.name}”?`,
+ message: "This permanently deletes the project folder and every file inside it. This can't be undone.",
+});
+
+/* Deleting a project is a plain yes/no question, so in the desktop app it is
+ the system's own message box (askNative). The browser build and the tests
+ have no message box to ask with — askNative answers "no" there — so they
+ get the same question as a ContentDialog instead. */
+
+/** Asks with the native message box. Resolves false outside the desktop app. */
+export function confirmProjectDeletionNatively(project: ProjectRecord): Promise<boolean> {
+ const { title, message } = question(project);
+ return askNative({ title, message: `${message}\n\n${project.folderPath}`, kind: "warning", okLabel: "Delete", cancelLabel: "Cancel" });
+}
+
+/** True when the question can be put as a native message box. */
+export const canConfirmNatively = () => inTauri();
export function DeleteProjectDialog({ project, deleting, onConfirm, onCancel }: {
project: ProjectRecord;
@@ -10,59 +27,21 @@ export function DeleteProjectDialog({ project, deleting, onConfirm, onCancel }:
onConfirm: () => void;
onCancel: () => void;
}) {
- const dialog = useRef<HTMLDivElement>(null);
- const cancel = useRef<HTMLButtonElement>(null);
-
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- cancel.current?.focus();
- return () => opener?.focus?.();
- }, []);
-
- useEffect(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape" && !deleting) {
- event.preventDefault();
- onCancel();
- return;
- }
- if (event.key !== "Tab" || !dialog.current) return;
- const stops = Array.from(dialog.current.querySelectorAll<HTMLElement>(FOCUSABLE));
- if (stops.length === 0) {
- event.preventDefault();
- return;
- }
- const first = stops[0];
- const last = stops[stops.length - 1];
- const active = document.activeElement as HTMLElement | null;
- if (!event.shiftKey && (active === last || !dialog.current.contains(active))) {
- event.preventDefault();
- first.focus();
- } else if (event.shiftKey && (active === first || !dialog.current.contains(active))) {
- event.preventDefault();
- last.focus();
- }
- };
- window.addEventListener("keydown", onKeyDown, true);
- return () => window.removeEventListener("keydown", onKeyDown, true);
- }, [deleting, onCancel]);
-
- return <div className="delete-project-backdrop" onMouseDown={(event) => { if (!deleting && event.target === event.currentTarget) onCancel(); }}>
- <div className="delete-project-dialog" ref={dialog} role="alertdialog" aria-modal="true" aria-labelledby="delete-project-title" aria-describedby="delete-project-description">
- <div className="delete-project-dialog__head">
- <span aria-hidden="true"><AlertTriangle size={20} /></span>
- <h2 id="delete-project-title">Delete “{project.config.name}”?</h2>
- </div>
- <div className="delete-project-dialog__body" id="delete-project-description">
- <p>This permanently deletes the project folder and every file inside it. This cannot be undone.</p>
- <code title={project.folderPath}>{project.folderPath}</code>
- </div>
- <div className="delete-project-dialog__actions">
- <button className="secondary-button" type="button" ref={cancel} disabled={deleting} onClick={onCancel}>Cancel</button>
- <button className="delete-project-dialog__confirm" type="button" disabled={deleting} onClick={onConfirm}>
- {deleting ? <><LoaderCircle className="spin" size={16} /> Deleting…</> : <><Trash2 size={16} /> Delete project</>}
- </button>
- </div>
- </div>
- </div>;
+ const { title, message } = question(project);
+ return (
+ <ContentDialog
+ title={title}
+ destructive
+ primaryText={deleting ? "Deleting…" : "Delete"}
+ onPrimary={onConfirm}
+ primaryDisabled={deleting}
+ closeText="Cancel"
+ onClose={() => { if (!deleting) onCancel(); }}
+ disableEscape={deleting}
+ defaultButton="close"
+ >
+ <p>{message}</p>
+ <p className="dialog-path">{project.folderPath}</p>
+ </ContentDialog>
+ );
}
diff --git a/src/components/ExitGuardDialog.test.tsx b/src/components/ExitGuardDialog.test.tsx
deleted file mode 100644
index 63420b0..0000000
--- a/src/components/ExitGuardDialog.test.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-// @vitest-environment jsdom
-
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { createElement } from "react";
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { createProjectConfig, type GenerationJob, type ProjectConfig } from "../lib/project";
-import { ExitGuardDialog, summary } from "./ExitGuardDialog";
-import { isGenerationOngoing, ProjectWorkspace } from "./ProjectWorkspace";
-
-vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));
-
-afterEach(cleanup);
-
-const base = () => createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
-
-/** A project with `statuses.length` extra shots, one per status. */
-function withJobs(statuses: GenerationJob["status"][]): ProjectConfig {
- const config = base();
- const now = new Date().toISOString();
- const jobs: GenerationJob[] = statuses.map((status, index) => ({
- id: `job-${index}`, title: `Shot ${index + 1}`, prompt: "a slow push across the launch pad",
- status, stage: status === "generating" ? "generating" : "queued", progress: 0,
- providerId: "minimax-h3", creativeBrief: "a slow push across the launch pad",
- referenceIds: [], createdAt: now, updatedAt: now,
- }));
- return { ...config, generationJobs: [...jobs, ...config.generationJobs] };
-}
-
-const workspace = (config: ProjectConfig, onBack: () => void) =>
- render(createElement(ProjectWorkspace, { project: { folderPath: "C:\\Ceramic Lamp", config }, initialView: "timeline", onBack, onSave: async () => undefined }));
-
-describe("the one definition of an ongoing generation", () => {
- it("is every status with something still to lose, and nothing else", () => {
- const statuses: GenerationJob["status"][] = ["draft", "queued", "generating", "ready", "completed", "failed", "cancelled"];
- const ongoing = statuses.filter((status) => isGenerationOngoing({ status } as GenerationJob));
- /* "ready" is in the list because it does not mean finished: the pictures
- exist and the file does not yet — the app is encoding them into the
- project folder. Leaving then costs the whole render, exactly as leaving
- mid-render does. "completed" is the one that means there is a file. */
- expect(ongoing).toEqual(["queued", "generating", "ready"]);
- });
-
- it("counts what is happening without rounding a queued shot up into a rendering one", () => {
- expect(summary(1, 0)).toBe("1 shot is rendering now.");
- expect(summary(0, 2)).toBe("2 shots are waiting in the queue.");
- expect(summary(1, 3)).toBe("1 shot is rendering now and 3 shots are waiting in the queue.");
- });
-});
-
-describe("leaving a project", () => {
- it("returns to the library without a generation warning", () => {
- const onBack = vi.fn();
- workspace(withJobs(["generating", "queued", "ready"]), onBack);
- fireEvent.click(screen.getByRole("button", { name: "Back to project library" }));
- expect(onBack).toHaveBeenCalledTimes(1);
- expect(screen.queryByRole("alertdialog")).toBeNull();
- });
-});
-
-describe("the dialog on its own", () => {
- const jobs = [
- { id: "a", title: "Macro model details", running: true },
- { id: "b", title: "Hands sketching elevation", running: false },
- ];
-
- it("keeps Tab inside itself and starts on the answer that changes nothing", () => {
- render(createElement(ExitGuardDialog, { jobs, onConfirm: () => undefined, onCancel: () => undefined }));
- const keep = screen.getByRole("button", { name: "Keep generating" });
- const stop = screen.getByRole("button", { name: "Stop and close" });
- expect(document.activeElement).toBe(keep);
-
- // Forward from the last stop wraps to the first; the browser handles the
- // step in between, so what is under test is the wrap.
- stop.focus();
- fireEvent.keyDown(window, { key: "Tab" });
- expect(document.activeElement).toBe(keep);
- fireEvent.keyDown(window, { key: "Tab", shiftKey: true });
- expect(document.activeElement).toBe(stop);
- });
-
- it("names the shots at stake and says which are only queued", () => {
- const { container } = render(createElement(ExitGuardDialog, { jobs, onConfirm: () => undefined, onCancel: () => undefined }));
- const rows = Array.from(container.querySelectorAll(".exit-guard__jobs li")).map((row) => row.textContent);
- expect(rows).toEqual(["Macro model detailsRendering now", "Hands sketching elevationWaiting to render"]);
- });
-
- it("says the window is what ends the run when that is the exit", () => {
- render(createElement(ExitGuardDialog, { jobs, onConfirm: () => undefined, onCancel: () => undefined }));
- expect(screen.getByRole("alertdialog").textContent).toContain("The video engine runs inside Slopus, so closing the window stops them.");
- });
-});
diff --git a/src/components/ExitGuardDialog.tsx b/src/components/ExitGuardDialog.tsx
deleted file mode 100644
index 82c0bc8..0000000
--- a/src/components/ExitGuardDialog.tsx
+++ /dev/null
@@ -1,137 +0,0 @@
-import { AlertCircle, Clock3, LoaderCircle } from "lucide-react";
-import { useEffect, useRef } from "react";
-
-/** One generation the app is still working on, as the exit guard needs it.
- * `running` separates the shot the engine is rendering right now from the ones
- * behind it in the queue — the same split the Generator shows. */
-export interface OngoingGeneration {
- id: string;
- title: string;
- running: boolean;
-}
-
-
-const FOCUSABLE = "button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])";
-
-/** Asks before an exit that would throw away work the engine is still doing.
- *
- * Every claim it makes is a claim about this codebase, not a hedge:
- * • slopfab writes no file of its own (see `run_generation` in slopfab.rs). Its
- * frames reach the app through the `slopfab-job` event, and only once the
- * app has encoded them (WorkQueue → lib/generatedVideo.ts) is
- * there an .mp4 in the project folder. Quit before that and there is
- * nothing on disk to come back to — which is why a scene that is still
- * being encoded counts as ongoing too (see isWorkActive).
- * • Nothing resumes. The only route back to a stopped shot is the Generator's
- * "Run it again", which starts the whole render from the first step.
- */
-export function ExitGuardDialog({ jobs, onConfirm, onCancel }: {
- jobs: OngoingGeneration[];
- onConfirm: () => void;
- onCancel: () => void;
-}) {
- const dialog = useRef<HTMLDivElement>(null);
- const keepGenerating = useRef<HTMLButtonElement>(null);
-
- /* Focus goes to "Keep generating" — the answer that changes nothing — and
- comes back to whatever opened the dialog when it closes, so a keyboard user
- is not dropped at the top of the document. */
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- keepGenerating.current?.focus();
- return () => opener?.focus?.();
- }, []);
-
- useEffect(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- event.preventDefault();
- onCancel();
- return;
- }
- if (event.key !== "Tab" || !dialog.current) return;
- // Tab must not walk out into the screen behind the dialog: it is still
- // rendered, and a focus ring on a control the user cannot see is the same
- // as losing focus altogether.
- const stops = Array.from(dialog.current.querySelectorAll<HTMLElement>(FOCUSABLE));
- if (stops.length === 0) return;
- const first = stops[0];
- const last = stops[stops.length - 1];
- const active = document.activeElement as HTMLElement | null;
- if (!event.shiftKey && (active === last || !dialog.current.contains(active))) {
- event.preventDefault();
- first.focus();
- } else if (event.shiftKey && (active === first || !dialog.current.contains(active))) {
- event.preventDefault();
- last.focus();
- }
- };
- window.addEventListener("keydown", onKeyDown, true);
- return () => window.removeEventListener("keydown", onKeyDown, true);
- }, [onCancel]);
-
- const rendering = jobs.filter((job) => job.running);
- const queued = jobs.filter((job) => !job.running);
-
- return (
- <div className="exit-guard-backdrop" onMouseDown={(event) => { if (event.target === event.currentTarget) onCancel(); }}>
- <div
- className="exit-guard"
- ref={dialog}
- role="alertdialog"
- aria-modal="true"
- aria-labelledby="exit-guard-title"
- aria-describedby="exit-guard-body"
- >
- <div className="exit-guard__head">
- <span className="exit-guard__mark" aria-hidden="true"><AlertCircle size={20} /></span>
- <h2 id="exit-guard-title">
- Close Slopus and stop generating?
- </h2>
- </div>
-
- <div className="exit-guard__body" id="exit-guard-body">
- <p>{summary(rendering.length, queued.length)}</p>
- <p>
- The video engine runs inside Slopus, so closing the window stops them.{" "}
- No video file is written until a shot finishes, so an unfinished run leaves nothing behind — and Slopus
- can’t pick one back up. You would run those shots again from the beginning.
- </p>
- </div>
-
- {jobs.length > 0 && (
- <ul className="exit-guard__jobs">
- {jobs.slice(0, 4).map((job) => (
- <li key={job.id}>
- {job.running ? <LoaderCircle size={15} aria-hidden="true" /> : <Clock3 size={15} aria-hidden="true" />}
- <b>{job.title}</b>
- <em>{job.running ? "Rendering now" : "Waiting to render"}</em>
- </li>
- ))}
- {jobs.length > 4 && <li className="exit-guard__more">and {jobs.length - 4} more</li>}
- </ul>
- )}
-
- <div className="exit-guard__actions">
- <button className="secondary-button" type="button" ref={keepGenerating} onClick={onCancel}>
- Keep generating
- </button>
- <button className="exit-guard__confirm" type="button" onClick={onConfirm}>
- Stop and close
- </button>
- </div>
- </div>
- </div>
- );
-}
-
-/** Counts what is actually happening, in the words the Generator uses for the
- * same two states. Never rounds a queued shot up into a rendering one. */
-export function summary(rendering: number, queued: number): string {
- const parts: string[] = [];
- if (rendering > 0) parts.push(`${rendering} ${rendering === 1 ? "shot is" : "shots are"} rendering now`);
- if (queued > 0) parts.push(`${queued} ${queued === 1 ? "shot is" : "shots are"} waiting in the queue`);
- if (parts.length === 0) return "Nothing is generating right now.";
- const sentence = parts.join(" and ");
- return `${sentence.charAt(0).toUpperCase()}${sentence.slice(1)}.`;
-}
diff --git a/src/components/ProjectCard.tsx b/src/components/ProjectCard.tsx
index 56737fd..ee05fe8 100644
--- a/src/components/ProjectCard.tsx
+++ b/src/components/ProjectCard.tsx
@@ -1,18 +1,25 @@
-import { Clock3, Folder, MoreHorizontal, Ratio, Sparkles, Trash2 } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { ExternalLink, Film, FolderOpen, Image as ImageIcon, MoreHorizontal, Trash2 } from "lucide-react";
+import { forwardRef, type KeyboardEvent, type MouseEvent, type Ref } from "react";
import { resolutionLabel, visibleClipAt } from "../lib/export";
import type { ProjectRecord } from "../lib/project";
import { MediaThumbnail } from "./workspace/MediaThumbnail";
+import { useContextMenu, type MenuEntry } from "./ui";
interface ProjectCardProps {
project: ProjectRecord;
- index: number;
+ /** Kept for callers; tiles no longer vary by position. */
+ index?: number;
onOpen: (project: ProjectRecord) => void;
onDelete?: (project: ProjectRecord) => void;
+ onReveal?: (project: ProjectRecord) => void;
+ selected?: boolean;
+ onSelect?: (project: ProjectRecord) => void;
+ /** Roving tab stop: only the selected (or first) tile is in the Tab order. */
+ tabIndex?: number;
+ layout?: "grid" | "list";
+ id?: string;
}
-const artwork = ["aurora", "paper", "chrome", "ember"];
-
/* How long ago, said honestly. This floored everything at an hour, so a project
saved two seconds ago was labelled "Edited 1h ago" — the card's only claim
about the project's life, and it was false for the whole first hour. Rounding
@@ -38,9 +45,19 @@ function durationLabel(seconds: number) {
return rest ? `${minutes} min ${rest} sec` : `${minutes} min`;
}
-export function ProjectCard({ project, index, onOpen, onDelete }: ProjectCardProps) {
- const [menuOpen, setMenuOpen] = useState(false);
- const menuAnchor = useRef<HTMLDivElement>(null);
+/* 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.
+ 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
+ selection and the arrow keys); it is not a link. */
+export const ProjectCard = forwardRef(function ProjectCard(
+ { project, onOpen, onDelete, onReveal, selected = false, onSelect, tabIndex = 0, layout = "grid", id }: ProjectCardProps,
+ ref: Ref<HTMLDivElement>,
+) {
+ const menu = useContextMenu();
const { config } = project;
const style = config.thumbnail ? { backgroundImage: `url(${JSON.stringify(config.thumbnail).slice(1, -1)})` } : undefined;
const assetsById = new Map(config.assets.map((asset) => [asset.id, asset]));
@@ -52,73 +69,74 @@ export function ProjectCard({ project, index, onOpen, onDelete }: ProjectCardPro
return asset?.kind !== "audio" && asset?.kind !== "caption";
})
.reduce<number | null>((first, clip) => first === null ? clip.startMs : Math.min(first, clip.startMs), null);
- const firstClip = firstVisualMs === null ? null : visibleClipAt(
- config.timeline.tracks,
- firstVisualMs,
- assetsById,
- );
+ const firstClip = firstVisualMs === null ? null : visibleClipAt(config.timeline.tracks, firstVisualMs, assetsById);
const firstAsset = config.generationType === "image" ? config.assets.find((asset) => asset.id === config.imageScene?.outputAssetId) : firstClip ? config.assets.find((asset) => asset.id === firstClip.assetId) : undefined;
const posterTimeMs = firstClip?.sourceStartMs ?? 0;
+ const image = config.generationType === "image";
+ const Glyph = image ? ImageIcon : Film;
+ const meta = `Edited ${relativeDate(config.updatedAt)} · ${image ? "Image" : durationLabel(config.brief.targetDurationSeconds)}`;
+ const prompt = config.brief.prompt.trim();
- useEffect(() => {
- if (!menuOpen) return;
- const closeOnOutside = (event: MouseEvent) => {
- const target = event.target;
- if (target instanceof Node && menuAnchor.current?.contains(target)) return;
- setMenuOpen(false);
- };
- const closeOnEscape = (event: KeyboardEvent) => {
- if (event.key === "Escape") setMenuOpen(false);
- };
- document.addEventListener("mousedown", closeOnOutside);
- document.addEventListener("keydown", closeOnEscape);
- return () => {
- document.removeEventListener("mousedown", closeOnOutside);
- document.removeEventListener("keydown", closeOnEscape);
- };
- }, [menuOpen]);
+ const items: MenuEntry[] = [
+ { id: "open", label: "Open", icon: <ExternalLink size={16} />, onSelect: () => onOpen(project) },
+ ...(onReveal ? [{ id: "reveal", label: "Show in File Explorer", icon: <FolderOpen size={16} />, onSelect: () => onReveal(project) }] : []),
+ ...(onDelete ? [{ separator: true } as const, { id: "delete", label: "Delete project…", icon: <Trash2 size={16} />, onSelect: () => onDelete(project) }] : []),
+ ];
+ const openMenu = (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {
+ onSelect?.(project);
+ menu.open(event, items);
+ };
- // The card itself is not a tab stop: the art button below already opens the
- // project from the keyboard, so a focusable card only added a duplicate stop.
- return (
- <article className="project-card" onDoubleClick={() => onOpen(project)}>
- <button className="project-card__art-button" onClick={() => onOpen(project)} aria-label={`Open ${config.name}`}>
- <div className={`project-card__art project-card__art--${artwork[index % artwork.length]}${firstAsset ? " project-card__art--media" : ""}`} style={style}>
- {firstAsset && <MediaThumbnail
- key={`${firstAsset.id}-${posterTimeMs}`}
- folderPath={project.folderPath}
- asset={firstAsset}
- posterTimeSeconds={posterTimeMs / 1000}
- jpegQuality={0.9}
- />}
- <span className="project-card__format"><Ratio size={13} /> {config.settings.aspectRatio}</span>
- <span className="project-card__quality">{resolutionLabel(config.settings.resolution, config.settings.aspectRatio)}</span>
- <div className="project-card__art-copy"><Sparkles size={15} /><span>{config.brief.prompt}</span></div>
- </div>
- </button>
- <div className="project-card__body">
- <div className="project-card__title-row" ref={menuAnchor}>
- <h3 title={config.name}>{config.name}</h3>
- <button
- className="icon-button"
- aria-label={`More options for ${config.name}`}
- aria-haspopup="menu"
- aria-expanded={menuOpen}
- onClick={() => setMenuOpen((open) => !open)}
- ><MoreHorizontal size={18} /></button>
- {menuOpen && (
- <div className="project-card__menu" role="menu">
- <button role="menuitem" onClick={() => onOpen(project)}><Folder size={16} /> Open project</button>
- {onDelete && <button className="project-card__menu-delete" role="menuitem" onClick={() => { setMenuOpen(false); onDelete(project); }}><Trash2 size={16} /> Delete Project</button>}
- </div>
- )}
- </div>
- <p className="project-card__path" title={project.folderPath}><Folder size={13} /><span>{project.folderPath}</span></p>
- <div className="project-card__meta">
- <span><Clock3 size={14} /> Edited {relativeDate(config.updatedAt)}</span>
- <span>{config.generationType === "image" ? "Image project" : durationLabel(config.brief.targetDurationSeconds)}</span>
- </div>
+ return (<>
+ <div
+ ref={ref}
+ id={id}
+ role="option"
+ aria-selected={selected}
+ aria-label={config.name}
+ tabIndex={tabIndex}
+ className={`project-card project-card--${layout}${selected ? " project-card--selected" : ""}`}
+ data-tooltip={prompt || undefined}
+ onClick={() => onSelect?.(project)}
+ onDoubleClick={() => onOpen(project)}
+ onKeyDown={(event) => {
+ if (event.target !== event.currentTarget) return;
+ if (event.key === "Enter") { event.preventDefault(); onOpen(project); }
+ else if (event.key === " ") { event.preventDefault(); onSelect?.(project); }
+ else if (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey)) { event.preventDefault(); openMenu(event); }
+ }}
+ onContextMenu={openMenu}
+ >
+ <div className={`project-card__thumb${firstAsset ? " project-card__thumb--media" : ""}`} style={style}>
+ <Glyph className="project-card__glyph" size={32} aria-hidden="true" />
+ {firstAsset && <MediaThumbnail
+ key={`${firstAsset.id}-${posterTimeMs}`}
+ folderPath={project.folderPath}
+ asset={firstAsset}
+ posterTimeSeconds={posterTimeMs / 1000}
+ jpegQuality={0.9}
+ />}
+ <span className="project-card__chip" data-tooltip={resolutionLabel(config.settings.resolution, config.settings.aspectRatio)}>{config.settings.aspectRatio}</span>
</div>
- </article>
- );
-}
+ <div className="project-card__text">
+ <span className="project-card__name">{config.name}</span>
+ {layout === "list" && <span className="project-card__path">{project.folderPath}</span>}
+ <span className="project-card__meta">{meta}</span>
+ </div>
+ <button
+ type="button"
+ className="icon-button project-card__more"
+ tabIndex={-1}
+ aria-label={`More options for ${config.name}`}
+ aria-haspopup="menu"
+ data-tooltip="More options"
+ onClick={(event) => { event.stopPropagation(); onSelect?.(project); menu.open(event.currentTarget, items, { placement: "bottom" }); }}
+ onDoubleClick={(event) => event.stopPropagation()}
+ ><MoreHorizontal size={16} /></button>
+ </div>
+ {/* Outside the tile: the menu is portalled, but React events still bubble
+ through the component tree, and a right-click in the menu must not
+ reach the tile's own onContextMenu. */}
+ {menu.element}
+ </>);
+});
diff --git a/src/components/ProjectWorkspace.tsx b/src/components/ProjectWorkspace.tsx
index ed673d5..8665ae0 100644
--- a/src/components/ProjectWorkspace.tsx
+++ b/src/components/ProjectWorkspace.tsx
@@ -1,10 +1,12 @@
-import { ArrowLeft, BookOpen, Bot, Download, Film, Image, Save, Sparkles } from "lucide-react";
+import { ArrowLeft, BookOpen, Bot, Download, Film, Image, Redo2, Save, Sparkles, Undo2 } from "lucide-react";
import { ImageEditor } from "./workspace/ImageEditor";
-import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
+import { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
import type { GenerationJob, ProjectConfig, ProjectRecord } from "../lib/project";
import { CHECKING_PROVIDERS, executeAgentCommands, type RuntimeStatus, type SlopfabStatus } from "../lib/runtime";
import { purgeTimelineThumbnails } from "../lib/timelineThumbnails";
import { WorkQueue, projectQueueKey } from "../lib/workQueue";
+import { useShortcut } from "../lib/commands";
+import { useGuardedShortcut } from "../lib/shellKeys";
import { AgentDock } from "./workspace/AgentDock";
import { ExportView } from "./workspace/ExportView";
import { GeneratorView } from "./workspace/GeneratorView";
@@ -12,10 +14,15 @@ import { ReferencesView } from "./workspace/ReferencesView";
import { TimelineView, type ConfigUpdate } from "./workspace/TimelineView";
import { UnsavedProjectDialog } from "./UnsavedProjectDialog";
import { PromptComposer } from "./PromptComposer";
+import { TitleBar } from "./TitleBar";
+import { InfoBadge, InfoBar, SelectorBar, Splitter, usePaneSize } from "./ui";
import { invoke } from "@tauri-apps/api/core";
import { isTauri } from "../lib/persistence";
+/** "agent" is not a view any more — the agent is a docked pane — but opening
+ * a project "on the agent" still means something: the pane opens with it. */
export type ProjectView = "timeline" | "generator" | "references" | "agent" | "export" | "editor";
+type ShownView = Exclude<ProjectView, "agent">;
/** The scene badge includes native generation and the final encoding step. */
export const isGenerationOngoing = (job: GenerationJob) =>
@@ -29,7 +36,40 @@ export function formatDurationTimecode(totalSeconds: number): string {
return [hours, minutes, remainder].map((value) => String(value).padStart(2, "0")).join(":");
}
-export function ProjectWorkspace({ project, initialView = "timeline", runtime = null, onBack, onSave, workQueue, onGeneratorRuntimeChange }: {
+const AGENT_PANE_KEY = "slopus.workspace.agentPane";
+const readAgentPane = (): boolean => {
+ try { return localStorage.getItem(AGENT_PANE_KEY) !== "closed"; } catch { return true; }
+};
+const writeAgentPane = (open: boolean) => {
+ try { localStorage.setItem(AGENT_PANE_KEY, open ? "open" : "closed"); } catch { /* storage unavailable */ }
+};
+
+const VIEW_LABELS: Record<ShownView, string> = {
+ timeline: "Timeline", generator: "Generator", references: "References", export: "Export", editor: "Editor",
+};
+
+/* The project window.
+
+ [←] [icon] Project name Timeline Generator References Export [↶][↷] [Save] [Agent][Queue][⚙] [– □ ×]
+ ─────────────────────────────────────────────────────────────────────────────────────────────────────
+ InfoBars (save failed, export failed)
+ ┌ the view ─────────────────────────────────────────┐┃┌ Agent ──────────┐
+ │ │┃│ │
+ └───────────────────────────────────────────────────┘┃└─────────────────┘
+
+ 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
+ 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.
+
+ Undo/Redo (Ctrl+Z, Ctrl+Y, Ctrl+Shift+Z) is project-wide: every edit a view
+ hands up through onChange, the agent's commands and the project settings go
+ through session.edit() and are undo steps; background work (generation
+ results, icons, measurements) is not (see projectSession.ts). Text fields
+ keep their own native undo — the shortcuts do not fire in them. */
+export function ProjectWorkspace({ project, initialView = "timeline", runtime = null, onBack, onSave, workQueue, onGeneratorRuntimeChange, titleBarActions, active = true }: {
project: ProjectRecord;
initialView?: ProjectView;
/** What is installed on this computer, probed once at startup by App. Null
@@ -41,19 +81,32 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
/** Keeps the app-wide probe result aligned when the active generator is
* changed directly from the Generator screen. */
onGeneratorRuntimeChange?: (runtime: SlopfabStatus) => void;
+ /** App-wide title-bar buttons (work queue, settings), after the project's own. */
+ titleBarActions?: ReactNode;
+ /** False while the workspace is hidden behind another page (Settings): its
+ * keyboard shortcuts stand down. */
+ active?: boolean;
}) {
const saveRef = useRef(onSave);
saveRef.current = onSave;
const [localQueue] = useState(() => new WorkQueue((record) => saveRef.current(record)));
const queue = workQueue ?? localQueue;
const session = useMemo(() => queue.project(project), [queue, project.folderPath, project.config.id]);
- const { config, saving, dirty, saveError } = useSyncExternalStore(session.subscribe, session.getSnapshot);
+ const { config, saving, dirty, saveError, canUndo, canRedo } = useSyncExternalStore(session.subscribe, session.getSnapshot);
const items = useSyncExternalStore(queue.subscribe, queue.getSnapshot);
const imageProject = config.generationType === "image";
const imageOutput = config.assets.find((asset) => asset.kind === "image" && asset.id === config.imageScene?.outputAssetId);
const [exportingImage, setExportingImage] = useState(false);
const [imageExportError, setImageExportError] = useState<string | null>(null);
- const [view, setView] = useState<ProjectView>(imageProject && !["agent", "references"].includes(initialView) ? "editor" : initialView);
+ const [view, setView] = useState<ShownView>(() => {
+ if (imageProject) return initialView === "references" ? "references" : "editor";
+ return initialView === "agent" || initialView === "editor" ? "timeline" : initialView;
+ });
+ const [agentOpen, setAgentOpenState] = useState(() => initialView === "agent" || readAgentPane());
+ const setAgentOpen = (open: boolean) => { setAgentOpenState(open); writeAgentPane(open); };
+ const agentPane = usePaneSize("workspace.agent", 360, { min: 280, max: 640 });
+ const agentPaneRef = useRef<HTMLElement>(null);
+ const agentToggle = useRef<HTMLButtonElement>(null);
const [leaving, setLeaving] = useState(false);
const [savingToLeave, setSavingToLeave] = useState(false);
const [editingProject, setEditingProject] = useState(false);
@@ -63,8 +116,12 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
const projectItems = items.filter((item) => item.projectKey === projectQueueKey(project));
const generationCompletionTimes = Object.fromEntries(projectItems.filter((item) => item.completionAt !== null).map((item) => [item.sceneId, item.completionAt as number]));
const cancellingJobIds = new Set(projectItems.filter((item) => item.cancelling).map((item) => item.sceneId));
+ const panelId = useId();
useEffect(() => workQueue ? undefined : queue.start(), [queue, workQueue]);
- const changeConfig = (next: ConfigUpdate) => session.update(next);
+ /* Every edit a view reports is an undo step. A view may pass a key to
+ coalesce a run of edits (a drag, typing) into one; the default key already
+ merges edits that arrive within half a second of each other. */
+ const changeConfig = (next: ConfigUpdate, key?: string) => session.edit(next, key);
const recordMeasurement = (update: (current: ProjectConfig) => ProjectConfig) => session.update(update, false);
const save = () => session.save().catch(() => undefined);
const exportImage = async () => {
@@ -74,6 +131,7 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
catch (reason) { setImageExportError(String(reason)); }
finally { setExportingImage(false); }
};
+ const imageExportDisabled = !imageOutput?.relativePath || Boolean(imageOutput.imageDraft) || !isTauri() || exportingImage;
const leave = async (keepChanges: boolean) => {
setSavingToLeave(true);
try {
@@ -83,6 +141,7 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
} catch { /* The session supplies the save error and keeps the dialog open. */ }
finally { setSavingToLeave(false); }
};
+ const goBack = () => { if (dirty) setLeaving(true); else onBack(); };
/* Scene removal can come from the Generator or from Slop replacing the
project document. Keep derived disk caches honest at this shared boundary
@@ -95,87 +154,124 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =
knownSceneIds.current = current;
}, [config.generationJobs, project.folderPath]);
+ const views: ShownView[] = imageProject ? ["editor", "references"] : ["timeline", "generator", "references", "export"];
+ const running = config.generationJobs.filter(isGenerationOngoing).length;
+ const toggleAgent = () => {
+ const open = !agentOpen;
+ setAgentOpen(open);
+ if (open) requestAnimationFrame(() => agentPaneRef.current?.querySelector<HTMLElement>("textarea:not(:disabled), button:not(:disabled)")?.focus());
+ else if (agentPaneRef.current?.contains(document.activeElement)) agentToggle.current?.focus();
+ };
+
+ /* ── Accelerators (i-frame-4) ─────────────────────────────────────────── */
+ const idle = active && !editingProject && !leaving;
+ useShortcut("Ctrl+S", () => { if (dirty && !saving) void save(); }, { enabled: idle, allowInInput: true });
+ useShortcut("Ctrl+Z", () => { session.undo(); }, { enabled: idle });
+ useShortcut(["Ctrl+Y", "Ctrl+Shift+Z"], () => { session.redo(); }, { enabled: idle });
+ useShortcut(["Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4"], (event) => {
+ const next = views[Number(event.code?.replace("Digit", "") || event.key) - 1];
+ if (!next) return false;
+ setView(next);
+ }, { enabled: idle, allowInInput: true });
+ useShortcut("Ctrl+E", () => { if (imageProject) { if (!imageExportDisabled) void exportImage(); } else setView("export"); }, { enabled: idle, allowInInput: true });
+ useShortcut("Ctrl+Shift+A", toggleAgent, { enabled: idle, allowInInput: true });
+ useGuardedShortcut("Alt+ArrowLeft", goBack, { enabled: idle });
+
+ const viewIcon = (id: ShownView) => id === "timeline" ? <Film size={16} /> : id === "generator" ? <Sparkles size={16} /> : id === "references" ? <BookOpen size={16} /> : id === "export" ? <Download size={16} /> : <Image size={16} />;
+ const shortcutOf = (index: number) => `Ctrl+${index + 1}`;
+
return <div className="project-shell">
{editingProject && <PromptComposer project={config} busy={savingProjectSettings} error={saveError} onClose={() => setEditingProject(false)} onCreate={async (input) => {
setSavingProjectSettings(true);
try {
- session.update((current) => ({
+ session.edit((current) => ({
...current, name: input.name,
brief: { ...current.brief, aspectRatio: input.aspectRatio, resolution: input.resolution },
settings: { ...current.settings, aspectRatio: input.aspectRatio, resolution: input.resolution, defaultLook: input.defaultLook },
- }));
+ }), "project-settings");
await session.save();
setEditingProject(false);
} catch { /* Keep the dialog open; the session supplies the save error. */ }
finally { setSavingProjectSettings(false); }
}} />}
{leaving && <UnsavedProjectDialog name={config.name} busy={savingToLeave} error={saveError} onSave={() => void leave(true)} onDiscard={() => void leave(false)} onBack={() => setLeaving(false)} />}
- <header className="project-topbar">
- <div className="project-topbar__lead">
- <button
- className="icon-button icon-button--strong"
- onClick={() => { if (dirty) setLeaving(true); else onBack(); }}
- aria-label="Back to project library"
- title="Back to your projects"
- ><ArrowLeft size={18} /></button>
- {/* The name column is the topbar's elastic column and truncates on narrow
- windows, so the full name stays available on hover. */}
- <div className="project-title"><button type="button" title={config.name} aria-label={`Edit project settings for ${config.name}`} aria-haspopup="dialog" aria-expanded={editingProject} onClick={() => { session.dismissError(); setEditingProject(true); }}><strong>{config.name}</strong></button></div>
- </div>
- <nav className="project-nav" aria-label="Project views">
- {(imageProject ? ([ ["agent", Bot, "Agent"], ["editor", Image, "Editor"], ["references", BookOpen, "References"] ] as const) : ([ ["agent", Bot, "Agent"], ["timeline", Film, "Timeline"], ["generator", Sparkles, "Generator"], ["references", BookOpen, "References"] ] as const)).map(([id, Icon, label]) => {
- const running = id === "generator" ? config.generationJobs.filter(isGenerationOngoing).length : 0;
- return <button key={id} type="button" className={view === id ? "active" : ""} aria-current={view === id ? "page" : undefined} onClick={() => setView(id)}>
- <Icon size={18} aria-hidden="true" /> {label}
- {running > 0 && <span title={`${running} generation${running === 1 ? "" : "s"} running or queued`}>{running}</span>}
- </button>;
- })}
- </nav>
-
- <div className="project-topbar__actions">
- <button
- className="secondary-button"
- type="button"
- aria-current={!imageProject && view === "export" ? "page" : undefined}
- disabled={imageProject && (!imageOutput?.relativePath || imageOutput.imageDraft || !isTauri() || exportingImage)}
- onClick={() => imageProject ? void exportImage() : setView("export")}
- title={imageProject ? "Save the selected image as JPG or PNG" : "Render the timeline to a video file"}
- >
- <Download size={16} aria-hidden="true" /> {exportingImage ? "Exporting…" : "Export"}
- </button>
- {/* The standing "All changes saved" pill is gone; the button itself is
- now the only save state there is, so it has to carry it. Off means
- the file on disk already matches what is on screen. */}
- <button className="primary-button" onClick={() => void save()} disabled={saving || !dirty} title={saving ? "Saving…" : dirty ? "Save your changes to this project folder" : "Everything is already saved"}>
- <Save size={16} aria-hidden="true" /> {saving ? "Saving…" : "Save"}
- </button>
+ <TitleBar
+ 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"><ArrowLeft size={16} /></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); }}>{config.name}</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"><Undo2 size={16} /></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"><Redo2 size={16} /></button>
+ <span className="titlebar-separator" aria-hidden="true" />
+ <div className="project-commands">
+ {imageProject && (
+ <button type="button" className="secondary-button" disabled={imageExportDisabled} onClick={() => void exportImage()} data-tooltip="Save the image as JPG or PNG" data-tooltip-shortcut="Ctrl+E">
+ <Download size={16} aria-hidden="true" /> {exportingImage ? "Exporting…" : "Export"}
+ </button>
+ )}
+ {/* 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
+ on screen. */}
+ <button type="button" className="primary-button" onClick={() => void save()} disabled={saving || !dirty} data-tooltip={saving ? "Saving…" : dirty ? "Save" : "Everything is saved"} data-tooltip-shortcut="Ctrl+S" aria-keyshortcuts="Control+S">
+ <Save size={16} aria-hidden="true" /> {saving ? "Saving…" : "Save"}
+ </button>
+ </div>
+ <span className="titlebar-separator" aria-hidden="true" />
+ <button ref={agentToggle} type="button" className={`icon-button${agentOpen ? " icon-button--checked" : ""}`} aria-label="Agent" aria-pressed={agentOpen} aria-controls={`${panelId}-agent`} data-tooltip={agentOpen ? "Hide agent" : "Show agent"} data-tooltip-shortcut="Ctrl+Shift+A" aria-keyshortcuts="Control+Shift+A" onClick={toggleAgent}><Bot size={16} /></button>
+ {titleBarActions}
+ </>}
+ >
+ <SelectorBar<ShownView>
+ className="project-views"
+ aria-label="Project views"
+ value={view}
+ onChange={setView}
+ items={views.map((id) => ({
+ value: id,
+ controls: `${panelId}-view`,
+ label: id === "generator" && running > 0
+ ? <span className="project-views__label" data-tooltip={`${running} generation${running === 1 ? "" : "s"} running or queued`} data-tooltip-shortcut={shortcutOf(views.indexOf(id))}>{VIEW_LABELS[id]}<InfoBadge value={running} severity="informational" /></span>
+ : <span className="project-views__label" data-tooltip={VIEW_LABELS[id]} data-tooltip-shortcut={shortcutOf(views.indexOf(id))}>{VIEW_LABELS[id]}</span>,
+ icon: viewIcon(id),
+ }))}
+ />
+ </TitleBar>
+
+ {(saveError || imageExportError) && <div className="project-infobars">
+ {saveError && !editingProject && !leaving && <InfoBar severity="error" title="Couldn’t save project" message={saveError} onClose={session.dismissError} />}
+ {imageExportError && <InfoBar severity="error" title="Couldn’t export image" message={imageExportError} onClose={() => setImageExportError(null)} />}
+ </div>}
+
+ <div className={`project-body${agentOpen ? " project-body--agent" : ""}`} style={agentPane.style}>
+ <div id={`${panelId}-view`} role="tabpanel" aria-label={VIEW_LABELS[view]} className={`project-content project-content--${view}`}>
+ {view === "editor" && imageProject && <ImageEditor config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template) => queue.enqueueImage(session, template)} onCancel={(id) => queue.cancel(id)} work={projectItems.filter((item) => item.kind === "image").at(-1)} />}
+ {view === "timeline" && <TimelineView config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView(imageProject ? "editor" : "generator"); }} />}
+ {view === "generator" && <GeneratorView onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}
+ {view === "references" && <ReferencesView config={config} folderPath={project.folderPath} onChange={changeConfig} onRegenerateIcon={(id) => queue.regenerateReferenceIcon(session, id)} onGenerateBuiltinIcons={() => queue.generateBuiltinReferenceIcons(session)} onRegenerateBuiltinIcon={(id) => queue.regenerateBuiltinReferenceIcon(session, id)} pendingBuiltinIconIds={queue.pendingBuiltinIconIds()} pendingIconIds={new Set(config.references.filter((reference) => queue.isReferenceIconPending(session, reference.id)).map((reference) => reference.id))} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView("generator"); }} />}
+ {view === "export" && <ExportView config={config} folderPath={project.folderPath} />}
</div>
- </header>
-
- <div className={`project-content project-content--${view}`}>
- {view === "editor" && imageProject && <ImageEditor config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template) => queue.enqueueImage(session, template)} onCancel={(id) => queue.cancel(id)} work={projectItems.filter((item) => item.kind === "image").at(-1)} />}
- {view === "timeline" && <TimelineView config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView(imageProject ? "editor" : "generator"); }} />}
- {view === "generator" && <GeneratorView onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}
- {view === "references" && <ReferencesView config={config} folderPath={project.folderPath} onChange={changeConfig} onRegenerateIcon={(id) => queue.regenerateReferenceIcon(session, id)} onGenerateBuiltinIcons={() => queue.generateBuiltinReferenceIcons(session)} onRegenerateBuiltinIcon={(id) => queue.regenerateBuiltinReferenceIcon(session, id)} pendingBuiltinIconIds={queue.pendingBuiltinIconIds()} pendingIconIds={new Set(config.references.filter((reference) => queue.isReferenceIconPending(session, reference.id)).map((reference) => reference.id))} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView("generator"); }} />}
- {view === "export" && <ExportView config={config} folderPath={project.folderPath} />}
+ {agentOpen && <Splitter {...agentPane.splitterProps} reverse aria-label="Resize agent pane" aria-controls={`${panelId}-agent`} />}
+ {/* Kept mounted while hidden, so a running turn and the conversation
+ survive the pane being closed. */}
+ <aside ref={agentPaneRef} id={`${panelId}-agent`} className="project-agent-pane" aria-label="Agent" hidden={!agentOpen}>
+ <AgentDock
+ context={view === "editor" ? "this image composition" : view === "timeline" ? "the edit" : view === "generator" ? "this generation queue" : view === "references" ? "project references" : "this export"}
+ record={{ ...project, config }}
+ providers={runtime?.providers ?? CHECKING_PROVIDERS}
+ expanded
+ onPromptStart={() => { if (!agentOpen) setAgentOpen(true); }}
+ /* The provider only proposes typed commands. Apply them to the session's
+ latest state—edits can continue while it thinks—as one undo step, then
+ route the result through the same ordered save queue as the Save button. */
+ onCommands={async (commands) => {
+ const next = await executeAgentCommands(session.getSnapshot().config, commands);
+ session.edit(next, "agent");
+ session.sealHistory();
+ await save();
+ }}
+ />
+ </aside>
</div>
- <footer className={`project-agent-row${view === "agent" ? " project-agent-row--page" : ""}`}><AgentDock
- context={view === "editor" ? "this image composition" : view === "timeline" ? "the edit" : view === "generator" ? "this generation queue" : view === "references" ? "project references" : view === "export" ? "this export" : "this project"}
- record={{ ...project, config }}
- providers={runtime?.providers ?? CHECKING_PROVIDERS}
- expanded={view === "agent"}
- onPromptStart={() => setView("agent")}
- /* The provider only proposes typed commands. Apply them to the session's
- latest state—edits can continue while it thinks—then route the result
- through the same ordered save queue as the Save button. */
- onCommands={async (commands) => {
- const next = await executeAgentCommands(session.getSnapshot().config, commands);
- session.update(next);
- await save();
- }}
- /></footer>
- {saveError && <div className="toast" role="alert"><strong>Couldn’t save project</strong><span>{saveError}</span><button onClick={session.dismissError}>Dismiss</button></div>}
- {imageExportError && <div className="toast" role="alert"><strong>Couldn’t export image</strong><span>{imageExportError}</span><button onClick={() => setImageExportError(null)}>Dismiss</button></div>}
</div>;
}
diff --git a/src/components/PromptComposer.tsx b/src/components/PromptComposer.tsx
index 6442501..ceb7105 100644
--- a/src/components/PromptComposer.tsx
+++ b/src/components/PromptComposer.tsx
@@ -1,9 +1,10 @@
-import { Clapperboard, FolderOpen, Image, Monitor, Palette, Save, WandSparkles, X } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useId, useRef, useState } from "react";
import { outputDimensions } from "../lib/export";
+import { useShortcut } from "../lib/commands";
import type { AspectRatio, CreateProjectInput, ProjectConfig, Resolution } from "../lib/project";
import { PROJECT_RESOLUTIONS } from "../lib/project";
import { SHOT_TAG_GROUPS } from "../lib/shot-tags";
+import { ContentDialog, InfoBar, RadioGroup } from "./ui";
interface PromptComposerProps {
busy: boolean;
@@ -25,6 +26,12 @@ const LOOKS = SHOT_TAG_GROUPS.find((group) => group.id === "visualStyle")!.optio
const folderName = (path?: string) => path?.replace(/[\\/]+$/, "").split(/[\\/]/).at(-1) || "Untitled video";
+/* New project, and the same form as Project settings for an open project.
+ A standard 548px ContentDialog on a solid layer: the project type as two
+ radio buttons, the folder as a read-only path with Browse…, the name, and
+ the format. [Create] [Cancel] in the footer; Enter creates, Esc cancels.
+ Errors — a folder that is not empty, a failed save — are an InfoBar in the
+ body rather than red text beside the button. */
export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, error, folderPath, folderError, checkingFolder, onChooseFolder }: PromptComposerProps) {
const [generationType, setGenerationType] = useState<"video" | "image">(project?.generationType === "image" ? "image" : "video");
const [name, setName] = useState(project?.name ?? folderName(folderPath));
@@ -38,36 +45,23 @@ export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, err
const [aspectRatio, setAspectRatio] = useState<AspectRatio>(project?.settings.aspectRatio ?? "16:9");
const [resolution, setResolution] = useState<Resolution>(project?.settings.resolution ?? DEFAULT_RESOLUTION);
const [defaultLook, setDefaultLook] = useState(project?.settings.defaultLook ?? "");
- const dialog = useRef<HTMLDivElement>(null);
const nameInput = useRef<HTMLInputElement>(null);
+ const id = useId();
const resolutions: readonly Resolution[] = project && !PROJECT_RESOLUTIONS.some((value) => value === project.settings.resolution)
? [...PROJECT_RESOLUTIONS, project.settings.resolution] : PROJECT_RESOLUTIONS;
+ const blocked = busy || Boolean(checkingFolder) || Boolean(folderError) || !name.trim();
+ const close = () => { if (!busy) onClose(); };
- /* Naming is the only authored content required before the Agent takes over. */
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- nameInput.current?.focus({ preventScroll: true });
- nameInput.current?.select();
- return () => { if (opener?.isConnected) opener.focus(); };
- }, []);
+ /* Naming is the only authored content required before the Agent takes over,
+ so the name is focused and selected, ready to type over. */
+ useEffect(() => { nameInput.current?.select(); }, []);
- useEffect(() => {
- const close = (event: KeyboardEvent) => {
- if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); if (!busy) onClose(); }
- if (event.key !== "Tab") return;
- const controls = Array.from(dialog.current?.querySelectorAll<HTMLElement>("button:not(:disabled), input:not(:disabled), select:not(:disabled)") ?? [])
- .filter((control) => !(control instanceof HTMLInputElement && control.type === "radio" && !control.checked));
- if (!controls.length) { event.preventDefault(); return; }
- if (!dialog.current?.contains(document.activeElement) || (event.shiftKey ? document.activeElement === controls[0] : document.activeElement === controls.at(-1))) {
- event.preventDefault(); (event.shiftKey ? controls.at(-1)! : controls[0]).focus();
- }
- };
- window.addEventListener("keydown", close, true);
- return () => window.removeEventListener("keydown", close, true);
- }, [busy, onClose]);
+ /* Esc is the dialog's own key while focus is in it. This catches it when
+ focus has wandered to the page (a click on the title bar). */
+ useShortcut("Escape", close, { allowInModal: true, allowInInput: true });
const submit = async () => {
- if (busy || checkingFolder || folderError || !name.trim()) return;
+ if (blocked) return;
await onSubmit({
generationType,
name: name.trim(),
@@ -79,90 +73,83 @@ export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, err
});
};
+ const message = folderError || error;
return (
- <div ref={dialog} className="composer-overlay" role="dialog" aria-modal="true" aria-labelledby="create-heading">
- <section className="composer-shell">
- <header className="composer-heading">
- <h2 id="create-heading">{project ? "Project settings" : "New project"}</h2>
- <button className="icon-button icon-button--strong" onClick={onClose} disabled={busy} aria-label={project ? "Close project settings" : "Close new project"}><X size={18} /></button>
- </header>
- <div className="composer">
- {!project && <fieldset className="composer__project-type" disabled={busy}>
- <legend>Project type</legend>
- <div className="composer__type-options">
- {([
- ["video", Clapperboard, "Video project", "Generate clips and edit a timeline"],
- ["image", Image, "Image project", "Compose and generate still images"],
- ] as const).map(([type, Icon, title, description]) => <label className="composer__type-option" key={type}>
- <input className="composer__type-input" type="radio" name="project-type" value={type} checked={generationType === type} aria-labelledby={`project-type-${type}-label`} aria-describedby={`project-type-${type}-description`} onChange={() => {
- setGenerationType(type);
- if (!folderPath && (name === "Untitled video" || name === "Untitled image")) setName(`Untitled ${type}`);
- }} />
- <span className="composer__type-card">
- <span className="composer__type-icon"><Icon size={24} aria-hidden="true" /></span>
- <span className="composer__type-copy"><strong id={`project-type-${type}-label`}>{title}</strong><span id={`project-type-${type}-description`}>{description}</span></span>
- <span className="composer__type-indicator" aria-hidden="true" />
- </span>
- </label>)}
+ <ContentDialog
+ title={project ? "Project settings" : "New project"}
+ primaryText={project ? (busy ? "Saving…" : "Save changes") : (busy ? "Creating…" : "Create project")}
+ onPrimary={() => void submit()}
+ primaryDisabled={blocked}
+ closeText="Cancel"
+ onClose={close}
+ disableEscape={busy}
+ defaultButton="primary"
+ initialFocus={nameInput}
+ className="composer"
+ >
+ <div className="composer__form">
+ {!project && (
+ <RadioGroup
+ label="Project type"
+ orientation="horizontal"
+ value={generationType}
+ disabled={busy}
+ onChange={(type) => {
+ setGenerationType(type);
+ if (!folderPath && (name === "Untitled video" || name === "Untitled image")) setName(`Untitled ${type}`);
+ }}
+ options={[
+ { value: "video", label: "Video project" },
+ { value: "image", label: "Image project" },
+ ]}
+ />
+ )}
+ {!project && folderPath && (
+ <div className="composer__field">
+ <label htmlFor={`${id}-folder`}>Project folder</label>
+ <div className="composer__folder-row">
+ <input id={`${id}-folder`} className="text-field" aria-label="Project folder" readOnly value={folderPath} data-tooltip={folderPath} />
+ <button className="secondary-button" type="button" disabled={busy || checkingFolder} onClick={() => void onChooseFolder?.()}>Browse…</button>
+ </div>
</div>
- </fieldset>}
- {!project && folderPath && <div className="composer__folder-row">
- <label><span>Project folder</span><input aria-label="Project folder" readOnly value={folderPath} title={folderPath} /></label>
- <button className="secondary-button" type="button" disabled={busy || checkingFolder} onClick={() => void onChooseFolder?.()}><FolderOpen size={16} />Change folder</button>
- </div>}
- <label className="composer__name-row">
- <span>Project name</span>
- <input ref={nameInput} disabled={busy} value={name} onChange={(event) => setName(event.target.value)} aria-label="Project name" />
- </label>
-
- <section className="composer__options">
- <div className="composer__options-head">
- <span className="composer__options-title">{generationType === "image" ? "Image settings" : "Video settings"}</span>
+ )}
+ <div className="composer__field">
+ <label htmlFor={`${id}-name`}>Project name</label>
+ <input id={`${id}-name`} ref={nameInput} className="text-field" disabled={busy} value={name} onChange={(event) => setName(event.target.value)} aria-label="Project name" />
+ </div>
+ <div className="composer__grid">
+ <div className="composer__field">
+ <label htmlFor={`${id}-aspect`}>Aspect Ratio</label>
+ <select id={`${id}-aspect`} disabled={busy} value={aspectRatio} onChange={(event) => setAspectRatio(event.target.value as AspectRatio)}>
+ <option value="16:9">Widescreen 16:9</option>
+ <option value="9:16">Vertical 9:16</option>
+ <option value="1:1">Square 1:1</option>
+ <option value="4:5">Portrait 4:5</option>
+ </select>
</div>
- <div className="composer__options-body">
- <div className="composer__options-grid">
- <label>
- <span><Monitor size={15} /> Aspect Ratio</span>
- <select disabled={busy} value={aspectRatio} onChange={(event) => setAspectRatio(event.target.value as AspectRatio)}>
- <option value="16:9">Widescreen 16:9</option>
- <option value="9:16">Vertical 9:16</option>
- <option value="1:1">Square 1:1</option>
- <option value="4:5">Portrait 4:5</option>
- </select>
- </label>
- {/* The real pixels, not a name for them. Every rung is a multiple
- of 32 on both edges — what MiniMax H3 generates at — and they
- are relabelled when the shape above changes, because 768p is
- 1376×768 widescreen and 768×1376 vertical. */}
- <label>
- <span><Clapperboard size={15} /> Resolution</span>
- <select disabled={busy} value={resolution} onChange={(event) => setResolution(event.target.value as Resolution)}>
- {resolutions.map((option) => {
- const { width, height } = outputDimensions(option, aspectRatio);
- return <option key={option} value={option}>{width} × {height}{option === DEFAULT_RESOLUTION ? " (default)" : ""}</option>;
- })}
- </select>
- </label>
- <label>
- <span><Palette size={15} aria-hidden="true" /> Look</span>
- <select aria-label="Look" disabled={busy} value={defaultLook} onChange={(event) => setDefaultLook(event.target.value)}>
- <option value="">None</option>
- {LOOKS.map((look) => <option key={look.id} value={look.id}>{look.label}</option>)}
- </select>
- </label>
- </div>
+ {/* The real pixels, not a name for them. Every rung is a multiple
+ of 32 on both edges — what MiniMax H3 generates at — and they
+ are relabelled when the shape above changes, because 768p is
+ 1376×768 widescreen and 768×1376 vertical. */}
+ <div className="composer__field">
+ <label htmlFor={`${id}-resolution`}>Resolution</label>
+ <select id={`${id}-resolution`} disabled={busy} value={resolution} onChange={(event) => setResolution(event.target.value as Resolution)}>
+ {resolutions.map((option) => {
+ const { width, height } = outputDimensions(option, aspectRatio);
+ return <option key={option} value={option}>{width} × {height}{option === DEFAULT_RESOLUTION ? " (default)" : ""}</option>;
+ })}
+ </select>
+ </div>
+ <div className="composer__field">
+ <label htmlFor={`${id}-look`}>Look</label>
+ <select id={`${id}-look`} aria-label="Look" disabled={busy} value={defaultLook} onChange={(event) => setDefaultLook(event.target.value)}>
+ <option value="">None</option>
+ {LOOKS.map((look) => <option key={look.id} value={look.id}>{look.label}</option>)}
+ </select>
</div>
- </section>
-
- <div className="composer__actions">
- {(folderError || error) && <p className="composer__error" id="create-error" role="alert">{folderError || error}</p>}
- <button className="primary-button composer__submit" disabled={busy || checkingFolder || Boolean(folderError) || !name.trim()} aria-describedby={folderError || error ? "create-error" : undefined} aria-busy={busy || checkingFolder} onClick={() => void submit()}>
- {busy ? <span className="spinner" /> : project ? <Save size={18} /> : <WandSparkles size={18} />}
- {project ? "Save changes" : "Create project"}
- </button>
</div>
+ {message && <InfoBar severity="error" title={folderError ? "Choose another folder" : project ? "Couldn’t save" : "Couldn’t create the project"} message={message} />}
</div>
- </section>
- </div>
+ </ContentDialog>
);
}
diff --git a/src/components/ReferenceIconGenerationDialog.tsx b/src/components/ReferenceIconGenerationDialog.tsx
index 1bb3123..1696b3e 100644
--- a/src/components/ReferenceIconGenerationDialog.tsx
+++ b/src/components/ReferenceIconGenerationDialog.tsx
@@ -1,69 +1,39 @@
-import { ImagePlus } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { useState } from "react";
+import { Checkbox, ContentDialog } from "./ui";
+/* Asks before the engine spends GPU time on reference icons. A ContentDialog
+ rather than a native message box because it carries a check box. Cancel is
+ the default answer (Enter), and it is a real button rather than the dialog's
+ close action so that only choosing it remembers "Don't ask again": Esc
+ skips this batch and remembers nothing. */
export function ReferenceIconGenerationDialog({ count, onAnswer, builtins = false }: {
count: number;
builtins?: boolean;
onAnswer: (confirmed: boolean, remember: boolean) => void;
}) {
const [remember, setRemember] = useState(false);
- const dialog = useRef<HTMLDivElement>(null);
- const cancel = useRef<HTMLButtonElement>(null);
-
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- cancel.current?.focus();
- return () => opener?.focus?.();
- }, []);
-
- useEffect(() => {
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- event.preventDefault();
- event.stopImmediatePropagation();
- onAnswer(false, false);
- }
- if (event.key !== "Tab" || !dialog.current) return;
- const stops = Array.from(dialog.current.querySelectorAll<HTMLElement>("button, input"));
- const first = stops[0];
- const last = stops[stops.length - 1];
- const active = document.activeElement as HTMLElement | null;
- if (!event.shiftKey && (active === last || !dialog.current.contains(active))) {
- event.preventDefault();
- first.focus();
- } else if (event.shiftKey && (active === first || !dialog.current.contains(active))) {
- event.preventDefault();
- last.focus();
- }
- };
- window.addEventListener("keydown", onKeyDown, true);
- return () => window.removeEventListener("keydown", onKeyDown, true);
- }, [onAnswer]);
-
- return <div className="exit-guard-backdrop" onMouseDown={(event) => { if (event.target === event.currentTarget) onAnswer(false, false); }}>
- <div className="exit-guard" ref={dialog} role="alertdialog" aria-modal="true" aria-labelledby="reference-icon-generation-title" aria-describedby="reference-icon-generation-description">
- <div className="exit-guard__head">
- <span className="exit-guard__mark" aria-hidden="true"><ImagePlus size={20} /></span>
- <h2 id="reference-icon-generation-title">{builtins ? "Generate built-in reference icons?" : "Generate reference icons?"}</h2>
- </div>
- <div className="exit-guard__body" id="reference-icon-generation-description">
- {builtins ? <>
- <p>Generate icons for {count} built-in references to make them easier to browse?</p>
- <p>This can take a long time. Icon generation runs in the background and pauses for normal video generation, so you can keep creating videos.</p>
- <p>The icons are shared across projects and saved in a reference-icons subfolder beside the log files.</p>
- </> : <>
- <p>{count} {count === 1 ? "reference needs an icon" : "references need icons"}. Generate them now using the video engine? This uses your GPU; waiting videos take priority.</p>
- <p>Cancel skips this batch.</p>
- </>}
- </div>
- <label className="reference-icon-option">
- <input type="checkbox" checked={remember} onChange={(event) => setRemember(event.target.checked)} />
- <span><b>Don't ask again</b><small>{builtins ? "Remember whether to generate missing built-in icons when you open Add a reference." : "Remember Start as automatic generation, or Cancel as turning it off."}</small></span>
- </label>
- <div className="exit-guard__actions">
- <button className="secondary-button" type="button" ref={cancel} onClick={() => onAnswer(false, remember)}>Cancel</button>
- <button className="primary-button" type="button" onClick={() => onAnswer(true, remember)}>Start generation</button>
- </div>
- </div>
- </div>;
+ return (
+ <ContentDialog
+ title={builtins ? "Generate built-in reference icons?" : "Generate reference icons?"}
+ primaryText="Start generation"
+ onPrimary={() => onAnswer(true, remember)}
+ secondaryText="Cancel"
+ onSecondary={() => onAnswer(false, remember)}
+ onClose={() => onAnswer(false, false)}
+ defaultButton="secondary"
+ >
+ {builtins ? <>
+ <p>Generate icons for {count} built-in references to make them easier to browse? This can take a long time. It runs in the background and pauses for video generation.</p>
+ <p>The icons are shared across projects and saved in a reference-icons folder next to the log files.</p>
+ </> : <>
+ <p>{count} {count === 1 ? "reference needs an icon" : "references need icons"}. Generate them with the video engine now? This uses your GPU; videos waiting to render go first.</p>
+ </>}
+ <Checkbox
+ checked={remember}
+ onChange={setRemember}
+ label="Don't ask again"
+ description={builtins ? "Remember the answer when you open Add a reference." : "Start turns on automatic generation; Cancel turns it off."}
+ />
+ </ContentDialog>
+ );
}
diff --git a/src/components/SlopusLogo.tsx b/src/components/SlopusLogo.tsx
deleted file mode 100644
index 273502b..0000000
--- a/src/components/SlopusLogo.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import icon from "../../marketing/icon.png";
-
-interface SlopusLogoProps {
- compact?: boolean;
- decorative?: boolean;
- className?: string;
-}
-
-export function SlopusLogo({ compact = false, decorative = false, className = "" }: SlopusLogoProps) {
- const classes = ["slopus-logo", compact ? "slopus-logo--compact" : "", className].filter(Boolean).join(" ");
- return <img className={classes} src={icon} alt={decorative ? "" : "Slopus"} aria-hidden={decorative || undefined} />;
-}
diff --git a/src/components/UnsavedProjectDialog.tsx b/src/components/UnsavedProjectDialog.tsx
index 339aa86..01ce2af 100644
--- a/src/components/UnsavedProjectDialog.tsx
+++ b/src/components/UnsavedProjectDialog.tsx
@@ -1,6 +1,9 @@
-import { Save } from "lucide-react";
-import { useEffect, useRef } from "react";
+import { ContentDialog, InfoBar } from "./ui";
+/* Leaving a project with unsaved edits. The Windows question, in the Windows
+ order: [Save] [Don't save] [Cancel]. Save is the default (Enter), Esc is
+ Cancel. While the save is in flight every button is off and Esc does
+ nothing, so the answer cannot change under the write. */
export function UnsavedProjectDialog({ name, busy, error, onSave, onDiscard, onBack }: {
name: string;
busy: boolean;
@@ -9,39 +12,22 @@ export function UnsavedProjectDialog({ name, busy, error, onSave, onDiscard, onB
onDiscard: () => void;
onBack: () => void;
}) {
- const dialog = useRef<HTMLDivElement>(null);
- const save = useRef<HTMLButtonElement>(null);
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- save.current?.focus();
- return () => { if (opener?.isConnected) opener.focus(); };
- }, []);
- useEffect(() => {
- const keyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); if (!busy) onBack(); }
- if (event.key !== "Tab") return;
- const buttons = Array.from(dialog.current?.querySelectorAll<HTMLButtonElement>("button:not(:disabled)") ?? []);
- if (buttons.length === 0) { event.preventDefault(); return; }
- const next = event.shiftKey ? buttons.at(-1)! : buttons[0];
- if (!dialog.current?.contains(document.activeElement) || (event.shiftKey ? document.activeElement === buttons[0] : document.activeElement === buttons.at(-1))) {
- event.preventDefault(); next.focus();
- }
- };
- window.addEventListener("keydown", keyDown, true);
- return () => window.removeEventListener("keydown", keyDown, true);
- }, [busy, onBack]);
- return <div className="delete-project-backdrop">
- <div ref={dialog} className="delete-project-dialog" role="alertdialog" aria-modal="true" aria-labelledby="unsaved-project-title" aria-describedby="unsaved-project-description">
- <div className="delete-project-dialog__head"><h2 id="unsaved-project-title">Save changes?</h2></div>
- <div className="delete-project-dialog__body">
- <p id="unsaved-project-description">Save changes to “{name}” before returning to the project library?</p>
- {error && <p role="alert">Couldn’t save the project: {error}</p>}
- </div>
- <div className="delete-project-dialog__actions">
- <button type="button" className="secondary-button" disabled={busy} onClick={onBack}>Back</button>
- <button type="button" className="secondary-button" disabled={busy} onClick={onDiscard}>Discard changes</button>
- <button ref={save} type="button" className="primary-button" disabled={busy} onClick={onSave}><Save size={16} />{busy ? "Saving…" : "Save changes"}</button>
- </div>
- </div>
- </div>;
+ return (
+ <ContentDialog
+ title={`Save changes to “${name}”?`}
+ primaryText={busy ? "Saving…" : "Save"}
+ onPrimary={onSave}
+ primaryDisabled={busy}
+ secondaryText="Don't save"
+ onSecondary={onDiscard}
+ secondaryDisabled={busy}
+ closeText="Cancel"
+ onClose={() => { if (!busy) onBack(); }}
+ disableEscape={busy}
+ defaultButton="primary"
+ >
+ <p>Your changes will be lost if you don't save them.</p>
+ {error && <InfoBar severity="error" title="Couldn’t save the project" message={error} />}
+ </ContentDialog>
+ );
}
diff --git a/src/components/UpdatePanel.test.tsx b/src/components/UpdatePanel.test.tsx
index d811bf5..64d9e23 100644
--- a/src/components/UpdatePanel.test.tsx
+++ b/src/components/UpdatePanel.test.tsx
@@ -4,7 +4,7 @@ import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-libra
import { afterEach, expect, it, vi } from "vitest";
import type { DownloadEvent } from "@tauri-apps/plugin-updater";
import { AppUpdater } from "../lib/updater";
-import { UpdatePanel, UpdateProgress } from "./UpdatePanel";
+import { lastCheckedLabel, UpdateInfoBar, UpdatePanel } from "./UpdatePanel";
afterEach(cleanup);
function setup() {
@@ -13,18 +13,22 @@ function setup() {
return { updater, update };
}
-it("shows release notes as text and blocks installation when a project is open", async () => {
+it("shows the available version, release notes as text, and blocks installation when a project is open", async () => {
const { updater, update } = setup();
await updater.start();
const view = render(<UpdatePanel updater={updater} blockReason={() => "Close your project before installing an update."} />);
+ expect(screen.getByRole("heading", { name: "Slopus 0.2.0 is available" })).toBeInTheDocument();
+ expect(screen.getByText(/^Last checked: today/)).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: /What’s new/ }));
expect(screen.getByText("<b>Release notes</b>").querySelector("b")).toBeNull();
expect(screen.getByRole("button", { name: "Install and restart" })).toBeDisabled();
+ expect(screen.getByText("Close your project before installing an update.")).toBeInTheDocument();
view.rerender(<UpdatePanel updater={updater} blockReason={() => null} />);
fireEvent.click(screen.getByRole("button", { name: "Install and restart" }));
await waitFor(() => expect(update.install).toHaveBeenCalledOnce());
});
-it("shows download progress in a blocking dialog and restores controls after failure", async () => {
+it("shows download progress inline, without taking over the window, and restores controls after failure", async () => {
const { updater, update } = setup();
await updater.start();
let rejectDownload!: (reason: Error) => void;
@@ -33,14 +37,35 @@ it("shows download progress in a blocking dialog and restores controls after fai
listener?.({ event: "Progress", data: { chunkLength: 1048576 } });
return new Promise((_resolve, reject) => { rejectDownload = reject; });
});
- render(<><UpdatePanel updater={updater} blockReason={() => null} /><UpdateProgress updater={updater} /></>);
+ render(<><UpdatePanel updater={updater} blockReason={() => null} /><UpdateInfoBar updater={updater} onOpen={() => undefined} /></>);
fireEvent.click(screen.getByRole("button", { name: "Install and restart" }));
- expect(screen.getByRole("dialog", { name: "Updating Slopus" })).toHaveFocus();
- expect(screen.getByText("1.0 MB downloaded")).toBeInTheDocument();
- expect(screen.getByRole("progressbar")).not.toHaveAttribute("value");
- await act(async () => { rejectDownload(new Error("Network disconnected")); });
expect(screen.queryByRole("dialog")).toBeNull();
+ expect(screen.getAllByText("1.0 MB downloaded")).toHaveLength(2);
+ expect(screen.getByRole("progressbar", { name: "Update download" })).not.toHaveAttribute("aria-valuenow");
+ expect(screen.queryByRole("button", { name: "Install and restart" })).toBeNull();
+ await act(async () => { rejectDownload(new Error("Network disconnected")); });
+ expect(screen.queryByRole("progressbar")).toBeNull();
expect(screen.getByRole("alert")).toHaveTextContent("Network disconnected");
expect(screen.getByRole("button", { name: "Install and restart" })).toBeEnabled();
expect(update.install).not.toHaveBeenCalled();
});
+
+it("says when it last checked", () => {
+ const now = new Date(2026, 8, 26, 12, 0).getTime();
+ expect(lastCheckedLabel(null, now)).toBe("Not checked yet");
+ expect(lastCheckedLabel(new Date(2026, 8, 26, 9, 41).getTime(), now)).toMatch(/^Last checked: today, /);
+ expect(lastCheckedLabel(new Date(2026, 8, 20, 9, 41).getTime(), now)).not.toMatch(/today/);
+});
+
+it("offers the update from the library and can be dismissed", async () => {
+ const { updater } = setup();
+ await updater.start();
+ const onOpen = vi.fn();
+ const onDismiss = vi.fn();
+ render(<UpdateInfoBar updater={updater} onOpen={onOpen} onDismiss={onDismiss} />);
+ expect(screen.getByRole("status")).toHaveTextContent("Slopus 0.2.0 is ready to install.");
+ fireEvent.click(screen.getByRole("button", { name: "View update" }));
+ expect(onOpen).toHaveBeenCalledOnce();
+ fireEvent.click(screen.getByRole("button", { name: "Close" }));
+ expect(onDismiss).toHaveBeenCalledOnce();
+});
diff --git a/src/components/UpdatePanel.tsx b/src/components/UpdatePanel.tsx
index 0429ab9..abf2d58 100644
--- a/src/components/UpdatePanel.tsx
+++ b/src/components/UpdatePanel.tsx
@@ -1,38 +1,124 @@
-import { useSyncExternalStore } from "react";
+import { CheckCircle2, Download, RefreshCw, RotateCcw } from "lucide-react";
+import { useSyncExternalStore, type ReactNode } from "react";
import type { AppUpdater } from "../lib/updater";
+import { Expander, InfoBar, ProgressBar, ProgressRing } from "./ui";
+
+type UpdaterState = ReturnType<AppUpdater["getSnapshot"]>;
+
+/* Updates, the way Windows Update shows them: one header card with a status
+ glyph, a one-line status ("You're up to date", "Slopus 1.2.3 is
+ available"), when the last check was, and the one action that fits the
+ state at the trailing edge. A download shows as a 3px bar inside that card
+ — it no longer takes over the window. Release notes fold into a "What's
+ new" expander under it.
+
+ Props are unchanged from before the rework, so SettingsView can keep
+ placing it as it did: <UpdatePanel updater={…} blockReason={…} />. */
+
+export function lastCheckedLabel(time: number | null, now = Date.now()): string {
+ if (time === null) return "Not checked yet";
+ const when = new Date(time);
+ const clock = new Intl.DateTimeFormat(undefined, { hour: "2-digit", minute: "2-digit" }).format(when);
+ const today = new Date(now);
+ const sameDay = when.getFullYear() === today.getFullYear() && when.getMonth() === today.getMonth() && when.getDate() === today.getDate();
+ const day = sameDay ? "today" : new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric" }).format(when);
+ return `Last checked: ${day}, ${clock}`;
+}
+
+function percentOf(state: UpdaterState): number | undefined {
+ return state.total ? Math.min(100, Math.round(state.downloaded / state.total * 100)) : undefined;
+}
+
+function downloadedLabel(state: UpdaterState): string {
+ const percent = percentOf(state);
+ return percent === undefined ? `${(state.downloaded / 1048576).toFixed(1)} MB downloaded` : `${percent}% downloaded`;
+}
+
+function statusTitle(state: UpdaterState): string {
+ switch (state.stage) {
+ case "disabled": return "Updates aren’t available in this copy";
+ case "checking": return "Checking for updates…";
+ case "current": return "You’re up to date";
+ case "available": return `Slopus ${state.version} is available`;
+ case "downloading": return `Downloading Slopus ${state.version ?? "update"}`;
+ case "installing": return "Installing update…";
+ case "restart": return "Restart to finish updating";
+ default: return "Check for updates";
+ }
+}
export function UpdatePanel({ updater, blockReason }: { updater: AppUpdater; blockReason: () => string | null }) {
const state = useSyncExternalStore(updater.subscribe, updater.getSnapshot);
const busy = ["checking", "downloading", "installing"].includes(state.stage);
const blocked = blockReason();
- return <div className="update-panel">
- <h2>App updates</h2>
- <p>Slopus checks for updates each time it starts. You choose when to install and restart.</p>
- <p role="status">{state.stage === "disabled" ? "Updates are available in installed release builds. Download a new portable version to update a portable copy."
- : state.stage === "checking" ? "Checking for updates…"
- : state.stage === "current" ? "You’re up to date."
- : state.stage === "restart" ? "Update installed. Restart Slopus to finish."
- : state.version ? `Slopus ${state.version} is available.` : "Check for a new version of Slopus."}</p>
- {state.notes && <pre className="update-panel__notes">{state.notes}</pre>}
- {state.error && <p role="alert">{state.error}</p>}
- {state.version && blocked && <p>{blocked}</p>}
- <div className="update-panel__actions">
- <button type="button" className="secondary-button" disabled={busy || state.stage === "disabled" || state.stage === "restart"} onClick={() => void updater.check()}>Check for updates</button>
- {state.version && state.stage !== "restart" && <button type="button" className="primary-button" disabled={busy || Boolean(blocked)} onClick={() => void updater.install(blockReason)}>Install and restart</button>}
- {state.stage === "restart" && <button type="button" className="primary-button" disabled={Boolean(blocked)} onClick={() => void updater.restart(blockReason)}>Restart Slopus</button>}
+ const transferring = state.stage === "downloading" || state.stage === "installing";
+
+ const glyph: ReactNode = state.stage === "checking" ? <ProgressRing size={32} aria-label="Checking for updates" />
+ : state.stage === "current" ? <CheckCircle2 size={32} aria-hidden="true" />
+ : state.stage === "restart" ? <RotateCcw size={32} aria-hidden="true" />
+ : state.stage === "available" || transferring ? <Download size={32} aria-hidden="true" />
+ : <RefreshCw size={32} aria-hidden="true" />;
+
+ const action = state.stage === "disabled" || transferring ? null
+ : state.stage === "restart"
+ ? <button type="button" className="primary-button" disabled={Boolean(blocked)} onClick={() => void updater.restart(blockReason)}>Restart Slopus</button>
+ : state.stage === "available"
+ ? <button type="button" className="primary-button" disabled={busy || Boolean(blocked)} onClick={() => void updater.install(blockReason)}>Install and restart</button>
+ : <button type="button" className="secondary-button" disabled={busy} onClick={() => void updater.check()}>Check for updates</button>;
+
+ return (
+ <div className="update-panel">
+ <div className={`update-card update-card--${state.stage}`}>
+ <span className="update-card__glyph">{glyph}</span>
+ <div className="update-card__text" aria-live="polite">
+ <h2 className="update-card__title">{statusTitle(state)}</h2>
+ <span className="update-card__caption">
+ {state.stage === "disabled"
+ ? "Installed release builds update themselves. To update a portable copy, download the new version."
+ : state.stage === "installing" ? "Slopus restarts when the update is ready."
+ : lastCheckedLabel(state.lastChecked)}
+ </span>
+ {state.stage === "downloading" && <>
+ <span className="update-card__caption update-card__progress-label">{downloadedLabel(state)}</span>
+ <ProgressBar value={percentOf(state)} aria-label="Update download" className="update-card__progress" />
+ </>}
+ {state.stage === "installing" && <ProgressBar aria-label="Installing update" className="update-card__progress" />}
+ </div>
+ {action && <div className="update-card__action">{action}</div>}
+ </div>
+ {state.error && <InfoBar severity="error" title="Update failed" message={state.error} />}
+ {state.version && blocked && state.stage !== "restart" && !transferring && <InfoBar severity="warning" message={blocked} />}
+ {state.stage === "restart" && blocked && <InfoBar severity="warning" message={blocked} />}
+ {state.notes && (
+ <Expander header="What’s new" description={state.version ? `Slopus ${state.version}` : undefined} className="update-panel__notes-expander">
+ <pre className="update-panel__notes">{state.notes}</pre>
+ </Expander>
+ )}
</div>
- </div>;
+ );
}
-export function UpdateProgress({ updater }: { updater: AppUpdater }) {
+/* The same updater state as a one-line InfoBar, for the top of the library:
+ an available update, a download in progress, or a restart still owed. The
+ full card lives in Settings > Updates; `onOpen` goes there. */
+export function UpdateInfoBar({ updater, onOpen, onDismiss }: { updater: AppUpdater; onOpen: () => void; onDismiss?: () => void }) {
const state = useSyncExternalStore(updater.subscribe, updater.getSnapshot);
- if (state.stage !== "downloading" && state.stage !== "installing") return null;
- const percent = state.total ? Math.min(100, Math.round(state.downloaded / state.total * 100)) : undefined;
- return <div className="update-progress" role="dialog" aria-modal="true" aria-label="Updating Slopus" tabIndex={-1} ref={(node) => node?.focus()} onKeyDown={(event) => { event.stopPropagation(); if (event.key === "Tab") event.preventDefault(); }}>
- <div className="update-panel">
- <h2>{state.stage === "downloading" ? "Downloading update…" : "Installing update…"}</h2>
- <p role="status">{state.stage === "downloading" ? (percent === undefined ? `${(state.downloaded / 1048576).toFixed(1)} MB downloaded` : `${percent}% downloaded`) : "Slopus will restart when the update is ready."}</p>
- <progress aria-label="Update download" max={100} value={state.stage === "downloading" ? percent : undefined} />
- </div>
- </div>;
+ if (state.stage === "available") {
+ return <InfoBar severity="informational" title="Update available" message={`Slopus ${state.version} is ready to install.`}
+ action={<button type="button" className="secondary-button" onClick={onOpen}>View update</button>} onClose={onDismiss} />;
+ }
+ if (state.stage === "downloading" || state.stage === "installing") {
+ return <InfoBar severity="informational" title={state.stage === "downloading" ? "Downloading update" : "Installing update"}
+ message={state.stage === "downloading" ? downloadedLabel(state) : "Slopus restarts when the update is ready."} />;
+ }
+ if (state.stage === "restart") {
+ return <InfoBar severity="success" title="Update installed" message="Restart Slopus to finish updating."
+ action={<button type="button" className="secondary-button" onClick={onOpen}>Restart…</button>} />;
+ }
+ return null;
+}
+
+/** True when the title bar's Settings button should carry the update dot. */
+export function updateNeedsAttention(stage: UpdaterState["stage"]): boolean {
+ return stage === "available" || stage === "restart";
}
diff --git a/src/components/WorkQueuePanel.tsx b/src/components/WorkQueuePanel.tsx
index 4b59de6..a944d50 100644
--- a/src/components/WorkQueuePanel.tsx
+++ b/src/components/WorkQueuePanel.tsx
@@ -1,84 +1,95 @@
-import { Check, Clock3, Download, ListTodo, LoaderCircle, TriangleAlert, X } from "lucide-react";
-import { useEffect, useRef, useState, useSyncExternalStore } from "react";
-import { createPortal } from "react-dom";
+import { Check, Clock3, Download, ListTodo, TriangleAlert, X } from "lucide-react";
+import { useState, useSyncExternalStore, type RefObject } from "react";
import { GENERATION_FRAME_RATE } from "../lib/project";
import { isWorkActive, type WorkItem, type WorkQueue } from "../lib/workQueue";
import { loadGeneratorTemplateSettings } from "../lib/settings";
import { cancelWeightDownload, retryWeightDownload, getWeightDownloadState, subscribeWeightDownloads, weightDownloadProgress } from "../lib/weightDownloads";
+import { Flyout, ProgressBar, ProgressRing } from "./ui";
-export function WorkQueuePanel({ queue, items, onClose }: { queue: WorkQueue; items: readonly WorkItem[]; onClose: () => void }) {
+/* The work queue, as a flyout hanging from its title-bar button: no scrim, no
+ focus trap, light dismiss (a click outside, Esc, the window losing focus).
+ One flat list — what is running, the weight download, what is up next,
+ what has finished — each row an icon, a title, one caption line and, while
+ it runs, a 3px bar. The render settings a row was queued with sit in its
+ tooltip rather than on a third line. */
+
+const settingsLine = (item: WorkItem) => `${item.settings.canvasWidth} × ${item.settings.canvasHeight} · ${item.kind === "reference-icons" ? "JPG icons" : item.kind === "image" ? "JPG image" : `${(item.settings.frames / GENERATION_FRAME_RATE).toFixed(1)}s`} · ${item.settings.steps} steps · ${item.settings.seed === -1 ? "Random seed" : `Seed ${item.settings.seed}`}`;
+
+function StateGlyph({ item }: { item: WorkItem }) {
+ if (item.status === "completed") return <Check size={16} />;
+ if (item.status === "failed") return <TriangleAlert size={16} />;
+ if (item.status === "queued") return <Clock3 size={16} />;
+ if (item.status === "cancelled") return <X size={16} />;
+ return <ProgressRing size={16} />;
+}
+
+export function WorkQueuePanel({ queue, items, open = true, anchor = null, onClose }: {
+ queue: WorkQueue;
+ items: readonly WorkItem[];
+ /** Default true, so it can be rendered conditionally. */
+ open?: boolean;
+ /** The title-bar button it hangs from. */
+ anchor?: RefObject<HTMLElement | null> | null;
+ onClose: () => void;
+}) {
// Downloads are observed here, never enqueued in the GPU generation scheduler.
const download = useSyncExternalStore(subscribeWeightDownloads, getWeightDownloadState);
const [downloadError, setDownloadError] = useState<string | null>(null);
const downloadName = download ? download.name ?? loadGeneratorTemplateSettings().templates.find((template) => template.id === download.templateId)?.name ?? "Generator weights" : "";
- const panel = useRef<HTMLElement>(null);
- const close = useRef<HTMLButtonElement>(null);
- useEffect(() => {
- const opener = document.activeElement as HTMLElement | null;
- close.current?.focus();
- return () => { if (opener?.isConnected) opener.focus(); };
- }, []);
- useEffect(() => {
- const keyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); onClose(); }
- if (event.key === "Tab") {
- const buttons = Array.from(panel.current?.querySelectorAll<HTMLElement>("button:not(:disabled), summary, [tabindex='0']") ?? []);
- const first = buttons[0], last = buttons.at(-1);
- if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last?.focus(); }
- else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first?.focus(); }
- }
- };
- window.addEventListener("keydown", keyDown, true);
- return () => window.removeEventListener("keydown", keyDown, true);
- }, [onClose]);
const current = items.filter((item) => isWorkActive(item) && item.status !== "queued");
const upcoming = items.filter((item) => item.status === "queued").sort((a, b) => Number(a.kind === "reference-icons") - Number(b.kind === "reference-icons"));
const finished = items.filter((item) => !isWorkActive(item)).slice().reverse();
- const row = (item: WorkItem) => <li className={`work-queue__item${isWorkActive(item) && item.status !== "queued" ? "" : " work-queue__item--compact"}`} key={item.id}>
- <div className="work-queue__item-heading">
- <span className={`work-queue__state work-queue__state--${item.status}`} aria-hidden="true">
- {item.status === "completed" ? <Check size={17} /> : item.status === "failed" ? <TriangleAlert size={17} /> : item.status === "queued" ? <Clock3 size={17} /> : item.status === "cancelled" ? <X size={17} /> : <LoaderCircle className="work-queue__spinner" size={17} />}
- </span>
- <div><strong title={item.title}>{item.title}</strong><span title={item.folderPath}>{item.projectName}</span></div>
- {isWorkActive(item) && item.status !== "encoding" && <button type="button" className="icon-button" disabled={item.cancelling} aria-label={`Cancel ${item.title} in ${item.projectName}`} title="Cancel this work" onClick={() => void queue.cancel(item.id)}><X size={16} /></button>}
- </div>
- <div className="work-queue__metadata">
- <div className="work-queue__detail"><span>{item.detail}</span>{isWorkActive(item) && item.status !== "queued" && <b>{Math.floor(item.progress * 100)}%</b>}</div>
- {isWorkActive(item) && item.status !== "queued" && <progress max={1} value={item.progress} aria-label={`${item.title} progress`} />}
- <p className="work-queue__settings">{item.settings.canvasWidth} × {item.settings.canvasHeight} · {item.kind === "reference-icons" ? "JPG icons" : item.kind === "image" ? "JPG image" : `${(item.settings.frames / GENERATION_FRAME_RATE).toFixed(1)}s`} · {item.settings.steps} steps · {item.settings.seed === -1 ? "Random seed" : `Seed ${item.settings.seed}`}</p>
- </div>
- {item.error && <p className="work-queue__error">{item.error}</p>}
- {item.needsSave && <button type="button" className="secondary-button" onClick={() => void queue.retrySave(item.id)}>Retry project save</button>}
- </li>;
- return createPortal(<div className="work-queue-backdrop" onMouseDown={(event) => { if (event.target === event.currentTarget) onClose(); }}>
- <section ref={panel} className="work-queue-panel" role="dialog" aria-modal="true" aria-labelledby="work-queue-title">
- <header className="work-queue__header"><div><ListTodo size={20} /><h2 id="work-queue-title">Work Queue</h2></div><button ref={close} type="button" className="icon-button icon-button--strong" aria-label="Close work queue" onClick={onClose}><X size={18} /></button></header>
- <p className="work-queue__intro">Work continues across projects, using the settings from when it was added.</p>
+
+ const row = (item: WorkItem) => {
+ const running = isWorkActive(item) && item.status !== "queued";
+ return <li className="work-queue__row" key={item.id}>
+ <span className={`work-queue__state work-queue__state--${item.status}`} aria-hidden="true"><StateGlyph item={item} /></span>
+ <div className="work-queue__text">
+ <span className="work-queue__title" data-tooltip={`${item.title} — ${settingsLine(item)}`}>{item.title}</span>
+ <span className="work-queue__caption" data-tooltip={item.folderPath}>{item.projectName} · {item.detail}{running ? ` · ${Math.floor(item.progress * 100)}%` : ""}</span>
+ {running && <ProgressBar value={item.progress * 100} aria-label={`${item.title} progress`} className="work-queue__progress" />}
+ {item.error && <span className="work-queue__error">{item.error}</span>}
+ {item.needsSave && <button type="button" className="work-queue__link" onClick={() => void queue.retrySave(item.id)}>Retry project save</button>}
+ </div>
+ {isWorkActive(item) && item.status !== "encoding" && (
+ <button type="button" className="icon-button work-queue__cancel" disabled={item.cancelling} aria-label={`Cancel ${item.title} in ${item.projectName}`} data-tooltip="Cancel" onClick={() => void queue.cancel(item.id)}><X size={16} /></button>
+ )}
+ </li>;
+ };
+
+ return (
+ <Flyout open={open} anchor={anchor} onClose={onClose} placement="bottom" aria-labelledby="work-queue-title" className="work-queue" width={360}>
+ <header className="work-queue__header">
+ <h2 id="work-queue-title">Work queue</h2>
+ {finished.length > 0 && <button type="button" className="work-queue__link" onClick={() => queue.clearFinished()}>Clear finished</button>}
+ </header>
<div className="work-queue__list">
- {items.length === 0 && !download && <div className="work-queue__empty"><ListTodo size={28} /><strong>No work yet</strong><p>Generate a scene to add it to the queue.</p></div>}
- {current.length > 0 && <section aria-label="In progress"><h3>In progress</h3><ul>{current.map(row)}</ul></section>}
- {download && <section aria-label="Weight downloads"><h3>Downloads</h3><ul><li className="work-queue__item">
- <div className="work-queue__item-heading">
- <span className={`work-queue__state work-queue__state--${download.active ? "preparing" : download.error ? "failed" : "completed"}`} aria-hidden="true">
- {download.active ? <Download size={17} /> : download.error ? <TriangleAlert size={17} /> : <Check size={17} />}
+ {items.length === 0 && !download && <div className="work-queue__empty"><ListTodo size={32} aria-hidden="true" /><strong>No work yet</strong><span>Generated scenes and images show up here.</span></div>}
+ {current.length > 0 && <section aria-label="In progress"><ul>{current.map(row)}</ul></section>}
+ {download && <section aria-label="Weight downloads"><ul><li className="work-queue__row">
+ <span className={`work-queue__state work-queue__state--${download.active ? "preparing" : download.error ? "failed" : "completed"}`} aria-hidden="true">
+ {download.active ? <Download size={16} /> : download.error ? <TriangleAlert size={16} /> : <Check size={16} />}
+ </span>
+ <div className="work-queue__text">
+ <span className="work-queue__title">{downloadName}</span>
+ <span className="work-queue__caption">
+ {download.loraId ? "LoRA download" : "Weight download"} · {download.active
+ ? `${download.completed}/${download.files} files · ${(download.downloaded / 1024 ** 3).toFixed(2)} GB${download.total ? ` of ${(download.total / 1024 ** 3).toFixed(2)} GB` : ""} · ${Math.floor(weightDownloadProgress(download))}%`
+ : download.error ? "Failed" : "Download complete"}
</span>
- <div><strong>{downloadName}</strong><span>{download.loraId ? "LoRA download" : "Weight download"}</span></div>
- {download.active && <button type="button" className="icon-button" aria-label={`Cancel ${downloadName} download`} onClick={() => {
- setDownloadError(null);
- void cancelWeightDownload().catch((reason) => setDownloadError(String(reason)));
- }}><X size={16} /></button>}
- </div>
- <div className="work-queue__detail"><span>{download.active ? `${download.completed}/${download.files} files · ${(download.downloaded / 1024 ** 3).toFixed(2)} GB${download.total ? ` / ${(download.total / 1024 ** 3).toFixed(2)} GB` : ""}` : download.error ?? "Download complete"}</span>
- {download.active && <b>{Math.floor(weightDownloadProgress(download))}%</b>}
+ {download.active && <ProgressBar value={weightDownloadProgress(download)} aria-label={`${downloadName} download progress`} className="work-queue__progress" />}
+ {download.error && <span className="work-queue__error">{download.error}</span>}
+ {download.error && <button type="button" className="work-queue__link" onClick={() => { setDownloadError(null); void retryWeightDownload(); }}>Retry download</button>}
+ {downloadError && <span className="work-queue__error" role="alert">{downloadError}</span>}
</div>
- {download.active && <progress max={100} value={weightDownloadProgress(download)} aria-label={`${downloadName} download progress`} />}
- {download.active && <p className="work-queue__settings">Generations can continue during this download.</p>}
- {download.error && <button type="button" className="secondary-button" onClick={() => { setDownloadError(null); void retryWeightDownload(); }}>Retry download</button>}
- {downloadError && <p className="work-queue__error" role="alert">{downloadError}</p>}
+ {download.active && <button type="button" className="icon-button work-queue__cancel" aria-label={`Cancel ${downloadName} download`} data-tooltip="Cancel" onClick={() => {
+ setDownloadError(null);
+ void cancelWeightDownload().catch((reason) => setDownloadError(String(reason)));
+ }}><X size={16} /></button>}
</li></ul></section>}
- {upcoming.length > 0 && <section aria-label="Upcoming work"><h3>Up next <span>{upcoming.length}</span></h3><ul>{upcoming.map(row)}</ul></section>}
- {finished.length > 0 && <section aria-label="Finished work"><h3>Finished <button type="button" onClick={() => queue.clearFinished()}>Clear</button></h3><ul>{finished.map(row)}</ul></section>}
+ {upcoming.length > 0 && <section aria-label="Upcoming work"><h3 className="work-queue__group">Up next · {upcoming.length}</h3><ul>{upcoming.map(row)}</ul></section>}
+ {finished.length > 0 && <section aria-label="Finished work"><h3 className="work-queue__group">Finished</h3><ul>{finished.map(row)}</ul></section>}
</div>
- </section>
- </div>, document.body);
+ </Flyout>
+ );
}
diff --git a/src/lib/shellKeys.ts b/src/lib/shellKeys.ts
new file mode 100644
index 0000000..f04de4c
--- /dev/null
+++ b/src/lib/shellKeys.ts
@@ -0,0 +1,39 @@
+/* Shortcuts the browser guard gets to first.
+
+ installBrowserGuards (nativeShell.ts) cancels a few keys before the page
+ sees them — Alt+Left (browser Back) in the capture phase, and Ctrl+F (the
+ Edge find bar) in a window listener registered at startup, ahead of the
+ commands.ts dispatcher. The dispatcher skips any press whose default is
+ already prevented, so useShortcut can never fire for those keys in the
+ desktop app. These two ARE Slopus commands (Back to the library, Search
+ projects), so they listen on the document instead: a document listener
+ runs before any window listener in the bubble phase, and it ignores the
+ guard's preventDefault, which only exists to stop the browser's own action.
+
+ Same rules as useShortcut otherwise: nothing while an aria-modal dialog is
+ open, text fields left alone unless `allowInInput`. */
+
+import { useEffect, useRef } from "react";
+import { isTextEntry, matchesCombo } from "./commands";
+
+export function useGuardedShortcut(
+ combo: string,
+ handler: (event: KeyboardEvent) => void,
+ options: { enabled?: boolean; allowInInput?: boolean } = {},
+) {
+ const handlerRef = useRef(handler);
+ handlerRef.current = handler;
+ const { enabled = true, allowInInput = false } = options;
+ useEffect(() => {
+ if (!enabled) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.isComposing || !matchesCombo(event, combo)) return;
+ if (document.querySelector('[aria-modal="true"]')) return;
+ if (!allowInInput && isTextEntry(event.target)) return;
+ event.preventDefault();
+ handlerRef.current(event);
+ };
+ document.addEventListener("keydown", onKeyDown);
+ return () => document.removeEventListener("keydown", onKeyDown);
+ }, [combo, enabled, allowInInput]);
+}
diff --git a/src/lib/theme.test.ts b/src/lib/theme.test.ts
index 0605fbb..6fc182b 100644
--- a/src/lib/theme.test.ts
+++ b/src/lib/theme.test.ts
@@ -477,39 +477,6 @@ const LITERALS_ALLOWED: Record<string, Record<string, string>> = {
".titlebar__caption--close:active":
"the pressed shade of the same Windows caption close red",
},
- "library.css": {
- /* library.css says all of this in prose above the rules; the point of
- repeating it here is that the guard knows, not that a reader does. */
- ".project-card__art--aurora": "generated cover art: a picture, not a surface",
- ".project-card__art--aurora::before": "generated cover art",
- ".project-card__art--aurora::after": "generated cover art",
- ".project-card__art--paper": "generated cover art",
- ".project-card__art--paper::before": "generated cover art",
- ".project-card__art--paper::after": "generated cover art",
- ".project-card__art--chrome": "generated cover art",
- ".project-card__art--chrome::before": "generated cover art",
- ".project-card__art--chrome::after": "generated cover art",
- ".project-card__art--ember": "generated cover art",
- /* These three sit ON the artwork, and each paints its OWN dark plate. That
- is the whole justification, and it is a fact about these rules rather
- than about the pictures: two of the four covers are pale (--paper is
- #cabca3, --chrome peaks at #dce7e7), so the note that used to stand here
- — "white on a dark picture in both themes, because the picture is dark in
- both" — was simply false, and the caption it excused measured 1.64:1.
-
- Do NOT restate a ratio here. The first repair left "5.29:1 over the
- palest cover" on the badges, which was true of the four covers that exist
- and said nothing about the backdrop the rule actually has to survive — a
- bound over the palest GENERATED cover, in a list two paragraphs under a
- comment declaring exactly that standard insufficient. All three now name
- the test instead, and the test recomputes them. */
- ".project-card__format, .project-card__quality":
- "white ink on the dark plate this rule paints for itself, clearing 4.5:1 over any backdrop at all — recomputed from the two literals by the test below",
- ".project-card__art-copy":
- "white ink on the strip this rule paints for itself, clearing 4.5:1 over any backdrop at all — recomputed from the two literals by the test below",
- ".project-card__art-copy::before":
- "the feathered top edge of that strip: decoration, with no text on it",
- },
};
describe("no stylesheet outside tokens.css names a colour", () => {
@@ -671,121 +638,3 @@ describe("the stylesheets behave like a Windows app", () => {
});
}
});
-
-/* --- The two rules that land on a picture instead of a palette ------------- *
-
- Everywhere else, legibility is a property of two tokens and can be argued
- about by reading tokens.css. The library card's cover chrome is the
- exception: the two badges and the caption print white ink over generated
- artwork, and both rules are exempted from the guard above.
-
- The caption's exemption used to read "white on a dark picture in both themes,
- because the picture is dark in both". Two of the four covers are not dark: it
- measured 1.64:1 at its worst pixel over --paper in Chrome — the same in both
- themes — with a text-shadow as the only thing standing between the user's
- words and a blank strip.
-
- The badges then inherited a subtler version of the same fiction: "each
- carries its OWN dark plate, whatever the picture under it turns out to be",
- asserted in prose with nothing recomputing it. Their plate was
- rgba(4,6,10,0.55), which composites to mid-grey over a pale backdrop —
- 3.78:1 measured over a white thumbnail,
- failing 4.5:1 over exactly the case the sentence claimed to cover.
- `backdrop-filter: blur(8px)` does not help: it blurs without darkening.
-
- So neither rule is trusted to prose any more. Each is recomputed here
- from its own two literals against the worst backdrop that can physically
- exist — PURE WHITE — which is a floor rather than an average: every real
- cover is darker than white, so every real cover composites darker than this.
- It therefore holds for the four covers today, for any cover added later, and
- for a real thumbnail dropped in through ProjectCard's inline background
- image, none of which this file can see. */
-
-const linear = (channel: number) => {
- const value = channel / 255;
- return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
-};
-const luminance = ([r, g, b]: number[]) => 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
-const contrastRatio = (a: number[], b: number[]) => {
- const [lighter, darker] = [luminance(a), luminance(b)].sort((x, y) => y - x);
- return (lighter + 0.05) / (darker + 0.05);
-};
-
-/** `src` laid over `dst` at `src`'s own alpha. */
-const composite = (src: number[], dst: number[]) =>
- dst.map((channel, at) => src[3] * src[at] + (1 - src[3]) * channel);
-
-const WHITE = [255, 255, 255];
-
-/** One declaration's value, or a throw. A rule that has LOST its `color` or its
- * `background` must fail loudly: silently reading `undefined` as black is how
- * a guard reports a ratio for a plate that is no longer painted. */
-function declaration(rule: string, property: string): string {
- const found = rule.match(new RegExp(`(?:^|[;{\\s])${property}\\s*:\\s*([^;]+);`));
- if (!found) throw new Error(`no ${property} declared in this rule`);
- return found[1].trim();
-}
-
-/** `#rgb`, `#rrggbb`, `rgb(…)` or `rgba(…)` as [r, g, b, alpha]. Anything else
- * throws rather than being guessed at — including `var()`, which would mean
- * the rule had moved to the palette and should lose its exemption instead. */
-function rgba(literal: string): number[] {
- const hex = literal.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
- if (hex) {
- const full = hex[1].length === 3 ? [...hex[1]].map((digit) => digit + digit).join("") : hex[1];
- return [...[0, 2, 4].map((at) => parseInt(full.slice(at, at + 2), 16)), 1];
- }
- const call = literal.match(/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+))?\s*\)$/i);
- if (!call) throw new Error(`not a colour this test can read: ${literal}`);
- return [Number(call[1]), Number(call[2]), Number(call[3]), call[4] === undefined ? 1 : Number(call[4])];
-}
-
-/** What the ink of one rule measures against its own plate over `backdrop`. */
-function inkOnPlate(rule: string, backdrop: number[]): number {
- const plate = composite(rgba(declaration(rule, "background")), backdrop);
- const ink = composite(rgba(declaration(rule, "color")), plate);
- return contrastRatio(ink, plate);
-}
-
-/* Keyed by the selector `block()` is asked for, because that string is the only
- thing tying a bound to the rule it is a bound for. */
-const COVER_CHROME = {
- "\n.project-card__format,\n.project-card__quality {": "the two corner badges",
- "\n.project-card__art-copy {": "the caption strip",
-};
-
-describe("the chrome that sits on the cover artwork", () => {
- const css = readCss("src/styles/library.css");
-
- it("computes a ratio it can be caught getting wrong", () => {
- /* The maths above is the whole assertion, so it gets its own self-check
- before it is trusted with two rules. Both plates below are the ones
- that actually shipped and actually failed; if a refactor made this
- function optimistic, these are what would go green first. */
- expect(inkOnPlate("color: #fff; background: rgba(4,6,10,0.86);", WHITE)).toBeCloseTo(14.59, 1);
- expect(inkOnPlate("color: rgba(255,255,255,0.85); background: rgba(4,6,10,0.55);", WHITE)).toBeCloseTo(3.79, 1);
- /* And that it is reading BOTH literals rather than one: opaque black plate,
- white ink, is 21:1 and nothing else is. */
- expect(inkOnPlate("color: #fff; background: rgba(0,0,0,1);", WHITE)).toBeCloseTo(21, 5);
- /* A rule that has stopped painting its own plate is a failure, not a pass. */
- expect(() => inkOnPlate("color: #fff;", WHITE)).toThrow(/no background/);
- expect(() => inkOnPlate("color: var(--text); background: rgba(0,0,0,1);", WHITE)).toThrow(/not a colour/);
- });
-
- for (const [selector, what] of Object.entries(COVER_CHROME)) {
- const rule = block(css, selector);
-
- it(`${what} is legible over the worst cover that could ever exist`, () => {
- expect(inkOnPlate(rule, WHITE)).toBeGreaterThanOrEqual(4.5);
- });
-
- it(`${what} does not lean on a text-shadow to get there`, () => {
- /* A shadow is what the old caption had instead of a plate, and it is part
- of why nobody noticed: it makes 1.64:1 look survivable in a screenshot
- while measuring the same 1.64:1. If one comes back it has to be
- decoration on top of a ratio that already passes, not the reason it
- passes. */
- expect(rule).not.toContain("text-shadow");
- });
- }
-});
diff --git a/src/lib/updater.ts b/src/lib/updater.ts
index 20eebf4..1fbf1df 100644
--- a/src/lib/updater.ts
+++ b/src/lib/updater.ts
@@ -11,12 +11,15 @@ interface UpdaterState {
downloaded: number;
total: number | undefined;
error: string | null;
+ /** When the last check finished (ms since the epoch), successful or not. */
+ lastChecked: number | null;
}
type UpdateHandle = Pick<Update, "version" | "body" | "download" | "install" | "close">;
interface UpdaterDependencies {
enabled: () => Promise<boolean>;
check: () => Promise<UpdateHandle | null>;
relaunch: () => Promise<void>;
+ now?: () => number;
}
const native: UpdaterDependencies = {
enabled: async () => isTauri() && await invoke<boolean>("app_updater_enabled"),
@@ -27,12 +30,13 @@ const describe = (reason: unknown) => reason instanceof Error ? reason.message :
/** App-owned state survives Settings closing and React StrictMode effects. */
export class AppUpdater {
- private state: UpdaterState = { stage: "disabled", version: null, notes: "", downloaded: 0, total: undefined, error: null };
+ private state: UpdaterState = { stage: "disabled", version: null, notes: "", downloaded: 0, total: undefined, error: null, lastChecked: null };
private listeners = new Set<() => void>();
private update: UpdateHandle | null = null;
private started = false;
private busy = false;
constructor(private dependencies: UpdaterDependencies = native) {}
+ private now = () => (this.dependencies.now ?? Date.now)();
getSnapshot = () => this.state;
subscribe = (listener: () => void) => { this.listeners.add(listener); return () => { this.listeners.delete(listener); }; };
private publish(patch: Partial<UpdaterState>) {
@@ -59,9 +63,9 @@ export class AppUpdater {
this.update = null;
this.publish({ version: null, notes: "" });
this.update = await this.dependencies.check();
- this.publish({ stage: this.update ? "available" : "current", version: this.update?.version ?? null, notes: this.update?.body ?? "" });
+ this.publish({ stage: this.update ? "available" : "current", version: this.update?.version ?? null, notes: this.update?.body ?? "", lastChecked: this.now() });
} catch (reason) {
- this.publish({ stage: this.update ? "available" : "idle", error: `Could not check for updates. ${describe(reason)}` });
+ this.publish({ stage: this.update ? "available" : "idle", error: `Couldn’t check for updates. ${describe(reason)}`, lastChecked: this.now() });
} finally { this.busy = false; }
};
install = async (blockReason: () => string | null) => {
diff --git a/src/styles/exit-guard.css b/src/styles/exit-guard.css
index 00feff4..5858794 100644
--- a/src/styles/exit-guard.css
+++ b/src/styles/exit-guard.css
@@ -1,172 +1,9 @@
/* ============================================================================
- exit-guard.css — the confirmation shown before an exit that would throw away
- a generation the engine is still working on.
+ exit-guard.css — retired.
- Colours come from tokens.css only. The scrim is the flat --scrim token,
- painted by a ::before layer: no blur (blur is for menus and flyouts only).
+ The exit guard is a native message box now (src-tauri/src/window.rs), and
+ the CUDA and reference-icon questions that borrowed these rules are
+ ContentDialogs (src/components/ui). Nothing renders an .exit-guard any more.
+ The file stays only because index.css still imports it; drop the import
+ and delete the file together.
========================================================================== */
-
-.exit-guard-backdrop {
- position: fixed;
- z-index: 200; /* above the settings overlay and toasts */
- inset: 0;
- display: grid;
- place-items: center;
- padding: var(--space-5);
-}
-
-.exit-guard-backdrop::before {
- content: "";
- position: absolute;
- inset: 0;
- background: var(--scrim);
-}
-
-.exit-guard {
- position: relative; /* clears the scrim */
- width: min(520px, 100%);
- display: grid;
- gap: var(--space-4);
- padding: var(--space-6);
- border: 1px solid var(--stroke-surface);
- border-radius: var(--radius-xl);
- background: var(--dialog-bg);
- box-shadow: var(--shadow);
-}
-
-.exit-guard__head {
- display: flex;
- align-items: center;
- gap: var(--space-3);
-}
-
-.exit-guard__mark {
- width: var(--control-sm);
- height: var(--control-sm);
- flex: none;
- display: grid;
- place-items: center;
- border-radius: var(--radius-md);
- border: 1px solid var(--danger);
- color: var(--danger);
- background: var(--panel-3);
-}
-
-.exit-guard__head h2 {
- margin: 0;
- color: var(--text-primary);
- font-size: var(--text-lg);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-.exit-guard__body {
- display: grid;
- gap: var(--space-3);
-}
-
-.exit-guard__body p {
- margin: 0;
- color: var(--text-secondary);
- font-size: var(--text-base);
- line-height: var(--leading-normal);
-}
-
-.exit-guard__body p:first-child {
- color: var(--text-primary);
- font-weight: var(--weight-semibold);
-}
-
-.cuda-setup-download {
- color: var(--accent-bright);
- text-underline-offset: 3px;
-}
-
-.exit-guard__jobs {
- max-height: 40vh;
- overflow-y: auto;
- margin: 0;
- padding: 0;
- list-style: none;
- display: grid;
- gap: var(--space-1);
-}
-
-.exit-guard__jobs li {
- min-height: var(--control-sm);
- display: flex;
- align-items: center;
- gap: var(--space-2);
- padding: var(--space-2) var(--space-3);
- border: 1px solid var(--line);
- border-radius: var(--radius-md);
- background: var(--panel-3);
- color: var(--text-muted);
-}
-
-.exit-guard__jobs b {
- min-width: 0;
- flex: 1;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: var(--text-secondary);
- font-size: var(--text-sm);
- font-weight: var(--weight-medium);
-}
-
-.exit-guard__jobs em {
- flex: none;
- color: var(--text-faint);
- font-size: var(--text-2xs);
- font-style: normal;
- font-family: var(--font-mono);
-}
-
-.exit-guard__jobs .exit-guard__more {
- border: 0;
- background: none;
- color: var(--text-faint);
- font-size: var(--text-xs);
-}
-
-.exit-guard__actions {
- display: flex;
- justify-content: flex-end;
- gap: var(--space-3);
-}
-
-/* The destructive answer. .danger-button is a full-width block used inside the
- Generator's inspector column, so it cannot sit in a row of two; this is the
- same colour contract at button-row proportions. */
-.exit-guard__confirm {
- min-height: var(--control-md);
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: var(--space-2);
- padding: 0 var(--space-3);
- border: 1px solid var(--danger);
- border-radius: var(--radius-md);
- color: var(--danger);
- background: var(--panel-3);
- font-size: var(--text-base);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- transition: var(--transition-control);
-}
-
-.exit-guard__confirm:hover {
- color: var(--text-primary);
- background: var(--panel);
-}
-
-@media (max-width: 560px) {
- .exit-guard__actions {
- flex-direction: column-reverse;
- }
-
- .exit-guard__actions > * {
- width: 100%;
- }
-}
diff --git a/src/styles/library.css b/src/styles/library.css
index 95428cd..b25ab84 100644
--- a/src/styles/library.css
+++ b/src/styles/library.css
@@ -1,529 +1,161 @@
/* ============================================================================
- library.css — project library: topbar, hero, prompt composer, project grid.
-
- Rhythm notes for this surface:
- - Card body height is deterministic: 16 (pad) + 40 (title row) + 4 + 16
- (path) + 12 + 12 + 18 (meta) + 16 (pad) ≈ 134px. `.project-skeleton`
- reproduces the same art ratio and the same body height so the grid does
- not jump when loading finishes.
+ library.css — the project library (App.tsx, ProjectCard.tsx) and the New
+ 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
+ text height so the grid does not jump when loading finishes.
========================================================================== */
.library {
- min-width: 0;
-}
-
-/* The brand sits at the left of this row now that there is no rail to hold it.
- The gap between it and the controls is where the row's spare width goes. */
-.library__topbar {
- height: var(--topbar-height);
display: flex;
- align-items: center;
- gap: var(--space-3);
- padding: 0 var(--space-6);
- border-bottom: 1px solid var(--line);
- background: var(--topbar-glass);
-}
-
-.library__topbar .search-field {
- margin-left: auto;
-}
-
-/* With the rail gone this is the app's only identity mark, so it is sized to
- read as one rather than as a leftover sidebar badge. */
-.library__topbar .brand {
- height: auto;
-}
-
-.library__content {
- width: min(var(--content-max), calc(100% - var(--space-9)));
- margin: 0 auto;
- /* Bottom padding clears the fixed settings launcher. */
- padding: var(--space-5) 0 var(--space-9);
-}
-
-/* --- Prompt composer ------------------------------------------------------- */
-
-.composer-overlay {
- position: fixed;
- z-index: 60;
- inset: 0;
- overflow-y: auto;
- display: grid;
- align-content: center;
- padding: var(--space-7) var(--space-5);
- background: var(--scrim);
-}
-
-.composer-shell {
- width: min(880px, 100%);
- max-height: calc(100dvh - var(--space-7) * 2);
- margin: 0 auto;
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
- border: 1px solid var(--stroke-surface);
- border-radius: var(--radius-xl);
- padding: var(--space-6);
- background: var(--composer-bg);
- box-shadow: var(--shadow);
-}
-
-.composer-heading {
- position: relative;
- z-index: 1;
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- align-items: center;
- gap: var(--space-3);
- cursor: default;
-}
-
-.composer-heading > div {
+ flex-direction: column;
+ 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);
}
-.composer-heading h2 {
- margin: var(--space-3) 0 var(--space-5);
- font-size: var(--text-xl);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-tight);
-}
-
-.composer {
- position: relative;
- border: 1px solid var(--stroke-control);
- border-bottom-color: var(--stroke-strong);
- border-radius: var(--radius-lg);
- background: var(--field-bg);
-}
-
-/* A composite text field: the TextBox underline, not a halo (tokens rule 12). */
-.composer:focus-within {
- border-bottom-color: var(--field-focus-line);
- box-shadow: inset 0 -1px 0 var(--field-focus-line);
-}
-
-/* Creation only names the project; creative direction starts on the Agent
- page. Keep this field visually equal to the settings beneath it. */
-.composer__folder-row { display: flex; align-items: end; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }
-.composer__folder-row label { display: grid; flex: 1; min-width: 0; gap: var(--space-2); }
-.composer__folder-row label > span { color: var(--text-muted); font-size: var(--text-xs); }
-.composer__folder-row button { flex-shrink: 0; }
-.composer__error { flex: 1; min-width: 180px; margin: 0; color: var(--danger); font-size: var(--text-sm); }
-.composer__name-row {
- display: grid;
- gap: var(--space-2);
- padding: var(--space-5);
-}
-
-.composer__name-row > span {
- color: var(--text-muted);
- font-size: var(--text-xs);
-}
-
-.composer__name-row input, .composer__folder-row input {
- width: 100%;
- height: var(--field-height);
- padding: 0 var(--space-3);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-sm);
+/* Fluent Title: 28/36 semibold in the Display cut. */
+.library__title {
+ margin: 0 0 var(--space-4);
color: var(--text-primary);
- background: var(--panel-2);
- font-size: var(--text-sm);
- font-weight: var(--weight-medium);
-}
-
-.composer__project-type {
- min-width: 0;
- margin: var(--space-5) var(--space-5) 0;
- padding: 0;
- border: 0;
-}
-
-.composer__project-type legend {
- padding: 0;
- margin-bottom: var(--space-2);
- color: var(--text-muted);
- font-size: var(--text-xs);
-}
-
-.composer__type-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
-.composer__type-option { position: relative; min-width: 0; }
-.composer__type-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; clip-path: inset(50%); overflow: hidden; }
-
-.composer__type-card {
- display: flex;
- align-items: center;
- gap: var(--space-3);
- height: 100%;
- padding: var(--space-4);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-md);
- background: var(--panel-2);
- transition: var(--transition-control);
-}
-
-.composer__type-icon { display: grid; place-items: center; flex-shrink: 0; width: var(--control-lg); height: var(--control-lg); border-radius: var(--radius-md); background: var(--wash-2); color: var(--text-secondary); }
-.composer__type-copy { display: grid; gap: var(--space-1); min-width: 0; }
-.composer__type-copy strong { color: var(--text-primary); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
-.composer__type-copy > span { color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-normal); }
-.composer__type-indicator { display: grid; place-items: center; flex-shrink: 0; width: var(--space-4); height: var(--space-4); margin-left: auto; border: 1px solid var(--line-strong); border-radius: 50%; }
-.composer__type-indicator::after { content: ""; width: var(--space-2); height: var(--space-2); border-radius: 50%; background: var(--accent); opacity: 0; }
-.composer__type-input:checked + .composer__type-card { border-color: var(--accent); background: var(--accent-soft); }
-.composer__type-input:checked + .composer__type-card .composer__type-icon { color: var(--accent-on-soft); background: var(--accent-soft-strong); }
-.composer__type-input:checked + .composer__type-card .composer__type-indicator { border-color: var(--accent); }
-.composer__type-input:checked + .composer__type-card .composer__type-indicator::after { opacity: 1; }
-.composer__type-input:not(:disabled) + .composer__type-card:hover { border-color: var(--accent-line-strong); }
-.composer__type-input:focus-visible + .composer__type-card { outline: var(--focus-ring-width) solid var(--focus-outer); outline-offset: 1px; box-shadow: 0 0 0 1px var(--focus-inner); }
-.composer__type-input:disabled + .composer__type-card { opacity: 0.5; }
-
-@media (max-width: 600px) {
- .composer__project-type { margin-inline: var(--space-4); }
- .composer__type-options { grid-template-columns: 1fr; }
-}
-
-.composer__references {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: var(--space-2);
- padding: 0 var(--space-5) var(--space-4);
-}
-
-.composer__references > small {
- color: var(--danger);
- font-size: var(--text-xs);
- line-height: var(--leading-normal);
-}
-
-.composer__reference {
- max-width: 280px;
- min-height: var(--control-md);
- display: inline-flex;
- align-items: center;
- gap: var(--space-2);
- padding: 0 var(--space-1) 0 var(--space-3);
- border: 1px solid var(--accent-line);
- border-radius: var(--radius-sm);
- color: var(--accent-bright);
- background: var(--accent-soft);
-}
-
-.composer__reference b {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: var(--text-secondary);
- font-size: var(--text-xs);
+ font-family: var(--font-display);
+ font-size: var(--text-2xl);
font-weight: var(--weight-semibold);
+ line-height: 36px;
}
-.composer__reference button {
- width: var(--control-sm);
- height: var(--control-sm);
- flex: 0 0 auto;
+.library__infobars {
display: grid;
- place-items: center;
- padding: 0;
- border: 0;
- border-radius: var(--radius-xs);
- color: var(--text-muted);
- background: transparent;
-}
-
-.composer__reference button:hover {
- color: var(--text-primary);
- background: var(--wash-3);
-}
-
-/* --- Optional settings (collapsed by default — the defaults are good) ------- */
-
-.composer__options {
- border-top: 1px solid var(--line);
-}
-
-.composer__options-head {
- min-height: var(--control-md);
- display: flex;
- align-items: center;
- gap: var(--space-3);
- padding: var(--space-2) var(--space-5);
- color: var(--text-muted);
- font-size: var(--text-xs);
-}
-
-.composer__options-title {
- font-weight: var(--weight-semibold);
- color: var(--text-secondary);
-}
-
-.composer__options-body {
- padding: var(--space-2) var(--space-5) var(--space-5);
+ gap: var(--space-1);
+ margin-bottom: var(--space-3);
}
-.composer__options-grid {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: var(--space-4);
+.library__commands {
+ margin: 0 calc(-1 * var(--space-1)) var(--space-4);
}
-.composer__options-grid label {
- display: grid;
- gap: var(--space-2);
- min-width: 0;
+.library__commands .ui-command-bar__primary {
+ gap: var(--space-1);
}
-.composer__options-grid label > span {
- display: flex;
- align-items: center;
- gap: var(--space-2);
- color: var(--text-muted);
- font-size: var(--text-xs);
- line-height: var(--leading-snug);
+.library__commands .ui-command-bar__end {
+ flex: 0 1 280px;
+ margin-left: auto;
}
-.composer__options-grid select,
-.composer__options-grid input {
+.library__search {
width: 100%;
- height: var(--field-height);
- padding: 0 var(--space-3);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-sm);
- color: var(--text-primary);
- background: var(--panel-2);
- font-size: var(--text-sm);
- font-weight: var(--weight-medium);
-}
-
-.composer__options-grid select:hover,
-.composer__options-grid input:hover {
- border-color: var(--accent-line-strong);
}
-.composer__options-grid small {
- color: var(--text-faint);
- font-size: var(--text-2xs);
+.library__section {
+ min-width: 0;
}
-/* --- Composer action bar --------------------------------------------------- */
-
-.composer__actions {
- border-top: 1px solid var(--line);
+/* "All projects" with its count in secondary text. */
+.library__subtitle {
display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: var(--space-3);
- padding: var(--space-3) var(--space-4) var(--space-3) var(--space-5);
-}
-
-.composer__attach {
- min-height: var(--control-md);
- display: inline-flex;
- align-items: center;
+ align-items: baseline;
gap: var(--space-2);
- padding: 0 var(--space-3);
- border: 1px solid var(--line);
- border-radius: var(--radius-sm);
- color: var(--text-secondary);
- background: transparent;
- font-size: var(--text-sm);
-}
-
-.composer__attach:hover:not(:disabled) {
+ margin: 0 0 var(--space-3);
color: var(--text-primary);
- border-color: var(--accent-line-strong);
- background: var(--accent-soft);
-}
-
-.composer__attach:disabled {
- color: var(--text-faint);
- border-color: var(--line);
-}
-
-.composer__attach b {
- min-width: var(--space-5);
- padding: var(--space-1) var(--space-2);
- border-radius: var(--radius-pill);
- color: var(--on-accent);
- background: var(--accent-dark);
- font: var(--weight-medium) var(--text-2xs) / 1 var(--font-mono);
- text-align: center;
-}
-
-/* Inherits the accent button from controls.css; only the fit is local. The
- auto margin was the hint's job before the hint moved onto this button. */
-.composer__submit {
- flex: 0 0 auto;
- margin-left: auto;
font-size: var(--text-base);
-}
-
-/* --- Idea chips ------------------------------------------------------------ */
-
-.idea-row {
- position: relative;
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: var(--space-2);
- margin-top: var(--space-5);
-}
-
-.idea-row__label {
- margin-right: var(--space-1);
- color: var(--text-muted);
- font-size: var(--text-sm);
-}
-
-/* Offered only after a chip overwrote words the user typed. It is the recovery
- path a controlled textarea takes away from Ctrl+Z, so it reads as an action
- rather than another example. */
-.idea-row__undo {
- display: inline-flex;
- gap: var(--space-2);
- align-items: center;
- margin-left: auto;
- border-color: var(--accent) !important;
- color: var(--text-primary) !important;
-}
-
-.idea-row button {
- min-height: var(--control-sm);
- padding: 0 var(--space-4);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-pill);
- color: var(--text-secondary);
- background: var(--wash-1);
- font-size: var(--text-sm);
- transition: var(--transition-control);
-}
-
-.idea-row button:hover {
- color: var(--text-primary);
- border-color: var(--accent-line-strong);
- background: var(--accent-soft);
-}
-
-/* --- Section heading + view controls --------------------------------------- */
-
-.recent-projects {
- margin-top: 0;
-}
-
-.section-heading {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: var(--space-4);
- margin-bottom: var(--space-4);
-}
-
-.section-heading > div:first-child {
- display: flex;
- align-items: baseline;
- gap: var(--space-3);
-}
-
-.section-heading h2 {
- margin: 0;
- font-size: var(--text-lg);
font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
-}
-
-.section-heading span {
- color: var(--text-muted);
- font-size: var(--text-sm);
+ line-height: var(--leading-normal);
}
-.view-controls {
- display: flex;
- gap: var(--space-2);
+.library__count {
+ color: var(--text-secondary);
+ font-size: var(--text-xs);
+ font-weight: var(--weight-regular);
}
-/* --- Project grid ---------------------------------------------------------- */
+/* --- Grid ------------------------------------------------------------------ */
.project-grid {
display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: var(--space-5);
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
+ gap: var(--space-3);
+ outline: none;
}
.project-grid--list {
- grid-template-columns: 1fr;
-}
-
-.project-grid--list .project-card {
- display: grid;
- grid-template-columns: minmax(240px, 26%) 1fr;
-}
-
-.project-grid--list .project-card__art,
-.project-grid--list .project-card__art-button {
- height: 100%;
-}
-
-.project-grid--list .project-card__art {
- aspect-ratio: auto;
- min-height: 160px;
+ grid-template-columns: minmax(0, 1fr);
+ gap: var(--space-1);
}
-.project-grid--list .project-card__body {
- align-self: center;
- padding: var(--space-5);
-}
+/* --- 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. */
.project-card {
+ position: relative;
+ display: grid;
+ grid-template-rows: auto auto;
+ gap: var(--space-2);
min-width: 0;
- border: 1px solid var(--line);
+ padding: var(--space-2);
+ border: 1px solid var(--stroke-card);
border-radius: var(--radius-lg);
- background: var(--panel);
- overflow: hidden;
+ background: var(--card);
+ color: var(--text-primary);
+ outline: none;
transition: var(--transition-control);
+ -webkit-user-select: none;
+ user-select: none;
}
-/* A Fluent card has a stroke and no shadow; under the mouse only its fill
- changes (tokens.css rule 8). */
.project-card:hover {
- background: var(--panel-2);
+ background: var(--card-hover);
}
-.project-card:focus-within {
- border-color: var(--accent-line);
+.project-card:active {
+ background: var(--card-pressed);
}
-.project-card__art-button {
- display: block;
- width: 100%;
- padding: 0;
- border: 0;
- border-radius: var(--radius-lg);
- background: none;
+.project-card--selected {
+ box-shadow: inset 0 0 0 2px var(--accent);
}
-/* The card clips its children, so the default outset ring on this button would
- be cut off on three sides. Draw the same ring just inside the artwork. */
-.project-card__art-button:focus-visible {
+.project-card:focus-visible {
outline: var(--focus-ring-width) solid var(--focus-outer);
- outline-offset: -2px;
- box-shadow: inset 0 0 0 3px var(--focus-inner);
+ outline-offset: 1px;
}
-.project-card__art {
+.project-card__thumb {
position: relative;
+ display: grid;
+ place-items: center;
+ aspect-ratio: 16 / 9;
overflow: hidden;
- aspect-ratio: 16 / 8.8;
+ border-radius: var(--radius-sm);
+ background-color: var(--panel-3);
background-size: cover;
background-position: center;
+ color: var(--text-secondary);
}
-/* The first visual clip supplies the cover. Placeholders stay transparent so
- the built-in artwork remains a useful fallback in browser preview or when a
- source file cannot be read. */
-.project-card__art > .media-thumb {
+.project-card__glyph {
+ opacity: 0.8;
+}
+
+/* The first visual clip supplies the picture. A file that cannot be read
+ leaves MediaThumbnail's placeholder, which stays hidden so the glyph under
+ it shows instead. */
+.project-card__thumb > .media-thumb {
position: absolute;
- z-index: 1;
inset: 0;
width: 100%;
height: 100%;
@@ -531,561 +163,225 @@
border-radius: 0;
}
-.project-card__art > .media-thumb:not(.media-thumb--poster) {
+.project-card__thumb > .media-thumb:not(.media-thumb--poster) {
display: none;
}
-.project-card__art > .media-thumb img {
+.project-card__thumb > .media-thumb img {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
-.project-card__art::before,
-.project-card__art::after {
- content: "";
- position: absolute;
-}
-
-/* Generated cover artwork — decorative, sizes intentionally unchanged.
-
- THEME-INDEPENDENT ON PURPOSE. Everything from here to .project-card__body is
- a picture, not a surface: four generated cover illustrations and the badges
- and caption that sit ON TOP of one. A cover does not become a
- light-theme cover any more than a photograph does, and running these through
- --text-* would put one theme's ink on a picture that is the same in both.
-
- The chrome over the picture is white, but NOT because the picture is dark.
- TWO OF THE FOUR ARE PALE — --paper is #cabca3 flat, and --chrome runs up to
- #dce7e7 in its highlight — so "white on a dark cover" was never true, and the
- caption measured 1.64:1 at its worst pixel over --paper (1.75:1 median,
- Chrome, identical in both themes) with a text-shadow as its only defence.
-
- What is true, and what every rule below relies on instead: each piece of
- chrome carries its OWN dark plate and is legible against that plate alone,
- whatever the picture under it turns out to be. The bound that means anything
- is the one taken over PURE WHITE, because that is the only backdrop no cover
- can be paler than — the four that exist today, one added later, or a real
- thumbnail set through ProjectCard's inline background-image, which this file
- cannot see. theme.test.ts recomputes all three from the literals below.
-
- The badges did NOT always carry that. The sentence here used to say they did,
- and the numbers say otherwise: over a white thumbnail the badges measured
- 3.78:1 because a plate at 0.55 composites to mid-grey over white and
- `backdrop-filter` blurs without darkening. Its alpha was raised to 0.70,
- which makes the paragraph above true rather than aspirational. */
-.project-card__art--aurora {
- background: linear-gradient(155deg, #101c38, #172d55 45%, #6e6d4d);
-}
-
-.project-card__art--aurora::before {
- width: 120%;
- height: 55%;
- left: -10%;
- bottom: -20%;
- background: linear-gradient(160deg, transparent 15%, #8bb3d5 16%, #283a58 32%, #090e17 33%);
- transform: skewY(-7deg);
-}
-
-.project-card__art--aurora::after {
- width: 48%;
- height: 140%;
- left: 27%;
- top: -25%;
- background: radial-gradient(ellipse, rgba(112, 183, 230, 0.55), transparent 58%);
- filter: blur(13px);
-}
-
-.project-card__art--paper {
- background: #cabca3;
-}
-
-.project-card__art--paper::before {
- width: 110px;
- height: 150px;
- left: 45%;
- top: -25px;
- border-radius: 50%;
- transform: rotate(35deg);
- background: linear-gradient(90deg, #613a26, #e6bd83 42%, #2b4d46 44%, #142724 70%);
- box-shadow: -45px 60px 0 rgba(48, 29, 22, 0.62);
-}
-
-.project-card__art--paper::after {
- inset: 0;
- background:
- linear-gradient(110deg, rgba(255, 255, 255, 0.2), transparent 45%),
- repeating-linear-gradient(0deg, rgba(62, 47, 29, 0.05) 0 1px, transparent 1px 5px);
-}
-
-.project-card__art--chrome {
- background:
- radial-gradient(
- circle at 58% 52%,
- #cfe5f4 0 4%, #385370 5% 10%, #dce7e7 11% 18%, #273d5d 20% 28%, transparent 29%
- ),
- linear-gradient(135deg, #10131a, #29405f 52%, #846a51);
-}
-
-.project-card__art--chrome::before {
- width: 100px;
- height: 100px;
- left: 18%;
- top: 18%;
- border: 12px solid rgba(205, 225, 237, 0.66);
- border-radius: 50%;
- filter: blur(1px);
- transform: rotateX(60deg);
-}
-
-.project-card__art--chrome::after {
- width: 140%;
- height: 1px;
- left: -20%;
- bottom: 25%;
- background: rgba(255, 255, 255, 0.3);
- box-shadow: 0 8px rgba(255, 255, 255, 0.1);
-}
-
-.project-card__art--ember {
- background:
- radial-gradient(circle at 65% 38%, #ef9f67 0 2%, transparent 3%),
- linear-gradient(140deg, #101218, #4b1b2d 60%, #d36b42);
-}
-
-.project-card__format,
-.project-card__quality {
+/* The frame shape, as a small solid chip in the corner: a palette plate, not
+ ink laid over the picture. */
+.project-card__chip {
position: absolute;
- z-index: 2;
- top: var(--space-3);
- border: 1px solid rgba(255, 255, 255, 0.16);
- color: rgba(255, 255, 255, 0.85);
- background: rgba(4, 6, 10, 0.7);
+ z-index: 1;
+ left: var(--space-1);
+ bottom: var(--space-1);
+ padding: 0 var(--space-1);
border-radius: var(--radius-xs);
- padding: var(--space-1) var(--space-2);
- font: var(--weight-medium) var(--text-2xs) / 1 var(--font-mono);
-}
-
-.project-card__format {
- left: var(--space-3);
- display: flex;
- gap: var(--space-1);
- align-items: center;
-}
-
-.project-card__quality {
- right: var(--space-3);
-}
-
-/* The user's own project brief, over artwork this file cannot predict. A strip
- rather than a fade, because a fade's alpha under the glyphs depends on where
- the line happens to land and no test could bound it: here every pixel behind
- the text is the same colour, so "white ink at 14.59:1 over the worst possible
- backdrop" is a fact about two numbers, not about the four covers that exist
- today. */
-.project-card__art-copy {
- position: absolute;
- z-index: 2;
- inset: auto 0 0;
- display: flex;
- gap: var(--space-2);
- align-items: center;
- padding: var(--space-2) var(--space-3);
- color: #fff;
- background: rgba(4, 6, 10, 0.86);
+ background: var(--layer);
+ color: var(--text-secondary);
font-size: var(--text-xs);
- line-height: var(--leading-snug);
- text-align: left;
-}
-
-/* Feathers the top edge of that strip into the picture instead of cutting it
- with a hard line. Decoration only: no glyph sits on it, so nothing here has
- to hold a contrast ratio. */
-.project-card__art-copy::before {
- content: "";
- position: absolute;
- left: 0;
- right: 0;
- bottom: 100%;
- height: var(--space-5);
- background: linear-gradient(to top, rgba(4, 6, 10, 0.86), rgba(4, 6, 10, 0));
- pointer-events: none;
+ line-height: 16px;
+ font-variant-numeric: tabular-nums;
}
-.project-card__art-copy svg {
- flex: 0 0 auto;
+.project-card__text {
+ display: grid;
+ gap: 0;
+ min-width: 0;
+ padding: 0 var(--space-6) 0 var(--space-1);
}
-.project-card__art-copy span {
- white-space: nowrap;
+.project-card__name,
+.project-card__path,
+.project-card__meta {
overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.project-card__body {
- min-width: 0; /* lets the title/path ellipsize in list layout */
- padding: var(--space-4);
-}
-
-.project-card__title-row {
- position: relative;
- min-height: var(--icon-button);
- display: flex;
- align-items: center;
- gap: var(--space-2);
-}
-
-/* The name leads; the folder path underneath is deliberately quieter. */
-.project-card__title-row h3 {
- min-width: 0;
- flex: 1;
- margin: 0;
white-space: nowrap;
- overflow: hidden;
text-overflow: ellipsis;
- color: var(--text-primary);
- font-size: var(--text-base);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
}
-.project-card__menu {
- position: absolute;
- z-index: 5;
- top: var(--icon-button);
- right: 0;
- min-width: 200px;
- padding: var(--space-1);
- border: 1px solid var(--stroke-surface);
- border-radius: var(--radius-lg);
- background: var(--acrylic);
- backdrop-filter: var(--acrylic-filter);
- box-shadow: var(--shadow-sm);
+.project-card__name {
+ font-size: var(--text-base);
+ line-height: var(--leading-normal);
}
-.project-card__menu button {
- width: 100%;
- min-height: var(--control-sm);
- padding: 0 var(--space-3);
- display: flex;
- align-items: center;
- gap: var(--space-2);
- border: 0;
- border-radius: var(--radius-sm);
+.project-card__path,
+.project-card__meta {
color: var(--text-secondary);
- background: transparent;
- font-size: var(--text-sm);
- text-align: left;
-}
-
-.project-card__menu button:hover {
- color: var(--text-primary);
- background: var(--wash-3);
-}
-
-.project-card__menu .project-card__menu-delete {
- color: var(--danger);
-}
-
-.project-card__menu .project-card__menu-delete:hover {
- color: var(--danger);
- background: var(--danger-soft);
-}
-
-/* --- Permanent project deletion ------------------------------------------ */
-
-.delete-project-backdrop {
- position: fixed;
- z-index: 200;
- inset: 0;
- display: grid;
- place-items: center;
- padding: var(--space-5);
+ font-size: var(--text-xs);
+ line-height: 16px;
}
-.delete-project-backdrop::before {
- content: "";
+/* ⋯ sits over the text row's trailing end; it is not a tab stop (Shift+F10
+ or the Menu key opens the same menu from the keyboard). */
+.project-card__more {
position: absolute;
- inset: 0;
- background: var(--scrim);
+ right: var(--space-1);
+ bottom: var(--space-2);
+ opacity: 0;
+ transition: opacity var(--motion-fast) linear, background-color var(--motion-fast) linear;
}
-.delete-project-dialog {
- position: relative;
- width: min(520px, 100%);
- display: grid;
- gap: var(--space-4);
- padding: var(--space-6);
- border: 1px solid var(--stroke-surface);
- border-radius: var(--radius-xl);
- background: var(--dialog-bg);
- box-shadow: var(--shadow);
+.project-card:hover .project-card__more,
+.project-card--selected .project-card__more,
+.project-card:focus-within .project-card__more {
+ opacity: 1;
}
-.delete-project-dialog__head {
- display: flex;
+/* List layout: a row — small thumbnail, name over path over caption. */
+.project-card--list {
+ grid-template-columns: 96px minmax(0, 1fr);
+ grid-template-rows: auto;
align-items: center;
gap: var(--space-3);
+ padding: var(--space-1) var(--space-2);
}
-.delete-project-dialog__head > span {
- width: var(--control-sm);
- height: var(--control-sm);
- flex: none;
- display: grid;
- place-items: center;
- border: 1px solid var(--danger);
- border-radius: var(--radius-md);
- color: var(--danger);
- background: var(--panel-3);
-}
-
-.delete-project-dialog h2 {
- margin: 0;
- color: var(--text-primary);
- font-size: var(--text-lg);
- line-height: var(--leading-snug);
-}
-
-.delete-project-dialog__body {
- min-width: 0;
- display: grid;
- gap: var(--space-3);
-}
-
-.delete-project-dialog__body p {
- margin: 0;
- color: var(--text-secondary);
- line-height: var(--leading-normal);
-}
-
-.delete-project-dialog__body code {
- overflow: hidden;
- padding: var(--space-3);
- border: 1px solid var(--line);
- border-radius: var(--radius-md);
- color: var(--text-muted);
- background: var(--panel-3);
- font-size: var(--text-xs);
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.delete-project-dialog__actions {
- display: flex;
- justify-content: flex-end;
- gap: var(--space-3);
-}
-
-.delete-project-dialog__confirm {
- min-height: var(--control-md);
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: var(--space-2);
- padding: 0 var(--space-3);
- border: 1px solid var(--danger-line-strong);
- border-radius: var(--radius-md);
- color: var(--danger);
- background: var(--danger-soft);
- font-size: var(--text-base);
- font-weight: var(--weight-semibold);
-}
-
-.delete-project-dialog__confirm:hover:not(:disabled) {
- background: var(--danger-soft-strong);
-}
-
-.delete-project-dialog__confirm:disabled {
- opacity: 0.6;
-}
-
-.delete-project-dialog .spin {
- animation: spin 1.4s linear infinite;
-}
-
-@media (max-width: 560px) {
- .delete-project-dialog__actions {
- flex-direction: column-reverse;
- }
-
- .delete-project-dialog__actions > * {
- width: 100%;
- }
-}
-
-.project-card__path {
- min-width: 0;
- margin: var(--space-1) 0 var(--space-3);
- display: flex;
- align-items: center;
- gap: var(--space-1);
- color: var(--text-faint);
- font: var(--weight-regular) var(--text-2xs) / var(--leading-snug) var(--font-mono);
-}
-
-.project-card__path svg {
- flex: 0 0 auto;
-}
-
-/* text-overflow does nothing on the flex container itself, so the path has to
- truncate on its own flex item — same pattern as the card title above. */
-.project-card__path span {
- min-width: 0;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
+.project-card--list .project-card__glyph {
+ width: 20px;
+ height: 20px;
}
-.project-card__meta {
- border-top: 1px solid var(--line);
- padding-top: var(--space-3);
- display: flex;
- justify-content: space-between;
- gap: var(--space-3);
- color: var(--text-muted);
- font-size: var(--text-xs);
- line-height: var(--leading-snug);
+.project-card--list .project-card__chip {
+ display: none;
}
-.project-card__meta span {
- display: flex;
- align-items: center;
- gap: var(--space-2);
+.project-card--list .project-card__more {
+ top: 50%;
+ bottom: auto;
+ margin-top: calc(-1 * var(--icon-button) / 2);
}
-/* --- Skeleton + empty state ------------------------------------------------ */
+/* --- Loading ------------------------------------------------------------------ */
-/* Mirrors the real card: 16:8.8 art + a ~134px body. */
.project-skeleton {
- overflow: hidden;
- border: 1px solid var(--line);
+ display: grid;
+ gap: var(--space-2);
+ padding: var(--space-2);
+ border: 1px solid var(--stroke-card);
border-radius: var(--radius-lg);
- background: var(--panel);
+ background: var(--card);
}
.project-skeleton i {
display: block;
- aspect-ratio: 16 / 8.8;
+ aspect-ratio: 16 / 9;
+ border-radius: var(--radius-sm);
background: var(--panel-3);
}
.project-skeleton span,
.project-skeleton small {
display: block;
- margin: var(--space-4) var(--space-4) 0;
+ height: 12px;
+ margin-left: var(--space-1);
border-radius: var(--radius-xs);
background: var(--panel-3);
}
.project-skeleton span {
- height: var(--space-5);
+ width: 60%;
+ margin-top: 4px;
}
.project-skeleton small {
- width: 55%;
- height: var(--space-4);
- margin-top: var(--space-3);
- margin-bottom: var(--space-9);
+ width: 40%;
+ margin-bottom: 2px;
+}
+
+.project-grid--list .project-skeleton {
+ grid-template-columns: 96px minmax(0, 1fr);
}
+/* --- 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. */
+
.library-empty {
- border: 1px dashed var(--line-strong);
- border-radius: var(--radius-lg);
+ display: grid;
+ justify-items: center;
+ gap: 0;
padding: var(--space-8) var(--space-5);
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
+ color: var(--text-secondary);
text-align: center;
- color: var(--text-muted);
-}
-
-.library-empty > svg {
- color: var(--text-faint);
}
.library-empty h3 {
+ margin: var(--space-4) 0 var(--space-1);
color: var(--text-primary);
font-size: var(--text-lg);
font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- margin: var(--space-4) 0 var(--space-2);
+ line-height: 28px;
}
.library-empty p {
- max-width: 52ch;
+ margin: 0;
+ max-width: 48ch;
font-size: var(--text-base);
line-height: var(--leading-normal);
- margin: 0 0 var(--space-5);
-}
-
-.library-empty p strong {
- color: var(--text-secondary);
- font-weight: var(--weight-semibold);
}
-.library-empty__aside {
- color: var(--text-faint);
- font-size: var(--text-sm);
- margin-bottom: var(--space-3);
+.library-empty__actions {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: var(--space-2);
+ margin-top: var(--space-5);
}
-/* --- Responsive ------------------------------------------------------------ */
+/* --- New project / Project settings (a ContentDialog) --------------------------- */
-@media (max-width: 900px) {
- .library__content {
- width: calc(100% - var(--space-6));
- }
-
- .project-grid {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
-
- .composer__options-grid {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
+.composer__form {
+ display: grid;
+ gap: var(--space-4);
}
-@media (max-width: 650px) {
- .library__topbar {
- padding: 0 var(--space-4);
- }
-
- .library__content {
- padding-top: var(--space-6);
- }
+.composer__field {
+ display: grid;
+ gap: var(--space-2);
+ min-width: 0;
+}
- .project-grid {
- grid-template-columns: 1fr;
- }
+.composer__field > label {
+ color: var(--text-primary);
+ font-size: var(--text-base);
+ line-height: var(--leading-normal);
+}
- .project-grid--list .project-card {
- grid-template-columns: 1fr;
- }
+.composer__field .text-field,
+.composer__field select {
+ width: 100%;
+ min-width: 0;
+}
- .composer-shell {
- padding: var(--space-5) var(--space-4);
- }
+.composer__folder-row {
+ display: flex;
+ gap: var(--space-2);
+ min-width: 0;
+}
- .composer__name-row,
- .composer__references,
- .composer__options > summary,
- .composer__options-body {
- padding-left: var(--space-4);
- padding-right: var(--space-4);
- }
+.composer__folder-row .text-field {
+ flex: 1 1 auto;
+ color: var(--text-secondary);
+}
- .composer__options-grid {
- grid-template-columns: 1fr;
- }
+.composer__folder-row button {
+ flex: none;
+}
- .composer__actions {
- padding: var(--space-3) var(--space-4);
- }
+.composer__grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
+ gap: var(--space-3);
+}
- .composer__submit {
- flex: 1 1 auto;
- }
+/* A path quoted in a dialog: body text, not a code block, and free to wrap. */
+.dialog-path {
+ color: var(--text-secondary);
+ overflow-wrap: anywhere;
}
diff --git a/src/styles/shell.css b/src/styles/shell.css
index 196d68a..4b01e11 100644
--- a/src/styles/shell.css
+++ b/src/styles/shell.css
@@ -1,91 +1,38 @@
/* ============================================================================
- shell.css — application frame: grid shell, brand mark, settings surface.
+ shell.css — the application frame: one screen at a time, each a column of
+ title bar + content that fills the window.
+
+ There is no floating chrome any more. The settings launcher that sat fixed
+ in the bottom-left corner, the work-queue pill in the bottom-right and the
+ update notice that overlapped it are all title-bar buttons now (App.tsx,
+ titlebar.css), so nothing on any screen has to reserve room to dodge them.
+
+ Under Mica (window.css) --bg is transparent: the frame itself paints
+ nothing, and the surfaces that need a plate — the library page, a
+ project's panes — use --layer / --panel.
========================================================================== */
.app-shell {
- display: grid;
- grid-template-columns: minmax(0, 1fr);
- min-height: 100vh;
+ min-width: 0;
+ height: 100vh;
+ height: 100dvh;
+ overflow: hidden;
background: var(--bg);
}
-/* --- Brand ----------------------------------------------------------------- */
-
-.brand {
- height: var(--control-lg);
+/* A top-level screen: its title bar, then whatever fills the rest. The
+ screen behind Settings keeps its state by being [hidden], not unmounted. */
+.app-screen {
display: flex;
- align-items: center;
- gap: var(--space-2);
- padding: 0 var(--space-2);
-}
-
-/* Icon-only lockup for narrow rails, centred with no edition tag. */
-.brand--compact {
- gap: 0;
- padding: 0;
- justify-content: center;
-}
-
-.brand__edition {
- font: var(--weight-medium) var(--text-2xs) / 1 var(--font-mono);
- color: var(--text-faint);
- border: 1px solid var(--line-strong);
- border-radius: var(--radius-xs);
- padding: var(--space-1) var(--space-2);
-}
-
-.brand__wordmark {
- color: var(--text-primary);
- font-size: var(--text-xl);
- font-weight: var(--weight-bold);
- line-height: 1;
+ flex-direction: column;
+ min-width: 0;
+ height: 100%;
+ overflow: hidden;
}
-/* --- Application icon ----------------------------------------------------- */
-
-.slopus-logo {
- width: 36px;
- height: 36px;
- flex: 0 0 auto;
- display: block;
- object-fit: contain;
-}
-
-.slopus-logo--compact {
- width: 30px;
- height: 30px;
+.app-screen__content {
+ flex: 1 1 auto;
+ min-height: 0;
+ min-width: 0;
+ overflow: auto;
}
-
-/* --- Settings launcher ------------------------------------------------------
- Fixed bottom-left in every view, project editor included: the engine paths
- behind it are what makes generation work at all, and finding out they are
- wrong happens inside a project. It sits above the agent dock, which is why
- the dock reserves room for it (see .agent-dock-wrap in workspace.css). */
-
-/* The gear alone — the word "Settings" told nobody anything the icon did not.
- Round and a step larger than a normal icon button so it reads as its own
- thing floating over the corner rather than as part of the row behind it. */
-.settings-launcher {
- position: fixed;
- z-index: 40;
- left: var(--space-4);
- bottom: var(--space-4);
- width: 44px;
- height: 44px;
- display: grid;
- place-items: center;
- padding: 0;
- border: 1px solid var(--line-strong);
- border-radius: 50%;
- color: var(--text-muted);
- background: var(--glass);
- box-shadow: var(--shadow-sm);
- transition: var(--transition-control);
-}
-
-.settings-launcher:hover {
- color: var(--text-primary);
- border-color: var(--accent-line-strong);
- background: var(--glass-hover);
-}
-
diff --git a/src/styles/titlebar.css b/src/styles/titlebar.css
index 4d0f77a..cf59fb2 100644
--- a/src/styles/titlebar.css
+++ b/src/styles/titlebar.css
@@ -151,3 +151,38 @@
background: #c93f33;
color: #ffffff;
}
+
+/* --- What screens put in the bar -------------------------------------------
+ App-wide commands (Settings, Work queue) and a project's own (Undo, Redo,
+ Save, the agent pane) are 32px subtle buttons in the actions slot. A
+ count rides on the top-right corner of its button as an InfoBadge; an
+ update waiting shows as the badge's dot on the gear. */
+
+.titlebar-command {
+ position: relative;
+}
+
+.titlebar-command__badge {
+ position: absolute;
+ top: 0;
+ right: -2px;
+ pointer-events: none;
+}
+
+.titlebar-command__badge--dot {
+ top: 5px;
+ right: 5px;
+}
+
+/* A toggle button that is on (the agent pane shown). */
+.icon-button--checked {
+ background: var(--fill-subtle-hover);
+}
+
+.titlebar-separator {
+ flex: none;
+ width: 1px;
+ height: 20px;
+ margin: 0 var(--space-1);
+ background: var(--stroke-card);
+}
diff --git a/src/styles/updater.css b/src/styles/updater.css
index 448d55c..7b529f5 100644
--- a/src/styles/updater.css
+++ b/src/styles/updater.css
@@ -1,9 +1,94 @@
-.update-panel { display: grid; gap: var(--space-4); }
-.update-panel h2, .update-panel p { margin: 0; }
-.update-panel p { font-size: var(--text-base); line-height: var(--leading-normal); }
-.update-panel__notes { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-height: 240px; overflow: auto; }
-.update-panel__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
-.update-notice { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 30; }
-.update-progress { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--bg); }
-.update-progress .update-panel { width: min(480px, 90vw); padding: var(--space-6); background: var(--panel); border-radius: var(--radius-lg); }
-.update-progress progress { width: 100%; }
+/* ============================================================================
+ updater.css — Settings > Updates (UpdatePanel.tsx).
+
+ Windows Update's header card: a 48px status glyph, a 20px status line, a
+ caption with the last check, a 3px bar while a download runs, and the one
+ action at the trailing edge. A card is a 1px stroke on --card, no shadow.
+ Nothing here covers the window any more: the download used to take the
+ whole screen over (inset: 0) with an unstyled <progress>; it now runs
+ inside the card and the rest of the app stays usable.
+ ========================================================================== */
+
+.update-panel {
+ display: grid;
+ gap: var(--space-1);
+ min-width: 0;
+}
+
+.update-card {
+ display: flex;
+ align-items: center;
+ gap: var(--space-4);
+ min-width: 0;
+ padding: var(--space-4) var(--space-4) var(--space-4) var(--space-4);
+ border: 1px solid var(--stroke-card);
+ border-radius: var(--radius-lg);
+ background: var(--card);
+}
+
+.update-card__glyph {
+ display: grid;
+ place-items: center;
+ flex: none;
+ width: 48px;
+ height: 48px;
+ color: var(--accent);
+}
+
+.update-card--current .update-card__glyph {
+ color: var(--success);
+}
+
+.update-card--disabled .update-card__glyph {
+ color: var(--text-secondary);
+}
+
+.update-card__text {
+ display: grid;
+ flex: 1 1 auto;
+ gap: 2px;
+ min-width: 0;
+}
+
+/* Fluent Subtitle, 20/28 semibold. */
+.update-card__title {
+ margin: 0;
+ font-family: var(--font-display);
+ font-size: var(--text-lg);
+ font-weight: var(--weight-semibold);
+ line-height: 1.4;
+ color: var(--text-primary);
+}
+
+.update-card__caption {
+ color: var(--text-secondary);
+ font-size: var(--text-xs);
+ line-height: 16px;
+}
+
+.update-card__progress-label {
+ margin-top: var(--space-2);
+}
+
+.update-card__progress {
+ margin-top: var(--space-1);
+ max-width: 360px;
+}
+
+.update-card__action {
+ display: flex;
+ flex: none;
+ gap: var(--space-2);
+}
+
+.update-panel__notes {
+ margin: 0;
+ max-height: 240px;
+ overflow: auto;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+ font: inherit;
+ font-size: var(--text-base);
+ line-height: var(--leading-normal);
+ color: var(--text-secondary);
+}
diff --git a/src/styles/work-queue.css b/src/styles/work-queue.css
index 8494361..6d1c75e 100644
--- a/src/styles/work-queue.css
+++ b/src/styles/work-queue.css
@@ -1,83 +1,170 @@
-.work-queue-launcher {
+/* ============================================================================
+ work-queue.css — the work queue flyout (WorkQueuePanel.tsx).
+
+ It hangs from the queue button in the title bar on the shared .ui-flyout
+ surface (acrylic, 8px corners, flyout shadow; ui.css). No scrim and no
+ window dimming: it is a light-dismiss popup, not a dialog. Inside: a 14px
+ semibold header with a link-style "Clear finished", then one flat list —
+ rows separated by hairlines, a 16px state glyph, a title, a caption and,
+ while the work runs, the 3px ProgressBar. The fixed launcher pill that used
+ to float in the bottom-right corner is gone; the title bar carries the
+ button and its InfoBadge.
+ ========================================================================== */
+
+.work-queue.ui-flyout {
display: flex;
- border-radius: var(--radius-pill);
- left: auto;
- right: var(--space-4);
- width: auto;
- padding: 0 var(--space-3);
+ flex-direction: column;
+ max-height: min(560px, calc(100vh - 64px));
+ padding: 0;
+ overflow: hidden;
+}
+
+.work-queue__header {
+ display: flex;
+ align-items: center;
gap: var(--space-2);
+ flex: none;
+ min-height: 44px;
+ padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
+}
+
+.work-queue__header h2 {
+ margin: 0;
+ margin-right: auto;
+ font-size: var(--text-base);
+ font-weight: var(--weight-semibold);
+ line-height: var(--leading-normal);
+}
+
+/* A hyperlink-looking button: accent text, no fill, no hand cursor (it is a
+ command, not a navigation). */
+.work-queue__link {
+ justify-self: start;
+ min-height: var(--control-sm);
+ padding: 0 var(--space-2);
+ border: 0;
+ border-radius: var(--radius-sm);
+ background: transparent;
+ color: var(--accent-bright);
font-size: var(--text-sm);
+ transition: var(--transition-control);
+}
+
+.work-queue__link:hover {
+ background: var(--fill-subtle-hover);
+}
+
+.work-queue__link:active {
+ background: var(--fill-subtle-pressed);
+}
+
+.work-queue__list {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow-y: auto;
+ overscroll-behavior: contain;
+ padding-bottom: var(--space-2);
}
-.work-queue-launcher b {
+
+.work-queue__list ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.work-queue__group {
+ margin: 0;
+ padding: var(--space-3) var(--space-4) var(--space-1);
+ color: var(--text-secondary);
+ font-size: var(--text-xs);
+ font-weight: var(--weight-regular);
+ line-height: 16px;
+}
+
+.work-queue__row {
+ display: flex;
+ align-items: flex-start;
+ gap: var(--space-3);
+ padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4);
+ border-top: 1px solid var(--stroke-card);
+}
+
+.work-queue__list section:first-child > ul > .work-queue__row:first-child {
+ border-top-color: transparent;
+}
+
+.work-queue__state {
display: grid;
place-items: center;
- min-width: 20px;
+ flex: none;
+ width: 16px;
height: 20px;
- padding: 0 4px;
- border-radius: var(--radius-pill);
- background: var(--accent);
- color: var(--on-accent);
+ color: var(--text-secondary);
+}
+
+.work-queue__state--completed { color: var(--success); }
+.work-queue__state--failed { color: var(--danger); }
+.work-queue__state--generating,
+.work-queue__state--encoding,
+.work-queue__state--preparing { color: var(--accent); }
+
+.work-queue__text {
+ display: grid;
+ flex: 1 1 auto;
+ gap: 2px;
+ min-width: 0;
+}
+
+.work-queue__title,
+.work-queue__caption {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.work-queue__title {
+ color: var(--text-primary);
+ font-size: var(--text-base);
+ line-height: var(--leading-normal);
+}
+
+.work-queue__caption {
+ color: var(--text-secondary);
font-size: var(--text-xs);
+ line-height: 16px;
+ font-variant-numeric: tabular-nums;
}
-.work-queue-backdrop {
- position: fixed;
- inset: 0;
- z-index: 150;
- background: var(--scrim);
+
+.work-queue__progress {
+ margin-top: var(--space-1);
}
-.work-queue-panel {
- position: absolute;
- right: var(--space-4);
- bottom: 76px;
- display: flex;
- flex-direction: column;
- width: min(440px, calc(100vw - 32px));
- max-height: calc(100dvh - 108px);
- border: 1px solid var(--stroke-surface);
- border-radius: var(--radius-lg);
- background: var(--panel);
+
+.work-queue__error {
+ color: var(--danger);
+ font-size: var(--text-xs);
+ line-height: 16px;
+ overflow-wrap: anywhere;
+}
+
+.work-queue__cancel {
+ flex: none;
+}
+
+.work-queue__empty {
+ display: grid;
+ justify-items: center;
+ gap: var(--space-1);
+ padding: var(--space-6) var(--space-4);
+ color: var(--text-secondary);
+ text-align: center;
+}
+
+.work-queue__empty strong {
+ margin-top: var(--space-2);
color: var(--text-primary);
- box-shadow: var(--shadow-sm);
- overflow: hidden;
+ font-weight: var(--weight-semibold);
+}
+
+.work-queue__empty span {
+ font-size: var(--text-xs);
}
-.work-queue__header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: var(--space-3) var(--space-4);
-}
-.work-queue__header > div { display: flex; gap: var(--space-2); align-items: center; }
-.work-queue__header h2 { margin: 0; font-size: var(--text-lg); }
-.work-queue__intro { margin: 0; padding: 0 var(--space-4) var(--space-3); color: var(--text-muted); font-size: var(--text-sm); }
-.work-queue__list { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--space-4) var(--space-4); }
-.work-queue__list h3 { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
-.work-queue__list h3 > button { margin-left: auto; border: 0; background: transparent; color: var(--text-muted); font-size: var(--text-xs); }
-.work-queue__list h3 > button:hover { color: var(--text-primary); }
-.work-queue__list ul { list-style: none; margin: 0; padding: 0; }
-.work-queue__item { margin-bottom: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel-2); }
-.work-queue__item-heading { display: flex; gap: var(--space-2); align-items: center; }
-.work-queue__item-heading > div { display: grid; flex: 1; min-width: 0; gap: 2px; }
-.work-queue__item-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-base); font-weight: var(--weight-medium); }
-.work-queue__item-heading div > span { color: var(--text-muted); font-size: var(--text-xs); }
-.work-queue__state { display: grid; place-items: center; color: var(--text-muted); }
-.work-queue__state--completed { color: var(--success); }
-.work-queue__state--failed { color: var(--danger); }
-.work-queue__state--generating, .work-queue__state--encoding, .work-queue__state--preparing { color: var(--accent-bright); }
-.work-queue__detail { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-3); font-size: var(--text-xs); color: var(--text-secondary); }
-.work-queue__detail b { font-variant-numeric: tabular-nums; }
-.work-queue__item progress { display: block; width: 100%; height: var(--progress-height); margin-top: var(--space-2); border: 0; border-radius: var(--radius-progress); overflow: hidden; accent-color: var(--accent); }
-.work-queue__item progress::-webkit-progress-bar { background: var(--line); }
-.work-queue__item progress::-webkit-progress-value { background: var(--accent); }
-.work-queue__settings { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--text-muted); }
-.work-queue__item--compact { margin-bottom: var(--space-1); padding: var(--space-2); }
-.work-queue__item--compact .work-queue__item-heading > div { display: flex; align-items: baseline; gap: var(--space-2); }
-.work-queue__item--compact .work-queue__item-heading strong { min-width: 0; font-size: var(--text-sm); }
-.work-queue__item--compact .work-queue__item-heading div > span { min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-.work-queue__item--compact .work-queue__metadata { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--space-2); margin-top: var(--space-1); }
-.work-queue__item--compact .work-queue__detail,
-.work-queue__item--compact .work-queue__settings { margin: 0; overflow-wrap: anywhere; }
-.work-queue__error { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--danger); overflow-wrap: anywhere; }
-.work-queue__empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-6) 0; color: var(--text-muted); }
-.work-queue__empty p { margin: 0; font-size: var(--text-sm); }
-.work-queue__spinner { animation: work-queue-spin 1s linear infinite; }
-@keyframes work-queue-spin { to { transform: rotate(360deg); } }
diff --git a/src/styles/workspace.css b/src/styles/workspace.css
index 8fe90d1..8b2e824 100644
--- a/src/styles/workspace.css
+++ b/src/styles/workspace.css
@@ -1,252 +1,163 @@
/* ============================================================================
- workspace.css — the full project editor frame: topbar, view nav, content
- region, and the Slop agent dock that sits along the bottom.
+ workspace.css — the project window (ProjectWorkspace.tsx): the title bar's
+ project half, the InfoBars under it, the active view, and the agent docked
+ on the right behind a Splitter.
+
+ The 56px topbar that sat under the OS caption is gone: the window is
+ frameless and the title bar IS the header (i-frame-1). The segmented pill
+ of view buttons is a SelectorBar of tabs in it (i-frame-6), and the agent
+ is a pane rather than a bottom row that had to leave 256px free for the
+ floating corner buttons.
+
+ --bg is transparent under Mica, so every surface below the title bar that
+ needs a plate paints --layer.
========================================================================== */
-/* --content-max is a MEASURE cap, not a floor. It used to sit here as
- `min-width`, which forced the whole shell to 1180px while the window can be
- as narrow as 900px (tauri.conf.json `minWidth`) — everything between those
- two numbers scrolled sideways. The shell now takes whatever width it is
- given; the single column is minmax(0, 1fr) so no row can widen it, and the
- rows below fold down to 900px on their own. */
.project-shell {
- height: 100vh;
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
min-width: 0;
+ min-height: 0;
+ height: 100%;
overflow: hidden;
- display: grid;
- grid-template-columns: minmax(0, 1fr);
- grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
color: var(--text-secondary);
- background: var(--bg);
}
-/* --- Topbar ---------------------------------------------------------------- */
+/* --- Title bar -------------------------------------------------------------- */
-/* Three columns, not a flex row: the tabs are centred on the WINDOW rather
- than on whatever space the project name and the actions happen to leave, so
- they do not drift sideways as the name gets longer. The outer two columns
- are equal and elastic; the name inside the left one truncates. */
-.project-topbar {
- min-width: 0;
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
- align-items: center;
- gap: var(--space-3);
- padding: 0 var(--space-4);
- border-bottom: 1px solid var(--line-solid);
- background: var(--panel);
-}
-
-.project-topbar__lead {
- min-width: 0;
- display: flex;
- align-items: center;
- gap: var(--space-3);
-}
-
-/* The title gives its width up first so the tabs and the actions never squash. */
+/* The project name is the caption text and a button: it opens Project
+ settings. Caption-sized, like any window title, with a subtle hover. */
.project-title {
- flex: 0 1 320px;
- min-width: 0;
- padding-left: var(--space-1);
-}
-
-.project-title strong {
display: block;
- font-size: var(--text-md);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- color: var(--text-primary);
- white-space: nowrap;
+ max-width: 280px;
+ min-width: 0;
+ height: var(--control-md);
+ padding: 0 var(--space-2);
overflow: hidden;
+ border: 0;
+ border-radius: var(--radius-sm);
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ white-space: nowrap;
text-overflow: ellipsis;
+ transition: var(--transition-control);
}
-.project-title > button {
- display: block;
- width: 100%;
- min-width: 0;
- min-height: var(--control-sm);
- padding: var(--space-1) var(--space-2);
- border: 1px solid transparent;
- border-radius: var(--radius-sm);
- background: transparent;
- text-align: left;
+.project-title:hover {
+ background: var(--fill-subtle-hover);
}
-.project-title > button:hover,
-.project-title > button:focus-visible {
- border-color: var(--line-strong);
- background: var(--panel-2);
+.project-title:active {
+ background: var(--fill-subtle-pressed);
}
-/* Never let the action buttons shrink — a squashed Save is worse than a
- shortened project name. `margin-left: auto` still eats any spare width. */
-.project-topbar__actions {
- flex: 0 0 auto;
- display: flex;
- align-items: center;
+.project-titlebar .titlebar__identity {
gap: var(--space-2);
- margin-left: auto;
}
-.project-topbar__actions > button {
- flex: 0 0 auto;
- white-space: nowrap;
+.project-titlebar .titlebar__middle {
+ justify-content: center;
+ padding: 0 var(--space-3);
}
-.project-topbar__soon {
- padding: var(--space-1) var(--space-2);
- border: 1px solid var(--line);
- border-radius: var(--radius-xs);
- color: var(--text-faint);
- font: var(--weight-medium) var(--text-2xs) / 1 var(--font-mono);
+/* The views. Tabs, not links: arrow keys move between them, Ctrl+1…4 jump.
+ The selected one is marked by the accent pill under it and nothing else —
+ no weight change, so the row never shifts when the selection moves. */
+.project-views {
+ min-width: 0;
+ overflow: hidden;
}
-/* --- View navigation --------------------------------------------------------
- The tabs used to own a 56px band under the topbar, alongside a read-out of
- the project's aspect ratio, resolution and frame rate. Both are gone: the
- tabs are a segmented control in the middle column of the topbar, and the
- format numbers live in the project's settings and on the program monitor. */
-
-.project-nav {
- justify-self: center;
- min-width: 0;
- display: flex;
- gap: var(--space-1);
- padding: var(--space-1);
- border: 1px solid var(--line);
- border-radius: var(--radius-lg);
- background: var(--wash-2);
+.project-views__label {
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-2);
}
-.project-nav button {
- position: relative;
- min-height: var(--control-sm);
- min-width: 128px;
- padding: 0 var(--space-4);
+.project-commands {
display: flex;
align-items: center;
- justify-content: center;
gap: var(--space-2);
- border: 0;
- border-radius: var(--radius-md);
- color: var(--text-muted);
- background: transparent;
- font-size: var(--text-sm);
- font-weight: var(--weight-medium);
- line-height: var(--leading-snug);
- white-space: nowrap;
- transition: var(--transition-control);
}
-.project-nav button > svg {
- flex: 0 0 auto;
+.project-commands > button {
+ flex: none;
}
-.project-nav button:hover {
- color: var(--text-secondary);
- background: var(--wash-2);
-}
+/* --- InfoBars -------------------------------------------------------------------
+ Save and export failures, inline under the title bar at full width, where
+ the corner toasts used to be. */
-.project-nav button.active {
- color: var(--text-primary);
- background: var(--segment-active-bg);
- font-weight: var(--weight-semibold);
- box-shadow:
- inset 0 0 0 1px var(--line-strong),
- var(--segment-active-shadow);
+.project-infobars {
+ display: grid;
+ gap: var(--space-1);
+ flex: none;
+ padding: 0 var(--space-2) var(--space-2);
}
-/* Running-generation count. */
-.project-nav button span {
- flex: 0 0 auto;
- min-width: 22px;
- padding: 2px var(--space-2);
- border: 1px solid transparent;
- border-radius: var(--radius-pill);
- color: var(--text-secondary); /* 10.6:1 dark / 9.4:1 light on --panel-3 */
- background: var(--panel-3);
- font: var(--weight-medium) var(--text-2xs) / 1.4 var(--font-mono);
+/* --- Body: the view and the agent pane --------------------------------------- */
+
+.project-body {
+ --pane-workspace-agent: 360px; /* usePaneSize sets the real width inline */
+ flex: 1 1 auto;
+ min-height: 0;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr);
+ border-top: 1px solid var(--stroke-card);
+ background: var(--layer);
}
-/* --- Content region -------------------------------------------------------- */
+.project-body--agent {
+ grid-template-columns: minmax(0, 1fr) auto var(--pane-workspace-agent);
+}
-/* The chrome (topbar, nav, agent dock) stays put while the active view scrolls.
+/* The chrome (title bar, agent pane) stays put while the active view scrolls.
Without this the timeline clips on windows shorter than ~920px instead of
giving the user a way to reach the rest of it. */
.project-content {
+ min-width: 0;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
}
-/* --- Responsive ------------------------------------------------------------ */
-
-/* The window minimum is 900px (tauri.conf.json), so the chrome has to reach
- 900px with nothing clipped and nothing scrolling sideways. Each step spends
- the width it frees on the elements that carry the least information: the
- project name column shortens first, then the row padding, and only at the
- very bottom do the tabs tighten. */
-
-@media (max-width: 1180px) {
- .project-topbar {
- gap: var(--space-2);
- }
-
- .project-title {
- max-width: 240px;
- }
-
- .project-nav button {
- min-width: 116px;
- padding: 0 var(--space-3);
- }
+.project-agent-pane {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ min-height: 0;
+ overflow: hidden;
+ background: var(--layer);
+}
- .agent-dock .agent-provider__trigger {
- max-width: 168px;
- }
+.project-agent-pane > * {
+ flex: 1 1 auto;
+ min-height: 0;
}
-@media (max-width: 1040px) {
- .project-topbar {
- padding-inline: var(--space-3);
- }
+/* --- Narrow windows ---------------------------------------------------------
+ The window minimum is 900px (tauri.conf.json). The project name gives up
+ width first, then the tab icons go, so the tabs, Save and the caption
+ buttons all stay reachable. */
+@media (max-width: 1180px) {
.project-title {
- max-width: 176px;
- }
-
- .project-nav button {
- min-width: 96px;
- }
-
- .project-agent-row {
- padding-inline: var(--space-3);
+ max-width: 180px;
}
-
- /* The dock stops being an 880px island and takes what the row has left
- after the settings launcher's reserve. */
- .agent-dock-wrap {
- width: calc(100% - 256px);
- }
-
}
-@media (max-width: 900px) {
+@media (max-width: 1040px) {
.project-title {
- max-width: 160px;
+ max-width: 120px;
}
- /* Tabs shed their labels before they shed their reachability: the icon and
- the aria-current state carry the view at this width. */
- .project-nav button {
- min-width: var(--control-sm);
- padding: 0 var(--space-3);
+ .project-views .ui-selector-bar__icon {
+ display: none;
}
- .agent-dock .agent-provider__trigger {
- max-width: 128px;
+ .project-views .ui-selector-bar__item {
+ padding: 0 var(--space-2);
}
-
}