🎥 Make videos programmatically with React
warning fix
Patric Salvisberg4c14e5287352
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsxindex 222159189d..285193457c 100644--- a/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx+++ b/packages/cli/src/editor/components/RenderModal/RenderModalData.tsx@@ -20,7 +20,7 @@ import type {SegmentedControlItem} from '../SegmentedControl';import {SegmentedControl} from '../SegmentedControl';import type {TypeCanSaveState} from './get-render-modal-warnings';import {getRenderModalWarnings} from './get-render-modal-warnings';-import {RenderModalJSONInputPropsEditor} from './RenderModalJSONInputPropsEditor';+import {RenderModalJSONPropsEditor} from './RenderModalJSONPropsEditor';import {SchemaEditor} from './SchemaEditor/SchemaEditor';import {NoDefaultProps,@@ -30,6 +30,8 @@ import {WarningIndicatorButton} from './WarningIndicatorButton';type Mode = 'json' | 'schema';+export type PropsEditType = 'inputProps' | 'defaultProps';+const errorExplanation: React.CSSProperties = {fontSize: 14,color: LIGHT_TEXT,@@ -106,6 +108,8 @@ export const RenderModalData: React.FC<{determined: false,});+ const propsEditType: PropsEditType = compact ? 'defaultProps' : 'inputProps';+const setShowWarning: React.Dispatch<React.SetStateAction<boolean>> =useCallback((val) => {setShowWarningWithoutPersistance((prevVal) => {@@ -185,8 +189,12 @@ export const RenderModalData: React.FC<{const connectionStatus = useContext(PreviewServerConnectionCtx).type;const warnings = useMemo(() => {- return getRenderModalWarnings({canSaveDefaultProps, cliProps});- }, [canSaveDefaultProps, cliProps]);+ return getRenderModalWarnings({+ canSaveDefaultProps,+ cliProps,+ propsEditType,+ });+ }, [canSaveDefaultProps, cliProps, propsEditType]);if (connectionStatus === 'disconnected') {return (@@ -252,7 +260,7 @@ export const RenderModalData: React.FC<{showSaveButton={showSaveButton}/>) : (- <RenderModalJSONInputPropsEditor+ <RenderModalJSONPropsEditorvalue={inputProps ?? {}}setValue={setInputProps}zodValidationResult={zodValidationResult}diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalJSONInputPropsEditor.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsxsimilarity index 97%rename from packages/cli/src/editor/components/RenderModal/RenderModalJSONInputPropsEditor.tsxrename to packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsxindex a7f5c44cdd..20e8773433 100644--- a/packages/cli/src/editor/components/RenderModal/RenderModalJSONInputPropsEditor.tsx+++ b/packages/cli/src/editor/components/RenderModal/RenderModalJSONPropsEditor.tsx@@ -51,8 +51,10 @@ const scrollable: React.CSSProperties = {flex: 1,};+export type EditType = 'inputProps' | 'defaultProps';+// TODO: Note if custom 'remotion-date:' pattern has been used-export const RenderModalJSONInputPropsEditor: React.FC<{+export const RenderModalJSONPropsEditor: React.FC<{value: unknown;setValue: React.Dispatch<React.SetStateAction<unknown>>;zodValidationResult: z.SafeParseReturnType<unknown, unknown>;@@ -134,7 +136,6 @@ export const RenderModalJSONInputPropsEditor: React.FC<{};}, [keybindings, onQuickSave, onSave]);- // TODO: Indicate saving progressreturn (<div style={scrollable}><RemTextareadiff --git a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.tsindex ec6f6b1a34..da3107bf73 100644--- a/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts+++ b/packages/cli/src/editor/components/RenderModal/get-render-modal-warnings.ts@@ -1,4 +1,5 @@import {truthy} from '../../../truthy';+import type {PropsEditType} from './RenderModalData';export type TypeCanSaveState =| {@@ -10,8 +11,17 @@ export type TypeCanSaveState =determined: boolean;};-const getInputPropsWarning = ({cliProps}: {cliProps: unknown}) => {- if (Object.keys(cliProps as object).length > 0) {+const getInputPropsWarning = ({+ cliProps,+ propsEditType,+}: {+ cliProps: unknown;+ propsEditType: PropsEditType;+}) => {+ if (+ Object.keys(cliProps as object).length > 0 &&+ propsEditType === 'defaultProps'+ ) {return 'The data that was passed using --props takes priority over the data you enter here.';}@@ -37,12 +47,14 @@ const getCannotSaveDefaultProps = ({export const getRenderModalWarnings = ({cliProps,canSaveDefaultProps,+ propsEditType,}: {cliProps: unknown;canSaveDefaultProps: TypeCanSaveState;+ propsEditType: PropsEditType;}) => {return [- getInputPropsWarning({cliProps}),+ getInputPropsWarning({cliProps, propsEditType}),getCannotSaveDefaultProps({canSaveDefaultProps}),].filter(truthy);};