AI media harness for planning, generating, and editing locally
TypeScript
Add empty references from the toolbar
Bittiac82f5ff35ec
diff --git a/docs/video-references.md b/docs/video-references.mdindex e563319..0f58f1c 100644--- a/docs/video-references.md+++ b/docs/video-references.md@@ -47,7 +47,7 @@ it does not resolve or validate the remaining conditioning/transformer failure.## Adding video references-In **References**, choose **Add reference → Other → New** to create an+In **References**, choose **Add Empty** to create an**Uncategorized** reference, then choose **Add file** in its details. Videocan also be attached to an existing reference. The reference card shows thevideo's first source frame, including after reopening the project; replacingdiff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxindex 9b02a3d..ff47599 100644--- a/src/components/workspace/ReferencesView.test.tsx+++ b/src/components/workspace/ReferencesView.test.tsx@@ -249,6 +249,7 @@ describe("Reference type presets", () => {expect(state.latest().references).toHaveLength(1);expect(within(dialog).queryByRole("button", { name: "Text" })).not.toBeInTheDocument();expect(within(dialog).queryByRole("button", { name: "Image" })).not.toBeInTheDocument();+ expect(within(dialog).queryByRole("button", { name: "Other" })).not.toBeInTheDocument();expect(within(dialog).getByRole("button", { name: "Character" })).toHaveAttribute("aria-pressed", "true");fireEvent.click(within(dialog).getByRole("button", { name: "New" }));expect(state.latest().references[0]).toMatchObject({ name: "New character", description: "", intendedUse: ["character"] });diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex a293b62..9892167 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -41,10 +41,6 @@ import {} from "../ui";import { isMenuKey } from "./SceneBoard";-const PICKER_TYPES: ReadonlyArray<{ id: ReferenceType; label: string }> = [- ...REFERENCE_TYPES, { id: "custom", label: "Other" },-];-/** What a reference IS, in a word. This replaced the file path in both places* it used to be printed: a path is a fact about the disk, not about the* reference, and neither the card nor the inspector does anything with it. */@@ -109,7 +105,7 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,useEffect(() => {if (onGenerateBuiltinIcons && isTauri()) void refreshBuiltinIcons().catch((reason) => setIconError(String(reason)));}, [folderPath, Boolean(onGenerateBuiltinIcons)]);- const [pickerType, setPickerType] = useState<ReferenceType>("character");+ const [pickerType, setPickerType] = useState<PresetReferenceType>("character");const [pickerSubcategory, setPickerSubcategory] = useState("all");const [presetSearch, setPresetSearch] = useState("");const [view, setView] = useState<LibraryView>(readView);@@ -299,7 +295,7 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,finally { setImportingFiles(false); }};const createEmptyReference = () => {- addTextReference(pickerType === "custom" ? "Uncategorized" : `New ${referenceTypeLabel(pickerType).toLocaleLowerCase()}`, "", pickerType, pickerSubcategory === "all" ? "" : pickerSubcategory);+ addTextReference(`New ${referenceTypeLabel(pickerType).toLocaleLowerCase()}`, "", pickerType, pickerSubcategory === "all" ? "" : pickerSubcategory);setPresetDialog(false);};const choosePreset = (preset: ReferencePreset) => {@@ -453,6 +449,7 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,</>}><CommandBarButton icon={<Add16 />} label="Add reference" tooltip="Add reference" showLabel onClick={openNewReference} />+ <CommandBarButton icon={<TextFile16 />} label="Add Empty" showLabel onClick={() => addTextReference("Uncategorized", "", "custom")} /><CommandBarSeparator /><CommandBarButton icon={<ImageAdd16 />} label="Add file" showLabel disabled={!selected || importingFiles || hasRefmods || selection.length > 1} onClick={() => void addFiles()} /><CommandBarButton icon={<Delete16 />} label="Delete" shortcut="Delete" disabled={!selection.length} onClick={() => remove()} />@@ -718,10 +715,9 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,<p className="reference-preset-dialog__lead">Choose a preset, or start a new reference and add a prompt, images or video.</p><div className="reference-preset-dialog__body"><nav aria-label="Reference types">- {PICKER_TYPES.map((type) => <button key={type.id} type="button" className={pickerType === type.id ? "active" : ""} aria-pressed={pickerType === type.id} onClick={() => { setPickerType(type.id); setPickerSubcategory("all"); setPresetSearch(""); }}>{type.label}</button>)}+ {REFERENCE_TYPES.map((type) => <button key={type.id} type="button" className={pickerType === type.id ? "active" : ""} aria-pressed={pickerType === type.id} onClick={() => { setPickerType(type.id); setPickerSubcategory("all"); setPresetSearch(""); }}>{type.label}</button>)}</nav><section>- {pickerType !== "custom" && <><label className="reference-preset-search"><Search16 aria-hidden="true" /><input value={presetSearch} onChange={(event) => setPresetSearch(event.target.value)} placeholder={`Search ${referenceTypeLabel(pickerType).toLocaleLowerCase()}`} aria-label="Search reference options" /></label><SelectorBarclassName="reference-subcategories"@@ -744,8 +740,6 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,</div>)}{visiblePresets.length === 0 && <p>No results for “{presetSearch.trim()}”.</p>}</div>- </>}- {pickerType === "custom" && <p className="reference-preset-dialog__lead">Start an uncategorized reference with New.</p>}</section></div></ContentDialog>}diff --git a/src/components/workspace/ReferencesView.video.test.tsx b/src/components/workspace/ReferencesView.video.test.tsxindex df7eff2..f8c8f46 100644--- a/src/components/workspace/ReferencesView.video.test.tsx+++ b/src/components/workspace/ReferencesView.video.test.tsx@@ -126,14 +126,9 @@ it("imports a video, edits its saved trim and soundtrack, then removes its attac}render(<Harness />);expect(screen.queryByRole("button", { name: "Import video" })).not.toBeInTheDocument();- fireEvent.click(screen.getByRole("button", { name: /Add reference/ }));- const picker = screen.getByRole("dialog", { name: "Add reference" });- fireEvent.click(within(picker).getByRole("button", { name: "Other" }));- expect(within(picker).queryByRole("textbox")).not.toBeInTheDocument();- expect(within(picker).queryByRole("group")).not.toBeInTheDocument();- expect(within(picker).queryByText("No options match that search.")).not.toBeInTheDocument();- fireEvent.click(within(picker).getByRole("button", { name: "New" }));- expect(latest.references[0]).toMatchObject({ name: "Uncategorized", kind: "text", intendedUse: [] });+ fireEvent.click(screen.getByRole("button", { name: "Add Empty" }));+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ expect(latest.references[0]).toMatchObject({ name: "Uncategorized", kind: "text", description: "", intendedUse: [] });fireEvent.click(screen.getByRole("button", { name: "Add file" }));fireEvent.click(await screen.findByRole("button", { name: "Edit video clip" }));const preview = await screen.findByLabelText("Uncategorized video preview");