🎥 Make videos programmatically with React
install packages modal
Jonny Burgercefa228aac2c
diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.tsindex 1f4f69975b..a91731bf4a 100644--- a/packages/studio-shared/src/package-info.ts+++ b/packages/studio-shared/src/package-info.ts@@ -164,7 +164,7 @@ export const apiDocs: {[key in Pkgs]: string | null} = {'discord-poster': null,'cli-autocomplete': null,'docusaurus-plugin': null,- 'animation-utils': null,+ 'animation-utils': 'https://www.remotion.dev/docs/animation-utils/','example-without-zod': null,'lambda-go': null,example: null,diff --git a/packages/studio/src/components/InstallPackage.tsx b/packages/studio/src/components/InstallPackage.tsxindex e421b93ee3..6f0bfac87f 100644--- a/packages/studio/src/components/InstallPackage.tsx+++ b/packages/studio/src/components/InstallPackage.tsx@@ -1,5 +1,7 @@-import type {PackageManager} from '@remotion/studio-shared';+import type {PackageManager, Pkgs} from '@remotion/studio-shared';import {+ apiDocs,+ descriptions,listOfInstallableRemotionPackages,type InstallablePackage,} from '@remotion/studio-shared';@@ -12,6 +14,7 @@ import {StudioServerConnectionCtx} from '../helpers/client-id';import {LIGHT_TEXT} from '../helpers/colors';import {useKeybinding} from '../helpers/use-keybinding';import {Checkbox} from './Checkbox';+import {InstallablePackageComp} from './InstallablePackage';import {VERTICAL_SCROLLBAR_CLASSNAME} from './Menu/is-menu-item';import {ModalButton} from './ModalButton';import {ModalFooterContainer} from './ModalFooter';@@ -147,6 +150,17 @@ export const InstallPackageModal: React.FC<{{listOfInstallableRemotionPackages.map((pkg) => {const isInstalled =window.remotion_installedPackages?.includes(pkg) ?? false;+ const link = apiDocs[pkg.replace('@remotion/', '') as Pkgs];+ const description =+ descriptions[pkg.replace('@remotion/', '') 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@@ -158,20 +172,12 @@ export const InstallPackageModal: React.FC<{disabled={!canSelectPackages || isInstalled}/><Spacing x={1.5} />- <div- style={{- color: LIGHT_TEXT,- fontSize: 15,- lineHeight: 1.8,- }}- >- {pkg}{' '}- {isInstalled ? (- <span style={{opacity: 0.3, fontSize: 'inherit'}}>- (installed)- </span>- ) : null}- </div>+ <InstallablePackageComp+ description={description}+ isInstalled={isInstalled}+ link={link}+ pkg={pkg}+ /></Row>);})}@@ -183,8 +189,9 @@ export const InstallPackageModal: React.FC<{{state.type === 'idle' ? (<span style={{color: LIGHT_TEXT, fontSize: 13, lineHeight: 1.2}}>This will install {selectedPackages.length} package- {selectedPackages.length === 1 ? '' : 's'} (v{VERSION}) using{' '}- {packageManager}+ {selectedPackages.length === 1 ? '' : 's'}+ <br />+ using {packageManager}, Remotion v{VERSION}</span>) : null}<Flex />diff --git a/packages/studio/src/components/InstallablePackage.tsx b/packages/studio/src/components/InstallablePackage.tsxnew file mode 100644index 0000000000..88c883ff50--- /dev/null+++ b/packages/studio/src/components/InstallablePackage.tsx@@ -0,0 +1,41 @@+import React from 'react';+import {LIGHT_TEXT, TEXT_COLOR} from '../helpers/colors';++const FONT_SIZE = 13;++export const InstallablePackageComp: React.FC<{+ readonly isInstalled: boolean;+ readonly pkg: string;+ readonly link: string;+ 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: TEXT_COLOR,+ 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>+ );+};diff --git a/packages/studio/src/helpers/colors.ts b/packages/studio/src/helpers/colors.tsindex a2067ea31d..60914030ab 100644--- a/packages/studio/src/helpers/colors.ts+++ b/packages/studio/src/helpers/colors.ts@@ -13,6 +13,7 @@ export const INPUT_BORDER_COLOR_UNHOVERED = 'rgba(0, 0, 0, 0.6)';export const INPUT_BORDER_COLOR_HOVERED = 'rgba(255, 255, 255, 0.05)';export const TIMELINE_BACKGROUND = '#111';export const FAIL_COLOR = '#ff3232';+export const TEXT_COLOR = '#fff';export const WARNING_COLOR = '#f1c40f';export const BLUE = '#0b84f3';export const BLUE_DISABLED = '#284f73';