Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Put settings on tabs and cut three explanatory paragraphs

Bitti9247e2043129
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.ts
index a51a3a6..367fbed 100644
--- a/src/components/ProjectWorkspace.test.ts
+++ b/src/components/ProjectWorkspace.test.ts
@@ -976,21 +976,6 @@ describe("project workspace timecode", () => {
expect(onChange.mock.calls[0][0].generationJobs[0].referenceIds).toEqual([]);
});
- it("describes only the route the bound references actually take", () => {
- const fresh = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
- const config = parseProjectConfig({
- ...fresh,
- references: [{ id: "ref-text", kind: "text", name: "Mara", description: "Calm architect.", content: "Calm architect.", intendedUse: ["character"], createdAt: fresh.createdAt }],
- generationJobs: [{ ...fresh.generationJobs[0], referenceIds: ["ref-text"] }],
- });
- const { container } = render(createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange: () => undefined, onOpenTimeline: () => undefined, selectedJobId: fresh.generationJobs[0].id }));
- expect(document.querySelector(".job-refs")!.textContent).toContain("The text definition is written into this scene’s prompt.");
- // No image exists anywhere in this project, so NOTHING on the screen may
- // claim something is sent to the engine as an asset.
- expect(container.textContent).not.toContain("images are sent to the video engine");
- expect(container.textContent).not.toContain("Images are sent to the video engine");
- });
-
it("says why Duplicate and Delete are unavailable, not just that they are", () => {
const config = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });
render(createElement(TimelineView, { config, folderPath: "C:\Timeline Project", onChange: () => undefined, onOpenGenerator: () => undefined }));
diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsx
new file mode 100644
index 0000000..d2fae75
--- /dev/null
+++ b/src/components/SettingsView.test.tsx
@@ -0,0 +1,67 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { SettingsView } from "./SettingsView";
+
+vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));
+
+beforeEach(() => localStorage.clear());
+afterEach(cleanup);
+
+const open = () => render(<SettingsView onClose={() => undefined} />);
+const tab = (name: string) => screen.getByRole("tab", { name: new RegExp(`^${name}`) });
+
+describe("the settings screen", () => {
+ it("opens on the engine, because that is what has to be set before anything renders", async () => {
+ open();
+ expect(tab("Video engine").getAttribute("aria-selected")).toBe("true");
+ expect(screen.getByLabelText(/Transformer weights/)).toBeTruthy();
+ // The other tab's contents are not merely hidden, they are not rendered:
+ // a settings screen that draws both panels is the tall screen tabs replaced.
+ expect(screen.queryByLabelText("Appearance")).toBeNull();
+ await waitFor(() => expect(screen.getByRole("status").textContent).toContain("Browser preview"));
+ });
+
+ it("swaps panels when a tab is chosen, and follows the arrow keys", () => {
+ open();
+ fireEvent.click(tab("Appearance"));
+ expect(screen.getByRole("radiogroup", { name: "Appearance" })).toBeTruthy();
+ expect(screen.queryByLabelText(/Transformer weights/)).toBeNull();
+ // Each panel is named by the tab that opened it, so a screen reader lands
+ // somewhere that says what it is.
+ expect(screen.getByRole("tabpanel").getAttribute("aria-labelledby")).toBe("settings-tab-appearance");
+
+ fireEvent.keyDown(tab("Appearance"), { key: "ArrowRight" });
+ expect(tab("Video engine").getAttribute("aria-selected")).toBe("true");
+ fireEvent.keyDown(tab("Video engine"), { key: "ArrowLeft" });
+ expect(tab("Appearance").getAttribute("aria-selected")).toBe("true");
+ });
+
+ it("counts the paths still to set on the engine tab, from either tab", () => {
+ open();
+ // Four of the five fields are required and none is set yet.
+ expect(within(tab("Video engine")).getByText("4")).toBeTruthy();
+ fireEvent.click(tab("Appearance"));
+ // Still legible from the other side: what is unfinished is the reason the
+ // screen was opened, and hiding it behind a tab would bury it.
+ expect(within(tab("Video engine")).getByText("4")).toBeTruthy();
+ });
+
+ it("says none of the prose that used to explain what this computer means", () => {
+ const { container } = open();
+ for (const gone of ["belongs to this computer", "stays behind when", "needs the model files", "ships with the app"]) {
+ expect(container.textContent, gone).not.toContain(gone);
+ }
+ // What replaced it: the title, the tabs, and each field saying its own job.
+ expect(screen.getByRole("heading", { name: "This computer" })).toBeTruthy();
+ expect(screen.getByText("Reads your prompt so the transformer can act on it.")).toBeTruthy();
+ });
+
+ it("offers Clear all paths only beside the paths", () => {
+ open();
+ expect(screen.getByRole("button", { name: /Clear all paths/ })).toBeTruthy();
+ fireEvent.click(tab("Appearance"));
+ expect(screen.queryByRole("button", { name: /Clear all paths/ })).toBeNull();
+ });
+});
diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx
index 7bb13df..749f3f0 100644
--- a/src/components/SettingsView.tsx
+++ b/src/components/SettingsView.tsx
@@ -60,7 +60,10 @@ function AppearanceSetting() {
};
return (
- <div className="theme-choice" role="radiogroup" aria-labelledby="appearance-heading">
+ /* Named here rather than by a heading: the tab above IS the heading now,
+ and a group pointed at an element that no longer exists announces
+ nothing at all. */
+ <div className="theme-choice" role="radiogroup" aria-label="Appearance">
{themeOptions.map((option) => {
const Icon = option.icon;
const selected = choice === option.id;
@@ -86,7 +89,22 @@ function AppearanceSetting() {
);
}
+/* Two things live on this screen and they have nothing to do with each other:
+ how the app looks, and where this computer keeps the model files. Stacked,
+ they made a screen taller than the window — five path fields is a long list —
+ so whichever one the user came for was below the fold half the time. One tab
+ each, and neither scrolls on an ordinary window. */
+const TABS = [
+ { id: "engine", label: "Video engine" },
+ { id: "appearance", label: "Appearance" },
+] as const;
+type TabId = (typeof TABS)[number]["id"];
+
export function SettingsView({ onClose }: { onClose: () => void }) {
+ /* The engine first: this screen exists because those paths have to be set
+ before anything can be rendered, and its status line answers "is PolStudio
+ ready?" without a click. */
+ const [tab, setTab] = useState<TabId>("engine");
const [settings, setSettings] = useState<EngineSettings>(() => loadEngineSettings());
const [status, setStatus] = useState<VidfabStatus | null>(null);
const [error, setError] = useState<string | null>(null);
@@ -148,67 +166,99 @@ export function SettingsView({ onClose }: { onClose: () => void }) {
<button className="icon-button icon-button--strong" onClick={onClose} aria-label="Close settings"><X size={18} /></button>
</header>
- <p className="settings-view__lead">
- Everything here belongs to this computer rather than to a project, so it stays behind when
- you copy a project folder somewhere else and it applies to every project you open.
- </p>
-
- <section className="settings-section" aria-labelledby="appearance-heading">
- <h2 id="appearance-heading">Appearance</h2>
- <AppearanceSetting />
- </section>
-
- <section className="settings-section" aria-labelledby="paths-heading">
- <h2 id="paths-heading">Video engine</h2>
- <p className="settings-section__note">
- PolStudio needs the model files to render a shot. Where they live is a property of this
- computer, not of a project, so the paths are remembered here and used by every project
- you open. The engine itself ships with the app and needs no setting.
- </p>
-
- <div className={`settings-status settings-status--${status?.state ?? "checking"}`} role="status">
- <span><i />{engineHeadline(status, desktop)}</span>
- <p>{engineDetail(status, desktop, missing.length)}</p>
- </div>
- {ENGINE_PATH_FIELDS.map((field) => {
- const value = settings[field.id];
- const state = pathState(field, value, status);
- return (
- <div className={`settings-path settings-path--${state}`} key={field.id}>
- <label htmlFor={`engine-${field.id}`}>
- <b>{field.label}{!field.required && <em>Optional</em>}</b>
- <small>{field.hint}</small>
- </label>
- <div className="settings-path__row">
- <input
- id={`engine-${field.id}`}
- value={value}
- spellCheck={false}
- placeholder={field.directory ? "Folder on this computer" : "File on this computer"}
- onChange={(event) => update(field.id, event.target.value)}
- onBlur={probe}
- />
- <button
- type="button"
- className="secondary-button"
- onClick={() => void browse(field)}
- disabled={!desktop}
- title={desktop ? `Browse for ${field.label}` : "Browsing for files is available in the desktop app"}
- >
- <FolderSearch size={16} /> Browse
- </button>
+ {/* A tab is a button that says which panel it opens, so it is a real
+ tablist rather than two buttons that happen to swap the content:
+ the arrow keys move between them, and the panel below is named by
+ the tab that opened it. */}
+ <div className="settings-tabs" role="tablist" aria-label="Settings sections">
+ {TABS.map((item, index) => (
+ <button
+ key={item.id}
+ id={`settings-tab-${item.id}`}
+ role="tab"
+ type="button"
+ aria-selected={tab === item.id}
+ aria-controls={`settings-panel-${item.id}`}
+ tabIndex={tab === item.id ? 0 : -1}
+ className={tab === item.id ? "active" : ""}
+ onClick={() => setTab(item.id)}
+ onKeyDown={(event) => {
+ if (event.key !== "ArrowRight" && event.key !== "ArrowLeft") return;
+ const next = TABS[(index + (event.key === "ArrowRight" ? 1 : TABS.length - 1)) % TABS.length];
+ setTab(next.id);
+ document.getElementById(`settings-tab-${next.id}`)?.focus();
+ }}
+ >
+ {item.label}
+ {/* What is wrong stays visible from the other tab: a count here
+ is the whole reason someone opens this screen. */}
+ {item.id === "engine" && missing.length > 0 && <em title={`${missing.length} model ${missing.length === 1 ? "path" : "paths"} still to set`}>{missing.length}</em>}
+ </button>
+ ))}
+ </div>
+
+ <div className="settings-view__body">
+ {tab === "appearance" && <section
+ className="settings-section"
+ id="settings-panel-appearance"
+ role="tabpanel"
+ aria-labelledby="settings-tab-appearance"
+ >
+ <AppearanceSetting />
+ </section>}
+
+ {tab === "engine" && <section
+ className="settings-section"
+ id="settings-panel-engine"
+ role="tabpanel"
+ aria-labelledby="settings-tab-engine"
+ >
+ <div className={`settings-status settings-status--${status?.state ?? "checking"}`} role="status">
+ <span><i />{engineHeadline(status, desktop)}</span>
+ <p>{engineDetail(status, desktop, missing.length)}</p>
+ </div>
+ {ENGINE_PATH_FIELDS.map((field) => {
+ const value = settings[field.id];
+ const state = pathState(field, value, status);
+ return (
+ <div className={`settings-path settings-path--${state}`} key={field.id}>
+ <label htmlFor={`engine-${field.id}`}>
+ <b>{field.label}{!field.required && <em>Optional</em>}</b>
+ <small>{field.hint}</small>
+ </label>
+ <div className="settings-path__row">
+ <input
+ id={`engine-${field.id}`}
+ value={value}
+ spellCheck={false}
+ placeholder={field.directory ? "Folder on this computer" : "File on this computer"}
+ onChange={(event) => update(field.id, event.target.value)}
+ onBlur={probe}
+ />
+ <button
+ type="button"
+ className="secondary-button"
+ onClick={() => void browse(field)}
+ disabled={!desktop}
+ title={desktop ? `Browse for ${field.label}` : "Browsing for files is available in the desktop app"}
+ >
+ <FolderSearch size={16} /> Browse
+ </button>
+ <span className="settings-path__state">
+ {state === "found" ? <Check size={14} aria-hidden="true" /> : state === "missing" ? <AlertCircle size={14} aria-hidden="true" /> : null}
+ {stateLabel[state]}
+ </span>
+ </div>
</div>
- <span className="settings-path__state">
- {state === "found" ? <Check size={14} aria-hidden="true" /> : state === "missing" ? <AlertCircle size={14} aria-hidden="true" /> : null}
- {stateLabel[state]}
- </span>
- </div>
- );
- })}
- </section>
+ );
+ })}
+ </section>}
+ </div>
<footer className="settings-view__foot">
- <button className="secondary-button" onClick={clearAll}><RotateCcw size={16} /> Clear all paths</button>
+ {/* Clearing the paths is an engine action, so it is only offered
+ beside them. The saving note is true of the whole screen. */}
+ {tab === "engine" && <button className="secondary-button" onClick={clearAll}><RotateCcw size={16} /> Clear all paths</button>}
<span>Changes are saved as you type.</span>
</footer>
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index 3ff6f26..7d16dab 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -363,9 +363,12 @@ export function GeneratorView({ config, folderPath, runtime = null, onChange, on
{/* The request was already handed to the engine, so a change here
would say it steered a render it never touched. */}
{refsLocked && <p className="job-refs__empty">This scene is already with the engine. Its references can be changed once it finishes, and the next run will use them.</p>}
- {promptRefs.length === 0
- ? <p className="job-refs__empty">The video engine only follows the words above.</p>
- : <p className="job-refs__empty">{referenceRouting(promptRefs)} The tags are your own notes and don’t change what is sent.</p>}
+ {/* Only the empty case says anything now. With references actually
+ bound, the list above already shows what each one is and what is
+ wrong with any that will not be used; a paragraph restating the
+ route every one of them takes was a sentence about the system
+ rather than about this scene. */}
+ {promptRefs.length === 0 && <p className="job-refs__empty">The video engine only follows the words above.</p>}
</div>
<div className="job-actions">
@@ -499,21 +502,6 @@ function QueueGroup({ title, jobs, selectedId, onSelect }: { title: string; jobs
</section>;
}
-/* Only claim the route the bound references actually take. Saying "images are
- sent … text definitions are written into the prompt" for a scene that has only
- one of the two describes something that isn't happening. */
-const referenceRouting = (references: ProjectReference[]): string => {
- const hasImage = references.some((reference) => reference.kind === "image");
- const hasText = references.some((reference) => reference.kind !== "image");
- if (hasImage && hasText) return "Images are sent to the video engine as reference assets; text definitions are written into this scene’s prompt.";
- if (hasImage) return references.length === 1
- ? "The image is sent to the video engine as a reference asset."
- : "The images are sent to the video engine as reference assets.";
- return references.length === 1
- ? "The text definition is written into this scene’s prompt."
- : "The text definitions are written into this scene’s prompt.";
-};
-
/* Why a reference that is bound to this scene never reaches its prompt, or null
when it does. The wording mirrors the References card so the two screens
describe the same state in the same words. */
diff --git a/src/styles/shell.css b/src/styles/shell.css
index caacd30..47b4b66 100644
--- a/src/styles/shell.css
+++ b/src/styles/shell.css
@@ -241,14 +241,27 @@
z-index: 60;
inset: 0;
overflow-y: auto;
+ display: grid;
+ align-content: center;
padding: var(--space-7) var(--space-5);
background: var(--scrim);
backdrop-filter: blur(10px);
}
+/* The screen is a panel with a fixed frame, not a document: the title, the
+ tabs and the footer stay put and only the panel between them scrolls. The
+ whole thing used to be one long column inside a scrolling overlay, so the
+ close button and "changes are saved as you type" both left the screen as
+ soon as the engine paths did. dvh rather than vh because a mobile-style
+ toolbar must not push the footer under the edge; vh first for anything that
+ does not know the unit. */
.settings-view {
width: min(880px, 100%);
+ max-height: calc(100vh - var(--space-7) * 2);
+ max-height: calc(100dvh - var(--space-7) * 2);
margin: 0 auto;
+ display: grid;
+ grid-template-rows: auto auto minmax(0, 1fr) auto;
padding: var(--space-6);
border: 1px solid var(--line-strong);
border-radius: var(--radius-xl);
@@ -256,6 +269,17 @@
box-shadow: var(--shadow);
}
+/* The only part that scrolls, and on an ordinary window it does not have to:
+ one tab's worth of settings fits. */
+.settings-view__body {
+ min-height: 0;
+ overflow-y: auto;
+ /* Room for the focus ring on the first and last controls, which a clipped
+ overflow would otherwise cut in half. */
+ padding: 2px;
+ margin: 0 -2px;
+}
+
.settings-view__head {
display: flex;
align-items: flex-start;
@@ -271,12 +295,64 @@
letter-spacing: var(--tracking-hero);
}
-.settings-view__lead {
- max-width: 70ch;
- margin: var(--space-4) 0 var(--space-5);
+/* --- Tabs -------------------------------------------------------------------
+ One row of two, each naming the panel below it. They carry the whole job the
+ section headings used to do, so those are gone with them. */
+
+.settings-tabs {
+ display: flex;
+ gap: var(--space-1);
+ margin: var(--space-5) 0 var(--space-4);
+ border-bottom: 1px solid var(--line);
+}
+
+.settings-tabs button {
+ position: relative;
+ display: flex;
+ align-items: center;
+ gap: var(--space-2);
+ padding: var(--space-2) var(--space-3) var(--space-3);
+ border: 0;
color: var(--text-muted);
+ background: none;
font-size: var(--text-base);
- line-height: var(--leading-normal);
+ font-weight: var(--weight-medium);
+ line-height: var(--leading-snug);
+ cursor: pointer;
+}
+
+.settings-tabs button:hover {
+ color: var(--text-secondary);
+}
+
+.settings-tabs button.active {
+ color: var(--text-primary);
+}
+
+/* Drawn over the row's own line rather than beside it, so the selected tab
+ reads as attached to the panel underneath. */
+.settings-tabs button.active::after {
+ content: "";
+ position: absolute;
+ left: var(--space-2);
+ right: var(--space-2);
+ bottom: -1px;
+ height: 2px;
+ border-radius: 2px;
+ background: var(--accent-bright);
+}
+
+/* How many paths still need setting, readable from the other tab. */
+.settings-tabs button em {
+ min-width: 18px;
+ padding: 0 var(--space-1);
+ border-radius: var(--radius-xs);
+ color: var(--text-primary);
+ border: 1px solid var(--warning-line);
+ background: var(--warning-soft);
+ font: var(--weight-semibold) var(--text-2xs) / 18px var(--font-mono);
+ font-style: normal;
+ text-align: center;
}
.settings-status {
@@ -329,26 +405,10 @@
background: var(--danger);
}
+/* A section is a whole tab panel now, so it opens at the top of the body
+ rather than a heading's distance below the one before it. */
.settings-section {
- margin-top: var(--space-6);
-}
-
-.settings-section h2 {
- margin: 0 0 var(--space-4);
- font-size: var(--text-md);
- font-weight: var(--weight-semibold);
- line-height: var(--leading-snug);
- letter-spacing: var(--tracking-tight);
-}
-
-/* What a section is for, under its own heading rather than in one lead
- paragraph that had to speak for every unrelated setting on the screen. */
-.settings-section__note {
- max-width: 70ch;
- margin: calc(var(--space-4) * -1) 0 var(--space-4);
- color: var(--text-muted);
- font-size: var(--text-sm);
- line-height: var(--leading-normal);
+ margin: 0;
}
.settings-section .settings-status {
@@ -433,8 +493,15 @@
color: var(--accent-bright);
}
+/* Five of these, and stacked (name, hint, field, state) each one was four
+ rows tall — the reason this screen needed scrolling at all. Side by side the
+ same five fit in a window without losing a word of what they say. */
.settings-path {
- padding: var(--space-4) 0;
+ display: grid;
+ grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
+ align-items: start;
+ gap: var(--space-4);
+ padding: var(--space-3) 0;
border-top: 1px solid var(--line);
}
@@ -474,8 +541,9 @@
}
.settings-path__row {
- margin-top: var(--space-3);
display: flex;
+ flex-wrap: wrap;
+ align-items: center;
gap: var(--space-2);
}
@@ -496,7 +564,7 @@
}
.settings-path__state {
- margin-top: var(--space-2);
+ flex-basis: 100%;
display: inline-flex;
align-items: center;
gap: var(--space-1);
@@ -541,11 +609,19 @@
}
.settings-view {
+ max-height: calc(100vh - var(--space-4) * 2);
+ max-height: calc(100dvh - var(--space-4) * 2);
padding: var(--space-5) var(--space-4);
}
+ .settings-path {
+ grid-template-columns: minmax(0, 1fr);
+ gap: var(--space-2);
+ }
+
.settings-path__row {
flex-direction: column;
+ align-items: stretch;
}
.settings-view__foot {