The VS Code of video editing, built for agents.
TypeScript
Enhance ExportPanel and Inspector components with new settings functionality
konstantin-paulusb2f5166d7570
diff --git a/apps/web/src/components/sidebar-right/inspector/export.tsx b/apps/web/src/components/sidebar-right/inspector/export.tsxindex 5ecb2ed6..b521fac7 100644--- a/apps/web/src/components/sidebar-right/inspector/export.tsx+++ b/apps/web/src/components/sidebar-right/inspector/export.tsx@@ -109,6 +109,11 @@ export function ExportPanel(props: ExportPanelProps) {if (next) write(next);};+ const addSettings = () => {+ applyTemplate(DEFAULT_EXPORT_TEMPLATE_ID);+ setIsInspectorOpen(true);+ };+// Changes some fields, keeping the rest (and the preset label) as they are.const patchSettings = (patch: ExportConfig) => {const current = settings();@@ -151,7 +156,7 @@ export function ExportPanel(props: ExportPanelProps) {size="icon"variant="ghost"class="text-muted-foreground"- onClick={() => applyTemplate(DEFAULT_EXPORT_TEMPLATE_ID)}+ onClick={addSettings}><Icon name="plus-add" /></TooltipTrigger>diff --git a/apps/web/src/components/sidebar-right/inspector/fills.tsx b/apps/web/src/components/sidebar-right/inspector/fills.tsxindex 1d7a4eca..21393fd3 100644--- a/apps/web/src/components/sidebar-right/inspector/fills.tsx+++ b/apps/web/src/components/sidebar-right/inspector/fills.tsx@@ -51,7 +51,10 @@ export function FillsSettings(props: FillsSettingsProps) {);const handleAppendFill = () => {- editor.insertElement(entity(), () => <SolidPaint color={DEFAULT_FILL_COLOR} />);+ const [fill] = editor.insertElement(entity(), () => (+ <SolidPaint color={DEFAULT_FILL_COLOR} />+ ));+ if (fill) setPicked(fill);};// Read back off the list, so removing a fill closes the picker on it.diff --git a/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsx b/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsxindex c4e3f35b..0a06632a 100644--- a/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsx+++ b/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsx@@ -148,7 +148,7 @@ export function GradientFillPicker(props: GradientPickerProps) {if (first) editOffset(first.entity, adjustedFirstPosition);const stop = insertStop(0, first?.color ?? 0xFFFFFF, first?.opacity ?? DEFAULT_OPACITY);- if (stop) setSelectedStop(stop);+ if (stop) spawnColorPicker(stop);};const removeStop = (stop: Entity) => {diff --git a/apps/web/src/components/sidebar-right/inspector/shadows.tsx b/apps/web/src/components/sidebar-right/inspector/shadows.tsxindex 23043d18..e440b212 100644--- a/apps/web/src/components/sidebar-right/inspector/shadows.tsx+++ b/apps/web/src/components/sidebar-right/inspector/shadows.tsx@@ -60,7 +60,7 @@ export function ShadowsSettings(props: ShadowsSettingsProps) {const shadows = useDerived(() => entity().get(Cache)?.shadows ?? NO_SHADOWS);const handleAppendShadow = () => {- editor.insertElement(entity(), () => (+ const [shadow] = editor.insertElement(entity(), () => (<ShadowElementcolor={DEFAULT_SHADOW.color}opacity={DEFAULT_SHADOW.opacity}@@ -68,6 +68,7 @@ export function ShadowsSettings(props: ShadowsSettingsProps) {offsetY={DEFAULT_SHADOW.offsetY}/>));+ if (shadow) setPicked(shadow);};// Read back off the list, so removing a shadow closes the inspector on it.@@ -162,7 +163,7 @@ function ShadowRow(props: ShadowRowProps) {<ContextMenuTrigger><ItemRowlabel="Shadow"- value={colorToHex(color()).replace("#", "")}+ value={colorToHex(color())}icon={<Icon name="color-grade" />}onClick={props.onSelect}disabled={hidden()}diff --git a/apps/web/src/components/sidebar-right/inspector/strokes.tsx b/apps/web/src/components/sidebar-right/inspector/strokes.tsxindex 7434ae3f..3c8e8aa7 100644--- a/apps/web/src/components/sidebar-right/inspector/strokes.tsx+++ b/apps/web/src/components/sidebar-right/inspector/strokes.tsx@@ -81,7 +81,10 @@ export function StrokesSettings(props: StrokesSettingsProps) {const strokes = useDerived(() => entity().get(Cache)?.strokes ?? NO_STROKES);const handleAppendStroke = () => {- editor.insertElement(entity(), () => <StrokeElement color={DEFAULT_COLOR} />);+ const [stroke] = editor.insertElement(entity(), () => (+ <StrokeElement color={DEFAULT_COLOR} />+ ));+ if (stroke) setPicked(stroke);};// Read back off the list, so the picker closes with the stroke it edits.