Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Move package installation into settings

JonnyBurger5198ebc0918e
diff --git a/packages/browser-studio/e2e/browser-studio.test.ts b/packages/browser-studio/e2e/browser-studio.test.ts
index 09054cf89d..27018a1b6e 100644
--- a/packages/browser-studio/e2e/browser-studio.test.ts
+++ b/packages/browser-studio/e2e/browser-studio.test.ts
@@ -162,12 +162,46 @@ test('loads Browser Studio, opens external links, and can add, delete, and dupli
await quickSwitcherInput.fill('> Settings');
await expect(
quickSwitcher.getByText('Settings...', {exact: true}),
+ ).toBeVisible();
+ await quickSwitcher.getByText('Settings...', {exact: true}).click();
+ const settings = studio.getByRole('dialog');
+ await expect(
+ settings.getByRole('button', {name: 'Shortcuts', exact: true}),
+ ).toBeVisible();
+ await expect(
+ settings.getByRole('button', {name: 'Packages', exact: true}),
+ ).toBeVisible();
+ for (const hiddenTab of [
+ 'Defaults',
+ 'Studio',
+ 'Skills',
+ 'Apps',
+ 'License',
+ ]) {
+ await expect(
+ settings.getByRole('button', {name: hiddenTab, exact: true}),
+ ).toHaveCount(0);
+ }
+
+ await expect(
+ settings.getByText('Keyboard shortcuts', {exact: true}),
).toHaveCount(0);
- await quickSwitcherInput.fill('> Restart Studio Server');
await expect(
- quickSwitcher.getByText('Restart Studio Server', {exact: true}),
+ settings.getByRole('list', {name: 'Playback', exact: true}),
+ ).toBeVisible();
+ await expect(
+ settings.getByText('Changes save to', {exact: true}),
+ ).toHaveCount(0);
+ await studio.locator('body').press('Escape');
+
+ await studio.getByRole('button', {name: /Search/}).click();
+ const secondQuickSwitcher = studio.getByRole('dialog');
+ const secondQuickSwitcherInput = secondQuickSwitcher.getByRole('textbox');
+ await secondQuickSwitcherInput.fill('> Restart Studio Server');
+ await expect(
+ secondQuickSwitcher.getByText('Restart Studio Server', {exact: true}),
).toHaveCount(0);
- await quickSwitcherInput.press('Escape');
+ await secondQuickSwitcherInput.press('Escape');
await studio.locator('[data-compname="MyComp"]').click();
await studio.getByRole('button', {name: 'Render on web'}).click();
@@ -734,9 +768,8 @@ test('installs packages without a server API and preserves undo, redo, and HMR',
await studio.getByRole('button', {name: 'Tools', exact: true}).click();
await studio.getByText('Install package...', {exact: true}).click();
- await expect(
- studio.getByText('Install packages', {exact: true}),
- ).toBeVisible();
+ await expect(studio.getByText('Settings', {exact: true})).toBeVisible();
+ await expect(studio.getByText('Packages', {exact: true})).toBeVisible();
await studio.locator('input[name="@remotion/google-fonts"]').click();
await studio.getByRole('button', {name: /^Install/}).click();
await expect(
diff --git a/packages/studio/src/components/InstallPackage.tsx b/packages/studio/src/components/InstallPackage.tsx
index ca0df80893..4d01fc00b5 100644
--- a/packages/studio/src/components/InstallPackage.tsx
+++ b/packages/studio/src/components/InstallPackage.tsx
@@ -6,33 +6,61 @@ import {
installableMap,
} from '@remotion/studio-shared';
import React, {useCallback, useContext, useEffect} from 'react';
+import ReactDOM from 'react-dom';
import {VERSION} from 'remotion';
import {installPackages} from '../api/install-package';
import {restartStudio} from '../api/restart-studio';
import {ShortcutHint} from '../error-overlay/remotion-overlay/ShortcutHint';
import {StudioServerConnectionCtx} from '../helpers/client-id';
-import {LIGHT_TEXT} from '../helpers/colors';
+import {BORDER_WHITE_ALPHA_12, LIGHT_TEXT} from '../helpers/colors';
import {useKeybinding} from '../helpers/use-keybinding';
import {SetSelectedModalContext} from '../state/modals';
import {Checkbox} from './Checkbox';
import {InstallablePackageComp} from './InstallablePackage';
-import {Flex, Row, Spacing} from './layout';
+import {Flex, Row} from './layout';
import {VERTICAL_SCROLLBAR_CLASSNAME} from './Menu/is-menu-item';
import {ModalButton} from './ModalButton';
import {ModalFooterContainer} from './ModalFooter';
-import {ModalHeader} from './ModalHeader';
-import {DismissableModal} from './NewComposition/DismissableModal';
const container: React.CSSProperties = {
- padding: 20,
- maxHeight: 400,
+ boxSizing: 'border-box',
+ flex: 1,
+ fontFamily: 'sans-serif',
+ minHeight: 0,
overflowY: 'auto',
+ padding: '16px 16px 0',
+};
+
+const settingsContainer: React.CSSProperties = {
+ display: 'flex',
+ flex: 1,
+ flexDirection: 'column',
+ minHeight: 0,
+ minWidth: 0,
};
const text: React.CSSProperties = {
fontSize: 14,
};
+const footer: React.CSSProperties = {
+ flex: 'none',
+};
+
+const packageRow: React.CSSProperties = {
+ alignItems: 'center',
+ borderBottom: BORDER_WHITE_ALPHA_12,
+ display: 'flex',
+ gap: 10,
+ minHeight: 52,
+ padding: '4px 0',
+};
+
+const lastPackageRow: React.CSSProperties = {
+ ...packageRow,
+ borderBottom: 'none',
+};
+
type State =
| {
type: 'idle';
@@ -51,9 +79,10 @@ type State =
type: 'restarting';
};
-export const InstallPackageModal: React.FC<{
+export const InstallPackageSettings: React.FC<{
+ readonly footerContainer: HTMLElement | null;
readonly packageManager: PackageManager | null;
-}> = ({packageManager}) => {
+}> = ({footerContainer, packageManager}) => {
const [state, setState] = React.useState<State>({type: 'idle'});
const [map, setMap] = React.useState<Record<string, boolean>>({});
@@ -127,10 +156,13 @@ export const InstallPackageModal: React.FC<{
enter.unregister();
};
}, [disabled, onClick, registerKeybinding]);
+ const installablePackages = Object.entries(installableMap).filter(
+ ([, install]) => install,
+ );
+ const packageCount = installablePackages.length + extraPackages.length;
return (
- <DismissableModal>
- <ModalHeader title="Install packages" />
+ <div style={settingsContainer}>
<div style={container} className={VERTICAL_SCROLLBAR_CLASSNAME}>
{state.type === 'done' ? (
<div style={text}>
@@ -150,51 +182,64 @@ export const InstallPackageModal: React.FC<{
: '. Check your terminal for progress.'}
</div>
) : (
- <div style={text}>
- {Object.entries(installableMap)
- .filter(([, install]) => install)
- .map(([pkgShort]) => {
- const pkg =
- pkgShort === 'core' ? 'remotion' : `@remotion/${pkgShort}`;
- const isInstalled =
- window.remotion_installedPackages?.includes(pkg) ?? false;
- const link = apiDocs[pkgShort as Pkgs];
- const description = descriptions[pkgShort as Pkgs];
- if (!link) {
- throw new Error('No link for ' + pkg);
- }
-
- if (!description) {
- throw new Error('No description for ' + pkg);
- }
-
- return (
- <Row key={pkg} align="center">
- <Checkbox
- checked={map[pkg]}
- name={pkg}
- onChange={() => {
- setMap((prev) => ({...prev, [pkg]: !prev[pkg]}));
- }}
- disabled={!canSelectPackages || isInstalled}
- />
- <Spacing x={1.5} />
- <InstallablePackageComp
- description={description}
- isInstalled={isInstalled}
- link={link}
- pkg={pkg}
- />
- </Row>
- );
- })}
- {extraPackages.map((extraPkg: ExtraPackage) => {
+ <div style={text} role="list" aria-label="Remotion packages">
+ {installablePackages.map(([pkgShort], index) => {
+ const pkg =
+ pkgShort === 'core' ? 'remotion' : `@remotion/${pkgShort}`;
+ const isInstalled =
+ window.remotion_installedPackages?.includes(pkg) ?? false;
+ const link = apiDocs[pkgShort as Pkgs];
+ const description = descriptions[pkgShort as Pkgs];
+ if (!link) {
+ throw new Error('No link for ' + pkg);
+ }
+
+ if (!description) {
+ throw new Error('No description for ' + pkg);
+ }
+
+ return (
+ <Row
+ key={pkg}
+ align="center"
+ role="listitem"
+ style={
+ index === packageCount - 1 ? lastPackageRow : packageRow
+ }
+ >
+ <Checkbox
+ checked={map[pkg]}
+ name={pkg}
+ onChange={() => {
+ setMap((prev) => ({...prev, [pkg]: !prev[pkg]}));
+ }}
+ disabled={!canSelectPackages || isInstalled}
+ />
+ <InstallablePackageComp
+ description={description}
+ isInstalled={isInstalled}
+ link={link}
+ pkg={pkg}
+ />
+ </Row>
+ );
+ })}
+ {extraPackages.map((extraPkg: ExtraPackage, index) => {
const isInstalled =
window.remotion_installedPackages?.includes(extraPkg.name) ??
false;
return (
- <Row key={extraPkg.name} align="center">
+ <Row
+ key={extraPkg.name}
+ align="center"
+ role="listitem"
+ style={
+ installablePackages.length + index === packageCount - 1
+ ? lastPackageRow
+ : packageRow
+ }
+ >
<Checkbox
checked={map[extraPkg.name]}
name={extraPkg.name}
@@ -206,7 +251,6 @@ export const InstallPackageModal: React.FC<{
}}
disabled={!canSelectPackages || isInstalled}
/>
- <Spacing x={1.5} />
<InstallablePackageComp
description={extraPkg.description}
isInstalled={isInstalled}
@@ -219,33 +263,40 @@ export const InstallPackageModal: React.FC<{
</div>
)}
</div>
- <ModalFooterContainer>
- <Row align="center">
- {state.type === 'idle' ? (
- <span style={{color: LIGHT_TEXT, fontSize: 13, lineHeight: 1.2}}>
- This will install {selectedPackages.length} package
- {selectedPackages.length === 1 ? '' : 's'}
- <br />
- {packageManager === null
- ? `in this project, Remotion v${VERSION}`
- : `using ${packageManager}, Remotion v${VERSION}`}
- </span>
- ) : null}
- <Flex />
- <ModalButton onClick={onClick} disabled={disabled}>
- {state.type === 'restarting'
- ? 'Restarting...'
- : state.type === 'installing'
- ? 'Installing...'
- : state.type === 'done'
- ? packageManager === null
- ? 'Done'
- : 'Restart Server'
- : 'Install'}
- {disabled ? null : <ShortcutHint keyToPress="↵" cmdOrCtrl />}
- </ModalButton>
- </Row>
- </ModalFooterContainer>
- </DismissableModal>
+ {footerContainer
+ ? ReactDOM.createPortal(
+ <ModalFooterContainer style={footer}>
+ <Row align="center">
+ {state.type === 'idle' ? (
+ <span
+ style={{color: LIGHT_TEXT, fontSize: 13, lineHeight: 1.2}}
+ >
+ This will install {selectedPackages.length} package
+ {selectedPackages.length === 1 ? '' : 's'}
+ <br />
+ {packageManager === null
+ ? `in this project, Remotion v${VERSION}`
+ : `using ${packageManager}, Remotion v${VERSION}`}
+ </span>
+ ) : null}
+ <Flex />
+ <ModalButton onClick={onClick} disabled={disabled}>
+ {state.type === 'restarting'
+ ? 'Restarting...'
+ : state.type === 'installing'
+ ? 'Installing...'
+ : state.type === 'done'
+ ? packageManager === null
+ ? 'Done'
+ : 'Restart Server'
+ : 'Install'}
+ {disabled ? null : <ShortcutHint keyToPress="↵" cmdOrCtrl />}
+ </ModalButton>
+ </Row>
+ </ModalFooterContainer>,
+ footerContainer,
+ )
+ : null}
+ </div>
);
};
diff --git a/packages/studio/src/components/InstallablePackage.tsx b/packages/studio/src/components/InstallablePackage.tsx
index 2bbe8d67f3..5b12fa5924 100644
--- a/packages/studio/src/components/InstallablePackage.tsx
+++ b/packages/studio/src/components/InstallablePackage.tsx
@@ -1,8 +1,46 @@
import React from 'react';
-import {LIGHT_TEXT, WHITE_HEX} from '../helpers/colors';
+import {LIGHT_TEXT, WHITE} from '../helpers/colors';
const FONT_SIZE = 13;
+const container: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'flex',
+ flex: 1,
+ gap: 10,
+ minWidth: 0,
+};
+
+const packageDetails: React.CSSProperties = {
+ flex: 1,
+ minWidth: 0,
+};
+
+const packageName: React.CSSProperties = {
+ color: WHITE,
+ display: 'block',
+ fontFamily: 'monospace',
+ fontSize: FONT_SIZE,
+ lineHeight: 1.4,
+ overflow: 'hidden',
+ textDecoration: 'none',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+};
+
+const descriptionStyle: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontSize: FONT_SIZE,
+ lineHeight: 1.4,
+};
+
+const status: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontSize: 12,
+ lineHeight: 1.4,
+ whiteSpace: 'nowrap',
+};
+
export const InstallablePackageComp: React.FC<{
readonly isInstalled: boolean;
readonly pkg: string;
@@ -10,32 +48,14 @@ export const InstallablePackageComp: React.FC<{
readonly description: string;
}> = ({isInstalled, pkg, link, description}) => {
return (
- <div
- style={{
- fontSize: FONT_SIZE,
- lineHeight: 1.2,
- paddingBottom: 4,
- paddingTop: 4,
- }}
- >
- <a
- href={link}
- style={{
- fontSize: FONT_SIZE,
- color: WHITE_HEX,
- textDecoration: 'none',
- }}
- target="_blank"
- >
- {pkg}
- </a>{' '}
- {isInstalled ? (
- <span style={{opacity: 0.3, fontSize: 'inherit'}}>(installed)</span>
- ) : null}
- <br />
- <span style={{color: LIGHT_TEXT, fontSize: FONT_SIZE}}>
- {description}
- </span>
+ <div style={container}>
+ <div style={packageDetails}>
+ <a href={link} style={packageName} target="_blank">
+ {pkg}
+ </a>
+ <div style={descriptionStyle}>{description}</div>
+ </div>
+ <span style={status}>{isInstalled ? 'Installed' : 'Not installed'}</span>
</div>
);
};
diff --git a/packages/studio/src/components/KeyboardShortcutsSettings.tsx b/packages/studio/src/components/KeyboardShortcutsSettings.tsx
index 27024fc0e8..df4380b2b5 100644
--- a/packages/studio/src/components/KeyboardShortcutsSettings.tsx
+++ b/packages/studio/src/components/KeyboardShortcutsSettings.tsx
@@ -1,5 +1,6 @@
import type {ConfigUpdate} from '@remotion/studio-shared';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
+import {getBrowserStudioOperations} from '../helpers/browser-studio-operations';
import {
BLACK_ALPHA_60,
BORDER_WHITE_ALPHA_12,
@@ -55,7 +56,7 @@ const lastShortcutRow: React.CSSProperties = {
const actionName: React.CSSProperties = {
color: LIGHT_TEXT,
- fontSize: 13,
+ fontSize: 14,
lineHeight: 1.4,
minWidth: 0,
};
@@ -94,6 +95,7 @@ const alternative: React.CSSProperties = {
export const KeyboardShortcutsSettings: React.FC = () => {
const {error: settingsError, revision, studioRuntimeConfig} = useSettings();
+ const isBrowserStudio = getBrowserStudioOperations() !== null;
const [enabled, setEnabled] = useState<boolean | null>(null);
const [edited, setEdited] = useState(false);
const [syncedRevision, setSyncedRevision] = useState(-1);
@@ -139,7 +141,7 @@ export const KeyboardShortcutsSettings: React.FC = () => {
const ready = studioRuntimeConfig !== null && syncedRevision === revision;
useAutoSaveConfig({
- enabled: ready,
+ enabled: ready && !isBrowserStudio,
onError: setError,
ready,
syncRevision: syncedRevision,
@@ -152,14 +154,18 @@ export const KeyboardShortcutsSettings: React.FC = () => {
return (
<div style={container}>
- <p style={dividerLabel}>General</p>
- <ConfigSelect
- defaultLabel="Enabled"
- name="Keyboard shortcuts"
- onChange={onEnabledChange}
- options={booleanOptions}
- value={enabled}
- />
+ {isBrowserStudio ? null : (
+ <>
+ <p style={dividerLabel}>General</p>
+ <ConfigSelect
+ defaultLabel="Enabled"
+ name="Keyboard shortcuts"
+ onChange={onEnabledChange}
+ options={booleanOptions}
+ value={enabled}
+ />
+ </>
+ )}
{displayedShortcutGroups.map((group, groupIndex) => (
<div key={group.name}>
<p style={shortcutSectionTitle}>{group.name}</p>
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index bc5f83776f..7df3f83a78 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -7,7 +7,6 @@ import {AskAiModal} from './AskAiModal';
import {ConfirmationDialog} from './ConfirmationDialog';
import {EffectPickerModal} from './EffectPickerModal';
import {FixComputedValueModal} from './FixComputedValueModal';
-import {InstallPackageModal} from './InstallPackage';
import {DeleteComposition} from './NewComposition/DeleteComposition';
import {DeleteFolder} from './NewComposition/DeleteFolder';
import {DuplicateComposition} from './NewComposition/DuplicateComposition';
@@ -102,15 +101,17 @@ export const Modals: React.FC<{
{modalContextType && modalContextType.type === 'input-props-override' && (
<OverrideInputPropsModal />
)}
- {!isBrowserStudio &&
- modalContextType &&
- modalContextType.type === 'settings' && (
- <SettingsModal
- key={`${modalContextType.initialTab}-${modalContextType.initialPublicLicenseKey}`}
- initialTab={modalContextType.initialTab}
- initialPublicLicenseKey={modalContextType.initialPublicLicenseKey}
- />
- )}
+ {modalContextType &&
+ modalContextType.type === 'settings' &&
+ (!isBrowserStudio ||
+ modalContextType.initialTab === 'packages' ||
+ modalContextType.initialTab === 'shortcuts') ? (
+ <SettingsModal
+ key={`${modalContextType.initialTab}-${modalContextType.initialPublicLicenseKey}`}
+ initialTab={modalContextType.initialTab}
+ initialPublicLicenseKey={modalContextType.initialPublicLicenseKey}
+ />
+ ) : null}
{modalContextType && modalContextType.type === 'web-render' && (
<WebRenderModalWithLoader {...modalContextType} />
)}
@@ -202,10 +203,6 @@ export const Modals: React.FC<{
{modalContextType && modalContextType.type === 'fix-computed-value' && (
<FixComputedValueModal state={modalContextType} />
)}
- {modalContextType && modalContextType.type === 'install-packages' && (
- <InstallPackageModal packageManager={modalContextType.packageManager} />
- )}
-
{modalContextType && modalContextType.type === 'quick-switcher' && (
<QuickSwitcher
readOnlyStudio={readOnlyStudio}
diff --git a/packages/studio/src/components/SettingsModal.tsx b/packages/studio/src/components/SettingsModal.tsx
index 2b60122af1..f499ec5b07 100644
--- a/packages/studio/src/components/SettingsModal.tsx
+++ b/packages/studio/src/components/SettingsModal.tsx
@@ -1,13 +1,19 @@
import React, {useCallback, useContext, useEffect, useState} from 'react';
+import {
+ canInstallPackages,
+ getBrowserStudioOperations,
+} from '../helpers/browser-studio-operations';
import {AppsIcon} from '../icons/apps';
-import {CertificateIcon} from '../icons/certificate';
import {KeyboardIcon} from '../icons/keyboard';
+import {LicenseIcon} from '../icons/license';
+import {PackageIcon} from '../icons/package';
import {RemotionTriangleIcon} from '../icons/remotion-triangle';
import {SkillsIcon} from '../icons/skills';
import {FilmIcon} from '../icons/video';
import {SetSelectedModalContext} from '../state/modals';
import {DefaultEditorSettings} from './ConfigureDefaultEditorModal';
import {LicenseSettings} from './ConfigureLicenseModal';
+import {InstallPackageSettings} from './InstallPackage';
import {KeyboardShortcutsSettings} from './KeyboardShortcutsSettings';
import {VERTICAL_SCROLLBAR_CLASSNAME} from './Menu/is-menu-item';
import {ModalHeader} from './ModalHeader';
@@ -32,6 +38,7 @@ type SettingsTab =
| 'apps'
| 'rendering'
| 'studio'
+ | 'packages'
| 'shortcuts'
| 'skills'
| 'license';
@@ -46,14 +53,21 @@ const settingsOptionsPanel: React.CSSProperties = {
paddingBottom: 16,
};
+const settingsLeftSidebar: React.CSSProperties = {
+ ...leftSidebar,
+ paddingLeft: 8,
+};
+
const appsIcon: React.CSSProperties = {
...icon,
- height: 20,
- width: 20,
+ flexShrink: 0,
+ height: 24,
+ width: 24,
};
-const appsIconContainer: React.CSSProperties = {
- ...iconContainer,
+const skillsIcon: React.CSSProperties = {
+ ...icon,
+ flexShrink: 0,
height: 20,
width: 20,
};
@@ -70,8 +84,17 @@ export const SettingsModal: React.FC<{
}> = ({initialPublicLicenseKey, initialTab}) => {
const {setSelectedModal} = useContext(SetSelectedModalContext);
const {setPublicLicenseKey} = useSettings();
+ const isBrowserStudio = getBrowserStudioOperations() !== null;
+ const packageManager =
+ window.remotion_packageManager === 'unknown'
+ ? null
+ : window.remotion_packageManager;
+ const showPackages =
+ canInstallPackages() && (isBrowserStudio || packageManager !== null);
const [tab, setTab] = useState<SettingsTab>(initialTab);
const [openedTabs, setOpenedTabs] = useState<SettingsTab[]>([initialTab]);
+ const [packagesFooterContainer, setPackagesFooterContainer] =
+ useState<HTMLDivElement | null>(null);
const dismiss = useCallback(() => {
setSelectedModal(null);
@@ -95,31 +118,35 @@ export const SettingsModal: React.FC<{
<>
<ModalHeader title="Settings" onClose={dismiss} />
<div style={horizontalLayout}>
- <div style={leftSidebar}>
- <VerticalTab
- style={horizontalTab}
- selected={tab === 'rendering'}
- onClick={() => selectTab('rendering')}
- renderIcon={(color) => (
- <div style={iconContainer}>
- <FilmIcon color={color} style={icon} />
- </div>
- )}
- >
- Defaults
- </VerticalTab>
- <VerticalTab
- style={horizontalTab}
- selected={tab === 'studio'}
- onClick={() => selectTab('studio')}
- renderIcon={(color) => (
- <div style={iconContainer}>
- <RemotionTriangleIcon color={color} style={icon} />
- </div>
- )}
- >
- Studio
- </VerticalTab>
+ <div style={settingsLeftSidebar}>
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'rendering'}
+ onClick={() => selectTab('rendering')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <FilmIcon color={color} style={icon} />
+ </div>
+ )}
+ >
+ Defaults
+ </VerticalTab>
+ )}
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'studio'}
+ onClick={() => selectTab('studio')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <RemotionTriangleIcon color={color} style={icon} />
+ </div>
+ )}
+ >
+ Studio
+ </VerticalTab>
+ )}
<VerticalTab
style={horizontalTab}
selected={tab === 'shortcuts'}
@@ -132,43 +159,71 @@ export const SettingsModal: React.FC<{
>
Shortcuts
</VerticalTab>
- <VerticalTab
- style={horizontalTab}
- selected={tab === 'skills'}
- onClick={() => selectTab('skills')}
- renderIcon={(color) => (
- <div style={iconContainer}>
- <SkillsIcon color={color} style={icon} />
- </div>
- )}
- >
- Skills
- </VerticalTab>
- <VerticalTab
- style={horizontalTab}
- selected={tab === 'apps'}
- onClick={() => selectTab('apps')}
- renderIcon={(color) => (
- <div style={appsIconContainer}>
- <AppsIcon color={color} style={appsIcon} />
- </div>
- )}
- >
- Apps
- </VerticalTab>
- <VerticalTab
- style={horizontalTab}
- selected={tab === 'license'}
- onClick={() => selectTab('license')}
- renderIcon={(color) => (
- <div style={iconContainer}>
- <CertificateIcon color={color} style={icon} />
- </div>
- )}
- >
- License
- </VerticalTab>
+ {showPackages ? (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'packages'}
+ onClick={() => selectTab('packages')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <PackageIcon color={color} style={icon} />
+ </div>
+ )}
+ >
+ Packages
+ </VerticalTab>
+ ) : null}
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'skills'}
+ onClick={() => selectTab('skills')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <SkillsIcon color={color} style={skillsIcon} />
+ </div>
+ )}
+ >
+ Skills
+ </VerticalTab>
+ )}
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'apps'}
+ onClick={() => selectTab('apps')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <AppsIcon color={color} style={appsIcon} />
+ </div>
+ )}
+ >
+ Apps
+ </VerticalTab>
+ )}
+ {isBrowserStudio ? null : (
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'license'}
+ onClick={() => selectTab('license')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <LicenseIcon color={color} style={icon} />
+ </div>
+ )}
+ >
+ License
+ </VerticalTab>
+ )}
</div>
+ {openedTabs.includes('packages') ? (
+ <div style={tab === 'packages' ? optionsPanel : hiddenPanel}>
+ <InstallPackageSettings
+ footerContainer={packagesFooterContainer}
+ packageManager={packageManager}
+ />
+ </div>
+ ) : null}
{openedTabs.includes('apps') ? (
<div
style={tab === 'apps' ? settingsOptionsPanel : hiddenPanel}
@@ -218,7 +273,11 @@ export const SettingsModal: React.FC<{
</div>
) : null}
</div>
- <SettingsModalFooter />
+ {tab === 'packages' ? (
+ <div ref={setPackagesFooterContainer} />
+ ) : isBrowserStudio ? null : (
+ <SettingsModalFooter />
+ )}
</>
</DismissableModal>
);
diff --git a/packages/studio/src/helpers/use-menu-structure.tsx b/packages/studio/src/helpers/use-menu-structure.tsx
index 6e627a72d6..b7d999d13c 100644
--- a/packages/studio/src/helpers/use-menu-structure.tsx
+++ b/packages/studio/src/helpers/use-menu-structure.tsx
@@ -409,28 +409,29 @@ export const useMenuStructure = (
subMenu: null,
quickSwitcherLabel: 'Help: Changelog',
},
- browserStudioOperations === null
- ? {
- id: 'settings',
- value: 'settings',
- label: 'Settings...',
- onClick: () => {
- closeMenu();
- setSelectedModal({
- type: 'settings',
- initialTab: 'rendering',
- initialPublicLicenseKey:
- window.remotion_renderDefaults?.publicLicenseKey ?? null,
- });
- },
- type: 'item' as const,
- keyHint: null,
- leftItem: null,
- subMenu: null,
- quickSwitcherLabel: 'Settings...',
- disabled: readOnlyStudio || type !== 'connected',
- }
- : null,
+ {
+ id: 'settings',
+ value: 'settings',
+ label: 'Settings...',
+ onClick: () => {
+ closeMenu();
+ setSelectedModal({
+ type: 'settings',
+ initialTab:
+ browserStudioOperations === null ? 'rendering' : 'shortcuts',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
+ });
+ },
+ type: 'item' as const,
+ keyHint: null,
+ leftItem: null,
+ subMenu: null,
+ quickSwitcherLabel: 'Settings...',
+ disabled:
+ (browserStudioOperations === null && readOnlyStudio) ||
+ type !== 'connected',
+ },
{
id: 'acknowledgements',
value: 'acknowledgements',
@@ -907,11 +908,10 @@ export const useMenuStructure = (
onClick: () => {
closeMenu();
setSelectedModal({
- type: 'install-packages',
- packageManager:
- remotion_packageManager === 'unknown'
- ? null
- : remotion_packageManager,
+ type: 'settings',
+ initialTab: 'packages',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
});
},
type: 'item' as const,
diff --git a/packages/studio/src/icons/license.tsx b/packages/studio/src/icons/license.tsx
new file mode 100644
index 0000000000..fdbf052a06
--- /dev/null
+++ b/packages/studio/src/icons/license.tsx
@@ -0,0 +1,14 @@
+import type {SVGProps} from 'react';
+
+export const LicenseIcon: React.FC<
+ SVGProps<SVGSVGElement> & {readonly color: string}
+> = ({color, ...props}) => {
+ return (
+ <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 -40 512 593">
+ <path
+ fill={color}
+ d="M309.4-7.4L256-40 202.6-7.4 140-8.9 110 46 55.1 76 56.6 138.6 24 192 56.6 245.4 55.1 308 110 338 128 371 128 552.3c1-.4 43.6-18.7 128-54.9 84.4 36.2 127 54.4 128 54.9l0-181.3 18-33 54.9-30-1.5-62.6 32.6-53.4-32.6-53.4 1.5-62.6-54.9-30-30-54.9-62.6 1.5zM160 503.7l0-111.3 42.6-1 53.4 32.6 53.4-32.6 42.6 1 0 111.3-89.7-38.4-6.3-2.7-6.3 2.7-89.7 38.4zM353.3 23.5l20.7 37.8 4.5 8.2c.6 .3 15.9 8.7 46 25.2-.8 34.3-1.2 51.8-1.2 52.5 .3 .5 9.4 15.5 27.3 44.8-17.9 29.3-27 44.3-27.3 44.8 0 .6 .4 18.1 1.2 52.5l-37.8 20.7-8.2 4.5-4.5 8.2-20.7 37.8c-34.3-.8-51.8-1.2-52.5-1.2-.5 .3-15.5 9.4-44.8 27.3-29.3-17.9-44.3-27-44.8-27.3-.6 0-18.1 .4-52.5 1.2-16.5-30.1-24.9-45.5-25.2-46l-8.2-4.5-37.8-20.7c.8-34.3 1.2-51.8 1.2-52.5-.3-.5-9.4-15.5-27.3-44.8 17.9-29.3 27-44.3 27.3-44.8 0-.6-.4-18.1-1.2-52.5 30.1-16.5 45.5-24.9 46-25.2 .3-.6 8.7-15.9 25.2-46 34.3 .8 51.8 1.2 52.5 1.2 .5-.3 15.5-9.4 44.8-27.3 29.3 17.9 44.3 27 44.8 27.3 .6 0 18.1-.4 52.5-1.2zM336 192a80 80 0 1 1 -160 0 80 80 0 1 1 160 0zM256 80a112 112 0 1 0 0 224 112 112 0 1 0 0-224z"
+ />
+ </svg>
+ );
+};
diff --git a/packages/studio/src/icons/package.tsx b/packages/studio/src/icons/package.tsx
new file mode 100644
index 0000000000..afc7bb2e68
--- /dev/null
+++ b/packages/studio/src/icons/package.tsx
@@ -0,0 +1,14 @@
+import type {SVGProps} from 'react';
+
+export const PackageIcon: React.FC<
+ SVGProps<SVGSVGElement> & {readonly color: string}
+> = ({color, ...props}) => {
+ return (
+ <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 -16 512 544">
+ <path
+ fill={color}
+ d="M240.3 25.2L64.5 126.8 256.3 237.5 448.2 126.8 272.3 25.2c-9.9-5.7-22.1-5.7-32 0zM48.5 154.5l0 203c0 11.4 6.1 22 16 27.7l175.8 101.5 0-221.5-191.8-110.8zM272.3 486.8L448.2 385.2c9.9-5.7 16-16.3 16-27.7l0-203-191.8 110.8 0 221.5zM224.3-2.5c19.8-11.4 44.2-11.4 64 0L464.2 99c19.8 11.4 32 32.6 32 55.4l0 203c0 22.9-12.2 44-32 55.4L288.3 514.5c-19.8 11.4-44.2 11.4-64 0L48.5 413c-19.8-11.4-32-32.6-32-55.4l0-203c0-22.9 12.2-44 32-55.4L224.3-2.5z"
+ />
+ </svg>
+ );
+};
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index 7855c67ce5..eae4bc9d84 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -11,11 +11,7 @@ import type {
X264Preset,
} from '@remotion/renderer';
import type {HardwareAccelerationOption} from '@remotion/renderer/client';
-import type {
- CanvasCaptureData,
- PackageManager,
- RenderDefaults,
-} from '@remotion/studio-shared';
+import type {CanvasCaptureData, RenderDefaults} from '@remotion/studio-shared';
import type {
RenderStillOnWebImageFormat,
WebRendererAudioCodec,
@@ -195,7 +191,13 @@ export type ModalState =
}
| {
type: 'settings';
- initialTab: 'apps' | 'rendering' | 'studio' | 'shortcuts' | 'license';
+ initialTab:
+ | 'apps'
+ | 'rendering'
+ | 'studio'
+ | 'packages'
+ | 'shortcuts'
+ | 'license';
initialPublicLicenseKey: string | null;
}
| RenderModalState
@@ -215,10 +217,6 @@ export type ModalState =
context: string;
remotionInteractivitySkillAvailable: boolean;
}
- | {
- type: 'install-packages';
- packageManager: PackageManager | null;
- }
| {
type: 'quick-switcher';
mode: QuickSwitcherMode;