Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Open type picker

Bitti143891086509
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsx
index d5e1d2d..b9fc3c5 100644
--- a/src/components/workspace/ReferencesView.test.tsx
+++ b/src/components/workspace/ReferencesView.test.tsx
@@ -43,6 +43,16 @@ function setup() {
}
describe("Reference type presets", () => {
+ it("opens the type picker immediately for a new definition", () => {
+ const state = setup();
+ fireEvent.click(screen.getByRole("button", { name: "New definition" }));
+
+ const dialog = screen.getByRole("dialog", { name: "Choose a reference type" });
+ expect(dialog).toBeInTheDocument();
+ expect(state.latest().references[0]).toMatchObject({ name: "New definition", intendedUse: [] });
+ expect(within(dialog).getByRole("button", { name: "Custom" })).toHaveAttribute("aria-pressed", "true");
+ });
+
it("shows one Type control without the old explanatory copy", () => {
setup();
expect(screen.getByRole("heading", { name: "Type" })).toBeInTheDocument();
diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsx
index 6bfb622..03d7819 100644
--- a/src/components/workspace/ReferencesView.tsx
+++ b/src/components/workspace/ReferencesView.tsx
@@ -42,6 +42,13 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje
onChange({ ...config, references: [reference, ...config.references] });
setSelectedId(id);
};
+ const addDefinition = () => {
+ addTextReference();
+ setPickerType("custom");
+ setPickerSubcategory("all");
+ setPresetSearch("");
+ setPresetDialog(true);
+ };
const addImage = async () => {
setImportError(null);
if (!isTauri()) {
@@ -102,7 +109,7 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje
<p>{config.references.length === 1 ? "1 reference" : `${config.references.length} references`}</p>
</div>
<div className="references-heading__actions">
- <button className="secondary-button" onClick={() => addTextReference()}><FileText size={16} /> New definition</button>
+ <button className="secondary-button" onClick={addDefinition}><FileText size={16} /> New definition</button>
<button className="primary-button" onClick={() => void addImage()}><Upload size={16} /> Add image</button>
</div>
</header>