Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Show effective Video setting values

Bittib86f3fe12119
diff --git a/src/components/ui/ComboBox.tsx b/src/components/ui/ComboBox.tsx
index f26c4c9..fa6bd7f 100644
--- a/src/components/ui/ComboBox.tsx
+++ b/src/components/ui/ComboBox.tsx
@@ -89,8 +89,8 @@ export interface ComboBoxProps<V extends ComboValue = string> {
/** Editable mode: the value typed text stands for, or null to reject it.
* Default: the option whose label or value matches, ignoring case. */
parseText?: (text: string) => V | null;
- /** Editable mode: the field's text while nothing is being typed. Default:
- * the selected option's text (or empty). */
+ /** Override the selected text without changing the option labels.
+ * In editable mode, shown while nothing is being typed. */
displayText?: string;
}
@@ -297,7 +297,7 @@ function SelectComboBox<V extends ComboValue = string>(props: ComboBoxProps<V>)
onFocus={onFocus}
>
{selected?.icon && <span className="ui-combo__icon" aria-hidden="true">{selected.icon}</span>}
- <span className={cx("ui-combo__value", !selected && "ui-combo__value--placeholder")}>{selected ? selected.label : placeholder ?? " "}</span>
+ <span className={cx("ui-combo__value", !selected && "ui-combo__value--placeholder")}>{props.displayText ?? (selected ? selected.label : placeholder ?? " ")}</span>
<ChevronDown12 className="ui-combo__chevron" aria-hidden="true" />
</button>
{name !== undefined && <input type="hidden" name={name} value={value === null || value === undefined ? "" : String(value)} />}
diff --git a/src/components/workspace/VideoLibraryView.test.tsx b/src/components/workspace/VideoLibraryView.test.tsx
index faf43a7..389b9a1 100644
--- a/src/components/workspace/VideoLibraryView.test.tsx
+++ b/src/components/workspace/VideoLibraryView.test.tsx
@@ -197,12 +197,13 @@ it("edits Video overrides and restores project defaults without changing the pro
const config = project(); config.settings.defaultLook = "watercolor";
config.videos = [{ ...newVideo(null), title: "First" }, { ...newVideo(null), title: "Second" }];
const view = mount(config);
- expect(screen.getByRole("combobox", { name: "Video Look" })).toHaveTextContent("Project default (Watercolor)");
+ expect(screen.getByRole("combobox", { name: "Video Look" })).toHaveTextContent(/^Watercolor$/);
+ expect(screen.getByRole("combobox", { name: "Video resolution" })).toHaveTextContent(/^736 × 416$/);
choose("Video Look", "Claymation"); choose("Video aspect ratio", "9:16"); choose("Video resolution", "544 × 960");
expect(view.config().videos![0]).toMatchObject({ defaultLook: "claymation", aspectRatio: "9:16", resolution: "544p" });
expect(view.config().settings).toEqual(config.settings);
fireEvent.click(screen.getByRole("button", { name: "Select Second" }));
- expect(screen.getByRole("combobox", { name: "Video aspect ratio" })).toHaveTextContent("Project default (16:9)");
+ expect(screen.getByRole("combobox", { name: "Video aspect ratio" })).toHaveTextContent(/^16:9$/);
fireEvent.click(screen.getByRole("button", { name: "Select First" }));
choose("Video Look", /Project default/); choose("Video aspect ratio", /Project default/); choose("Video resolution", /Project default/);
expect(view.config().videos![0]).toMatchObject({ defaultLook: null, aspectRatio: null, resolution: null });
diff --git a/src/components/workspace/VideoLibraryView.tsx b/src/components/workspace/VideoLibraryView.tsx
index 947c3f8..a571551 100644
--- a/src/components/workspace/VideoLibraryView.tsx
+++ b/src/components/workspace/VideoLibraryView.tsx
@@ -148,15 +148,15 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {
<div className="music-prompt"><span>Shared prompt</span><PromptTextField aria-label="Video prompt" rows={5} value={selected.prompt} references={citableReferences(config.references).map((reference) => ({ id: reference.id, name: reference.name, mediaTypes: referenceMediaTypes(reference), detail: referenceTypeLabel(reference) }))} placeholder="Visual style and references for every scene…" onChange={(prompt) => edit({ prompt: prompt.slice(0, 30000) })} /></div>
</PropSection>
<PropSection title="Settings">
- <PropRow label="Look"><ComboBox aria-label="Video Look" value={selected.defaultLook ?? ""} options={[
+ <PropRow label="Look"><ComboBox aria-label="Video Look" value={selected.defaultLook ?? ""} displayText={LOOKS.find((look) => look.id === selectedSettings.defaultLook)?.label ?? selectedSettings.defaultLook ?? "None"} options={[
{ value: "", label: `Project default (${LOOKS.find((look) => look.id === config.settings.defaultLook)?.label ?? config.settings.defaultLook ?? "None"})` },
...LOOKS.map((look) => ({ value: look.id, label: look.label })),
]} onChange={(value) => edit({ defaultLook: value || null })} /></PropRow>
- <PropRow label="Aspect ratio"><ComboBox aria-label="Video aspect ratio" value={selected.aspectRatio ?? ""} options={[
+ <PropRow label="Aspect ratio"><ComboBox aria-label="Video aspect ratio" value={selected.aspectRatio ?? ""} displayText={selectedSettings.aspectRatio} options={[
{ value: "", label: `Project default (${config.settings.aspectRatio})` },
...(["16:9", "9:16", "1:1", "4:5"] as const).map((value) => ({ value, label: value })),
]} onChange={(value) => edit({ aspectRatio: value ? value as AspectRatio : null })} /></PropRow>
- <PropRow label="Resolution"><ComboBox aria-label="Video resolution" value={selected.resolution ?? ""} options={[
+ <PropRow label="Resolution"><ComboBox aria-label="Video resolution" value={selected.resolution ?? ""} displayText={resolutionLabel(selectedSettings.resolution)} options={[
{ value: "", label: `Project default (${resolutionLabel(config.settings.resolution)})` },
...[...new Set([...PROJECT_RESOLUTIONS, selectedSettings.resolution])].map((value) => ({ value, label: resolutionLabel(value) })),
]} onChange={(value) => edit({ resolution: value ? value as Resolution : null })} /></PropRow>