Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Consolidate image generator toolbar

Bittif9e186bdac7f
diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsx
index 95849f5..774d48d 100644
--- a/src/components/workspace/ImageEditor.tsx
+++ b/src/components/workspace/ImageEditor.tsx
@@ -226,12 +226,12 @@ export function ImageEditor({ config, folderPath, onChange, onGenerate, onCancel
{ label: "Delete", icon: <Trash2 size={15} />, shortcut: "Delete", separator: true, danger: true, disabled: selected.kind === "root", action: removeSelected },
]} />}
<section className="image-center" aria-label="Image panel">
- <header className="image-toolbar"><button className="primary-button" disabled={active ? work.cancelling || work.status === "encoding" : !isTauri() || !template || templateNeedsDownload(template) || !imageScenePrompt(scene)} onClick={() => attempt(() => active ? onCancel(work.id) : onGenerate(template!))}><Sparkles size={16} />{active ? work.cancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>
- <label>Generator template<select aria-label="Image generator template" value={template?.id ?? ""} disabled={Boolean(active)} onChange={(event) => { setTemplateId(event.target.value); localStorage.setItem("slopus.image-generator-template.v1", event.target.value); const next = imageTemplates.find((candidate) => candidate.id === event.target.value); if (next) commit({ ...scene, steps: next.defaultSteps }); }}>
+ <div className="image-canvas-tools">
+ <button className="primary-button" disabled={active ? work.cancelling || work.status === "encoding" : !isTauri() || !template || templateNeedsDownload(template) || !imageScenePrompt(scene)} onClick={() => attempt(() => active ? onCancel(work.id) : onGenerate(template!))}><Sparkles size={16} />{active ? work.cancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>
+ <label className="image-generator">Generator<select aria-label="Generator" value={template?.id ?? ""} disabled={Boolean(active)} onChange={(event) => { setTemplateId(event.target.value); localStorage.setItem("slopus.image-generator-template.v1", event.target.value); const next = imageTemplates.find((candidate) => candidate.id === event.target.value); if (next) commit({ ...scene, steps: next.defaultSteps }); }}>
{!imageTemplates.length && <option value="">No MiniMax H3 templates</option>}{imageTemplates.map((item) => <option key={item.id} value={item.id} disabled={templateNeedsDownload(item)}>{item.name}{templateNeedsDownload(item) ? " (download in Settings)" : ""}</option>)}
- </select></label><span className="image-model">MiniMax H3</span>
- </header>
- <div className="image-canvas-tools"><button className={`icon-button ${boxes ? "active" : ""}`} aria-label="Show placement boxes" aria-pressed={boxes} onClick={() => { setBoxes(!boxes); setDrawKind(null); }}><Square size={16} /></button>
+ </select></label>
+ <button className={`icon-button ${boxes ? "active" : ""}`} aria-label="Show placement boxes" aria-pressed={boxes} onClick={() => { setBoxes(!boxes); setDrawKind(null); }}><Square size={16} /></button>
<select aria-label="Canvas tool" value={drawKind ?? "select"} onChange={(event) => { setDrawKind(event.target.value === "select" ? null : event.target.value as typeof drawKind); setBoxes(true); }}><option value="select">Select / move</option><option value="object">Draw object</option><option value="text">Draw text</option><option value="group">Draw group</option></select>
<button className="secondary-button" onClick={() => setZoom(1)}>Fit</button><input aria-label="Image zoom" type="range" min="0.5" max="3" step="0.1" value={zoom} onChange={(event) => setZoom(Number(event.target.value))} /><span>{Math.round(zoom * 100)}%</span>
<button className="icon-button" aria-label="Export image" title="Export image" disabled={!output || !isTauri()} onClick={() => attempt(() => invoke("export_generated_image", { folderPath, relativePath: output!.relativePath }))}><Download size={16} /></button>
diff --git a/src/styles/image-editor.css b/src/styles/image-editor.css
index b51c74b..78b3cf8 100644
--- a/src/styles/image-editor.css
+++ b/src/styles/image-editor.css
@@ -30,11 +30,8 @@
.image-hierarchy-menu kbd { margin-left: auto; color: var(--text-muted); font: inherit; font-size: var(--text-xs); }
.image-hierarchy-menu [role="separator"] { height: 1px; margin: var(--space-1); background: var(--line-solid); }
.image-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
-.image-editor .image-toolbar { justify-content: flex-start; flex-wrap: wrap; background: var(--panel); }
-.image-toolbar label { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 120px; font-size: var(--text-xs); }
-.image-toolbar select { width: 100%; min-width: 0; }
-.image-model { font-size: var(--text-xs); color: var(--text-faint); }
.image-canvas-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2); border-bottom: 1px solid var(--line-solid); font-size: var(--text-xs); }
+.image-generator { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.image-canvas-tools input[type="range"] { width: 72px; min-width: 0; }
.image-canvas-tools select { width: auto; max-width: 160px; }
.image-canvas-tools .active { color: var(--accent); }
@@ -68,4 +65,4 @@
.image-palette { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.image-palette > div { display: flex; align-items: center; }
.image-palette input[type="color"] { width: var(--control-sm); height: var(--control-sm); padding: var(--space-1); }
-@media (max-width: 1100px) { .image-editor { grid-template-columns: 180px minmax(0, 1fr) 240px; } .image-model { display: none; } }
+@media (max-width: 1100px) { .image-editor { grid-template-columns: 180px minmax(0, 1fr) 240px; } }