Skip to content

🎥 Make videos programmatically with React

save disabled

Jonny Burger95f87a6ea4b6
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
index ce6e82787d..64830b0b3a 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx
@@ -407,6 +407,7 @@ export const RenderModalData: React.FC<{
onSave={onSave}
showSaveButton={showSaveButton}
saving={saving}
+ saveDisabledByParent={!zodValidationResult.success}
/>
) : (
<RenderModalJSONPropsEditor
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaEditor.tsx
index e0bb58723e..8e5a5cb803 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaEditor.tsx
@@ -22,6 +22,7 @@ export const SchemaEditor: React.FC<{
onSave: (updater: (oldState: unknown) => unknown) => void;
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
schema,
value,
@@ -32,6 +33,7 @@ export const SchemaEditor: React.FC<{
onSave,
showSaveButton,
saving,
+ saveDisabledByParent,
}) => {
const z = useZodIfPossible();
if (!z) {
@@ -78,6 +80,7 @@ export const SchemaEditor: React.FC<{
showSaveButton={showSaveButton}
onRemove={null}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
</div>
);
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx
index 2199fab6ef..bb3693548a 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx
@@ -44,6 +44,7 @@ export const ZodArrayEditor: React.FC<{
showSaveButton: boolean;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
schema,
jsonPath,
@@ -55,6 +56,7 @@ export const ZodArrayEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const [localValue, setLocalValue] = useState<LocalState>(() => {
return {
@@ -149,6 +151,7 @@ export const ZodArrayEditor: React.FC<{
onSave={onSave}
showSaveButton={showSaveButton}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
})}
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.tsx
index 133bf905e8..0fd20b34bd 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.tsx
@@ -17,6 +17,7 @@ export const ZodArrayItemEditor: React.FC<{
onSave: (updater: (oldState: unknown[]) => unknown[]) => void;
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
def,
onChange,
@@ -28,6 +29,7 @@ export const ZodArrayItemEditor: React.FC<{
onSave: onSaveObject,
showSaveButton,
saving,
+ saveDisabledByParent,
}) => {
const onRemove = useCallback(() => {
onChange(
@@ -75,7 +77,7 @@ export const ZodArrayItemEditor: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
};
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.tsx
index a74454fbd7..f9de0ef209 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.tsx
@@ -19,6 +19,7 @@ export const ZodBooleanEditor: React.FC<{
onRemove: null | (() => void);
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
value,
@@ -29,6 +30,7 @@ export const ZodBooleanEditor: React.FC<{
onRemove,
showSaveButton,
saving,
+ saveDisabledByParent,
}) => {
const onValueChange = useCallback(
(newValue: boolean) => {
@@ -64,7 +66,7 @@ export const ZodBooleanEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
<div style={fullWidth}>
<Checkbox checked={value} onChange={onChange} disabled={false} />
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
index 9c6bbf8396..fb4fb8622d 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
@@ -35,6 +35,7 @@ export const ZodColorEditor: React.FC<{
compact: boolean;
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
value,
@@ -46,6 +47,7 @@ export const ZodColorEditor: React.FC<{
onSave,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const z = useZodIfPossible();
if (!z) {
@@ -194,7 +196,7 @@ export const ZodColorEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid={localValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
<div style={fullWidth}>
<Row align="center">
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
index 338fcb0ee6..6cec76f0f7 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
@@ -65,6 +65,7 @@ export const ZodDateEditor: React.FC<{
compact: boolean;
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
value,
@@ -76,6 +77,7 @@ export const ZodDateEditor: React.FC<{
onSave,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const [localValue, setLocalValue] = useState<LocalState>(() => {
return {
@@ -127,7 +129,7 @@ export const ZodDateEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid={localValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
<div style={fullWidth}>
<RemotionInput
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
index aa02acda50..b9fa33b2cc 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
@@ -121,7 +121,7 @@ export const ZodEnumEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid={localValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={!localValue.zodValidation.success}
/>
<div style={isRoot ? undefined : container}>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.tsx
index 92084eb514..e07db0be47 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.tsx
@@ -41,7 +41,7 @@ export const ZonNonEditableValue: React.FC<{
onRemove={null}
saving={saving}
valid
- saveDisabledByParent={false}
+ saveDisabledByParent
/>
<div style={fullWidth}>
<em style={compact ? emptyLabel : wideEmptyLabel}>{label}</em>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.tsx
index b108e15604..ba73f33653 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.tsx
@@ -13,6 +13,7 @@ export const ZodNullableEditor: React.FC<{
onSave: (updater: (oldNum: unknown) => unknown) => void;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
compact,
@@ -24,6 +25,7 @@ export const ZodNullableEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const {innerType} = schema._def as z.ZodOptionalDef;
@@ -40,6 +42,7 @@ export const ZodNullableEditor: React.FC<{
value={value}
nullishValue={null}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
};
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
index 07309afe27..92af1eb4c0 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
@@ -82,6 +82,7 @@ export const ZodNumberEditor: React.FC<{
onRemove: null | (() => void);
showSaveButton: boolean;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
value,
@@ -93,6 +94,7 @@ export const ZodNumberEditor: React.FC<{
onRemove,
showSaveButton,
saving,
+ saveDisabledByParent,
}) => {
const [localValue, setLocalValue] = useState<LocalState>(() => {
return {
@@ -160,7 +162,7 @@ export const ZodNumberEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid={localValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
<div style={fullWidth}>
<InputDragger
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx
index eada0fb611..f5214b472b 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx
@@ -20,7 +20,6 @@ const fieldset: React.CSSProperties = {
borderColor: INPUT_BORDER_COLOR_UNHOVERED,
};
-// TODO: First validate locally
export const ZodObjectEditor: React.FC<{
schema: z.ZodTypeAny;
jsonPath: JSONPath;
@@ -36,6 +35,7 @@ export const ZodObjectEditor: React.FC<{
showSaveButton: boolean;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
schema,
jsonPath,
@@ -47,6 +47,7 @@ export const ZodObjectEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const z = useZodIfPossible();
if (!z) {
@@ -117,7 +118,7 @@ export const ZodObjectEditor: React.FC<{
compact={compact}
showSaveButton={showSaveButton}
saving={saving}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
})}
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.tsx
index e6c8b1bb94..6d55ce3de0 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.tsx
@@ -13,6 +13,7 @@ export const ZodOptionalEditor: React.FC<{
onSave: (updater: (oldNum: unknown) => unknown) => void;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
compact,
@@ -24,6 +25,7 @@ export const ZodOptionalEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const {innerType} = schema._def as z.ZodOptionalDef;
@@ -40,6 +42,7 @@ export const ZodOptionalEditor: React.FC<{
value={value}
nullishValue={undefined}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
};
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
index e0d5da92d6..9dd9495739 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.tsx
@@ -48,6 +48,7 @@ export const ZodOrNullishEditor: React.FC<{
onRemove: null | (() => void);
nullishValue: null | undefined;
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
compact,
@@ -60,6 +61,7 @@ export const ZodOrNullishEditor: React.FC<{
onRemove,
nullishValue,
saving,
+ saveDisabledByParent,
}) => {
const z = useZodIfPossible();
if (!z) {
@@ -148,7 +150,7 @@ export const ZodOrNullishEditor: React.FC<{
onRemove={onRemove}
saving={saving}
valid={localNonNullishValueValue.zodValidation.success}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
) : (
<div style={fullWidth}>
@@ -163,7 +165,7 @@ export const ZodOrNullishEditor: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
- saveDisabledByParent={false}
+ saveDisabledByParent={saveDisabledByParent}
/>
</div>
)}
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
index e988cc1fd8..bf9304b32f 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
@@ -112,7 +112,6 @@ export const ZodStaticFileEditor: React.FC<{
onSave(() => value);
}, [onSave, value]);
- console.log(localValue);
return (
<div style={compact ? narrowOption : optionRow}>
<SchemaLabel
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
index 75896c03e8..f37cc8a4f6 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
@@ -73,6 +73,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -126,6 +127,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -143,6 +145,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -159,6 +162,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -236,6 +240,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -275,6 +280,7 @@ export const ZodSwitch: React.FC<{
showSaveButton={showSaveButton}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -308,6 +314,7 @@ export const ZodSwitch: React.FC<{
onSave={onSave}
onRemove={onRemove}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -325,6 +332,7 @@ export const ZodSwitch: React.FC<{
onRemove={onRemove}
schema={schema}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
@@ -342,6 +350,7 @@ export const ZodSwitch: React.FC<{
onRemove={onRemove}
schema={schema}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
}
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
index 6ef1072e0c..45da88ee9b 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
@@ -47,6 +47,7 @@ export const ZodUnionEditor: React.FC<{
onSave: (updater: (oldNum: unknown) => unknown) => void;
onRemove: null | (() => void);
saving: boolean;
+ saveDisabledByParent: boolean;
}> = ({
jsonPath,
compact,
@@ -58,6 +59,7 @@ export const ZodUnionEditor: React.FC<{
showSaveButton,
onRemove,
saving,
+ saveDisabledByParent,
}) => {
const {options} = schema._def as z.ZodUnionDef;
@@ -131,6 +133,7 @@ export const ZodUnionEditor: React.FC<{
value={value}
nullishValue={nullishValue}
saving={saving}
+ saveDisabledByParent={saveDisabledByParent}
/>
);
};