AI media harness for planning, generating, and editing locally
TypeScript
Move reference name to header
Bitti6d9f983044b4
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxindex 7e1c5c1..ea1efc8 100644--- a/src/components/workspace/ReferencesView.test.tsx+++ b/src/components/workspace/ReferencesView.test.tsx@@ -43,6 +43,20 @@ function setup() {}describe("Reference type presets", () => {+ it("renames the selected reference from the inspector header", () => {+ const state = setup();+ const name = screen.getByRole("textbox", { name: "Reference name" });+ const header = name.closest("header");++ expect(name).toHaveValue("Hero");+ expect(header).not.toBeNull();+ expect(within(header!).getByRole("button", { name: "Remove reference" })).toBeInTheDocument();+ fireEvent.change(name, { target: { value: "Lead traveler" } });++ expect(state.latest().references[0].name).toBe("Lead traveler");+ expect(screen.getByRole("button", { name: /Lead traveler/ })).toBeInTheDocument();+ });+it("opens the type picker immediately for a new definition", () => {const state = setup();fireEvent.click(screen.getByRole("button", { name: "New definition" }));diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex 93eb763..3e704b5 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -164,7 +164,16 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje</main><aside className="reference-inspector">- <div className="panel-chrome"><h2>Reference details</h2>{selected && <button onClick={remove} aria-label="Delete reference" title="Delete this reference"><Trash2 size={16} /></button>}</div>+ <header className="reference-inspector__head">{selected ? <>+ <h2><input+ className="reference-title__name"+ value={selected.name}+ aria-label="Reference name"+ title="Rename this reference"+ onChange={(event) => update(selected.id, { name: event.target.value || "Untitled reference" })}+ /></h2>+ <button onClick={remove} aria-label="Remove reference" title="Remove this reference"><Trash2 size={16} /></button>+ </> : <h2>Reference details</h2>}</header><div className="reference-inspector__scroll">{selected ? <><div className={`reference-detail-art reference-detail-art--${selected.kind}${selected.kind === "image" && (selected.relativePath || selected.sourcePath) ? " reference-detail-art--photo" : ""}`}>@@ -177,7 +186,6 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje{selected.kind !== "image" && <em>{referenceKindLabel(selected.kind)}</em>}</div><div className="reference-fields">- <label><span>Name</span><input value={selected.name} onChange={(event) => update(selected.id, { name: event.target.value || "Untitled reference" })} /></label>{referenceType(selected) === "custom" ? <label><span>Prompt</span><textarea value={selected.description} placeholder="Describe what should stay consistent — the traits, materials, colours, or wardrobe PolStudio should preserve across shots." onChange={(event) => update(selected.id, { description: event.target.value, content: event.target.value || null })} /></label> : <div className="reference-preset-summary"><span>Selection</span><button onClick={openPresetPicker}>diff --git a/src/styles/references.css b/src/styles/references.cssindex 132fb7f..f67cdab 100644--- a/src/styles/references.css+++ b/src/styles/references.css@@ -60,24 +60,66 @@padding-bottom: var(--space-5);}-/* A real <h2> in the chrome (the outline used to jump h1 → h3), styled to look- exactly like the <span> it replaced. */-.reference-inspector > .panel-chrome h2 {+/* The selected reference owns the inspector header, like the editable scene+ and shot names in the Generator. */+.reference-inspector__head {+ flex: 0 0 auto;+ min-height: var(--control-lg);display: flex;align-items: center;+ justify-content: space-between;gap: var(--space-2);+ padding: var(--space-4) var(--space-5);+ border-bottom: 1px solid var(--line);+}++.reference-inspector__head h2 {+ min-width: 0;+ flex: 1 1 auto;margin: 0;+ color: var(--text-primary);+ font-size: var(--text-lg);+ font-weight: var(--weight-semibold);+ line-height: var(--leading-snug);+ letter-spacing: var(--tracking-tight);+}++.reference-title__name {+ width: 100%;+ min-width: 0;+ padding: 2px var(--space-1);+ margin-left: calc(var(--space-1) * -1);+ border: 1px solid transparent;+ border-radius: var(--radius-sm);color: inherit;- font-size: inherit;- font-weight: inherit;- line-height: inherit;+ background: none;+ font: inherit;+ letter-spacing: inherit;+}++.reference-title__name:hover,+.reference-title__name:focus {+ border-color: var(--accent-bright);+ background: var(--panel-2);+ outline: none;}-.reference-inspector > .panel-chrome button {+.reference-inspector__head button {width: var(--control-sm);height: var(--control-sm);- justify-content: center;+ flex: 0 0 auto;+ display: grid;+ place-items: center;padding: 0;+ border: 0;+ border-radius: var(--radius-xs);+ color: var(--text-muted);+ background: none;+}++.reference-inspector__head button:hover {+ color: var(--danger);+ background: var(--danger-soft);}/* --- Reference cards ------------------------------------------------------- */