Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into pr/2536

Jonny Burger703b409a0875
diff --cc packages/cli/src/editor/components/OptionsPanel.tsx
index 216fd6ee92,5c68ac0f01..31927e6dcb
--- a/packages/cli/src/editor/components/OptionsPanel.tsx
+++ b/packages/cli/src/editor/components/OptionsPanel.tsx
@@@ -22,44 -24,13 +24,13 @@@ const container: React.CSSProperties =
flexDirection: 'column',
};
- const PropsEditor: React.FC<{
- composition: AnyComposition;
- }> = ({composition}) => {
- const {props, updateProps} = useContext(Internals.EditorPropsContext);
-
- const setInputProps = useCallback(
- (
- newProps:
- | Record<string, unknown>
- | ((oldProps: Record<string, unknown>) => Record<string, unknown>)
- ) => {
- updateProps({
- id: composition.id,
- defaultProps: composition.defaultProps as Record<string, unknown>,
- newProps,
- });
- },
- [composition.defaultProps, composition.id, updateProps]
- );
-
- const actualProps = useMemo(
- () => props[composition.id] ?? composition.defaultProps ?? {},
- [composition.defaultProps, composition.id, props]
- );
-
- return (
- <DataEditor
- key={composition.id}
- unresolvedComposition={composition}
- inputProps={actualProps}
- setInputProps={setInputProps}
- mayShowSaveButton
- propsEditType="default-props"
- />
- );
+ const circle: React.CSSProperties = {
+ width: 8,
+ height: 8,
+ borderRadius: 4,
};
-type SidebarPanel = 'input-props' | 'renders';
+type OptionsSidebarPanel = 'input-props' | 'renders';
const localStorageKey = 'remotion.sidebarPanel';
@@@ -86,13 -55,13 +57,15 @@@ export const optionsSidebarTabs = creat
selectRendersPanel: () => void;
}>();
-export const RightPanel: React.FC<{}> = () => {
+export const OptionsPanel: React.FC<{}> = () => {
+ const {props, updateProps} = useContext(Internals.EditorPropsContext);
+ const [saving, setSaving] = useState(false);
- const [panel, setPanel] = useState<SidebarPanel>(() => getSelectedPanel());
- const onCompositionsSelected = useCallback(() => {
+ const [panel, setPanel] = useState<OptionsSidebarPanel>(() =>
+ getSelectedPanel()
+ );
+ const onPropsSelected = useCallback(() => {
setPanel('input-props');
- persistSelectedPanel('input-props');
+ persistSelectedOptionsSidebarPanel('input-props');
}, []);
const onRendersSelected = useCallback(() => {
@@@ -135,8 -154,15 +158,11 @@@
<div style={container} className="css-reset">
<div style={tabsContainer}>
<Tabs>
- <Tab
- selected={panel === 'input-props'}
- onClick={onCompositionsSelected}
- style={{justifyContent: 'space-between'}}
- >
+ <Tab selected={panel === 'input-props'} onClick={onPropsSelected}>
Props
+ {unsavedChangesExist ? (
+ <div title={saveToolTip} style={circleStyle} />
+ ) : null}
</Tab>
<RendersTab
onClick={onRendersSelected}