🎥 Make videos programmatically with React
fix lint + formatting
Hunain Ahmed759e3be2beb3
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.tsindex 1fdd32e76b..7d3a63c9b3 100644--- a/packages/bundler/src/bundle.ts+++ b/packages/bundler/src/bundle.ts@@ -94,7 +94,7 @@ export const getConfig = ({bufferStateDelayInMilliseconds,poll: null,experimentalClientSideRenderingEnabled,- AskAIEnabled: false+ AskAIEnabled: false,});};diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.tsindex 06b56292f2..8c66ca80cc 100644--- a/packages/bundler/src/webpack-config.ts+++ b/packages/bundler/src/webpack-config.ts@@ -54,7 +54,7 @@ export const webpackConfig = async ({bufferStateDelayInMilliseconds,poll,experimentalClientSideRenderingEnabled,- AskAIEnabled+ AskAIEnabled,}: {entry: string;userDefinedComponent: string;@@ -68,7 +68,7 @@ export const webpackConfig = async ({bufferStateDelayInMilliseconds: number | null;remotionRoot: string;poll: number | null;- AskAIEnabled: boolean,+ AskAIEnabled: boolean;experimentalClientSideRenderingEnabled: boolean;}): Promise<[string, WebpackConfiguration]> => {const esbuildLoaderOptions: LoaderOptions = {diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.tsindex effac3506d..5f368e4ad0 100644--- a/packages/cli/src/config/index.ts+++ b/packages/cli/src/config/index.ts@@ -493,12 +493,10 @@ declare global {disallowParallelEncoding: boolean,) => void;- /**+ /*** disables the Ask AI Modal in Studio*/- readonly setAskAIEnabled: (- AskAIEnabled: boolean,- ) => void;+ readonly setAskAIEnabled: (AskAIEnabled: boolean) => void;/*** Removes the --single-process flag that gets passed todiff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.tsindex 0a6a1a9946..a56a6684a5 100644--- a/packages/cli/src/studio.ts+++ b/packages/cli/src/studio.ts@@ -36,7 +36,7 @@ const {publicDirOption,disableGitSourceOption,enableCrossSiteIsolationOption,- AskAIOption+ AskAIOption,} = BrowserSafeApis.options;export const studioCommand = async (@@ -129,8 +129,8 @@ export const studioCommand = async (}).value;const AskAIEnabled = AskAIOption.getValue({- commandLine: parsedCli- }).value+ commandLine: parsedCli,+ }).value;const gitSource = getGitSource({remotionRoot, disableGitSource, logLevel});@@ -170,7 +170,7 @@ export const studioCommand = async (forceIPv4: parsedCli.ipv4,audioLatencyHint: parsedCli['audio-latency-hint'],enableCrossSiteIsolation,- AskAIEnabled+ AskAIEnabled,});// If the server is restarted through the UI, let's do the whole thing again.diff --git a/packages/renderer/src/options/ask-ai.tsx b/packages/renderer/src/options/ask-ai.tsxindex 23512e37fc..192c5676f3 100644--- a/packages/renderer/src/options/ask-ai.tsx+++ b/packages/renderer/src/options/ask-ai.tsx@@ -5,30 +5,31 @@ let AskAIEnabled = true;const cliFlag = 'disable-ask-ai' as const;export const AskAIOption = {- name: 'Disable or Enable the Ask AI option',- cliFlag,- description: () => (- <>- If the Cmd + I shortcut of the Ask AI modal conflicts with your studio, you can disable it using this.- </>- ),- ssrName: null,- docLink: 'https://www.remotion.dev/docs/config#setaskaienabled',- type: false as boolean,- getValue: ({commandLine}) => {- if (commandLine[cliFlag] !== undefined) {- return {- value: commandLine[cliFlag] as boolean,- source: 'cli',- };- }+ name: 'Disable or Enable the Ask AI option',+ cliFlag,+ description: () => (+ <>+ If the Cmd + I shortcut of the Ask AI modal conflicts with your studio,+ you can disable it using this.+ </>+ ),+ ssrName: null,+ docLink: 'https://www.remotion.dev/docs/config#setaskaienabled',+ type: false as boolean,+ getValue: ({commandLine}) => {+ if (commandLine[cliFlag] !== undefined) {+ return {+ value: commandLine[cliFlag] as boolean,+ source: 'cli',+ };+ }- return {- value: AskAIEnabled,- source: 'config',- };- },- setConfig(value) {- AskAIEnabled = value;- },+ return {+ value: AskAIEnabled,+ source: 'config',+ };+ },+ setConfig(value) {+ AskAIEnabled = value;+ },} satisfies AnyRemotionOption<boolean>;diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsxindex 9040658016..af36cba43a 100644--- a/packages/renderer/src/options/index.tsx+++ b/packages/renderer/src/options/index.tsx@@ -1,4 +1,5 @@import {apiKeyOption} from './api-key';+import {AskAIOption} from './ask-ai';import {audioBitrateOption} from './audio-bitrate';import {audioCodecOption} from './audio-codec';import {beepOnFinishOption} from './beep-on-finish';@@ -9,7 +10,6 @@ import {crfOption} from './crf';import {enableCrossSiteIsolationOption} from './cross-site-isolation';import {darkModeOption} from './dark-mode';import {deleteAfterOption} from './delete-after';-import {AskAIOption} from './ask-ai';import {disableGitSourceOption} from './disable-git-source';import {disallowParallelEncodingOption} from './disallow-parallel-encoding';import {enableLambdaInsights} from './enable-lambda-insights';@@ -100,7 +100,7 @@ export const allOptions = {mediaCacheSizeInBytesOption,darkModeOption,publicLicenseKeyOption,- AskAIOption+ AskAIOption,};export type AvailableOptions = keyof typeof allOptions;diff --git a/packages/studio-server/src/preview-server/start-server.ts b/packages/studio-server/src/preview-server/start-server.tsindex 06d68dd316..546cbfee19 100644--- a/packages/studio-server/src/preview-server/start-server.ts+++ b/packages/studio-server/src/preview-server/start-server.ts@@ -44,7 +44,7 @@ export const startServer = async (options: {forceIPv4: boolean;audioLatencyHint: AudioContextLatencyCategory | null;enableCrossSiteIsolation: boolean;- AskAIEnabled: boolean+ AskAIEnabled: boolean;}): Promise<{port: number;liveEventsServer: LiveEventsServer;@@ -63,7 +63,7 @@ export const startServer = async (options: {options.experimentalClientSideRenderingEnabled,poll: options.poll,bufferStateDelayInMilliseconds: options.bufferStateDelayInMilliseconds,- AskAIEnabled: options.AskAIEnabled+ AskAIEnabled: options.AskAIEnabled,});const compiler = webpack(config);diff --git a/packages/studio-server/src/start-studio.ts b/packages/studio-server/src/start-studio.tsindex 5960c9b300..4d1155bb1c 100644--- a/packages/studio-server/src/start-studio.ts+++ b/packages/studio-server/src/start-studio.ts@@ -82,7 +82,7 @@ export const startStudio = async ({forceIPv4,audioLatencyHint,enableCrossSiteIsolation,- AskAIEnabled+ AskAIEnabled,}: {browserArgs: string;browserFlag: string;@@ -111,7 +111,7 @@ export const startStudio = async ({gitSource: GitSource | null;binariesDirectory: string | null;forceIPv4: boolean;- AskAIEnabled: boolean+ AskAIEnabled: boolean;}) => {try {if (typeof Bun === 'undefined') {@@ -185,7 +185,7 @@ export const startStudio = async ({forceIPv4,audioLatencyHint,enableCrossSiteIsolation,- AskAIEnabled+ AskAIEnabled,});const cleanupLiveEventsListener = setLiveEventsListener(liveEventsServer);diff --git a/packages/studio/src/components/GlobalKeybindings.tsx b/packages/studio/src/components/GlobalKeybindings.tsxindex e4c760bf9b..16f0336094 100644--- a/packages/studio/src/components/GlobalKeybindings.tsx+++ b/packages/studio/src/components/GlobalKeybindings.tsx@@ -44,17 +44,19 @@ export const GlobalKeybindings: React.FC = () => {commandCtrlKey: true,preventDefault: true,});- const cmdIKey = process.env.ASK_AI_ENABLED ? keybindings.registerKeybinding({- event: 'keydown',- key: 'i',- callback: () => {- askAiModalRef.current?.toggle();- },- triggerIfInputFieldFocused: true,- keepRegisteredWhenNotHighestContext: true,- commandCtrlKey: true,- preventDefault: true,- }) : null;+ const cmdIKey = process.env.ASK_AI_ENABLED+ ? keybindings.registerKeybinding({+ event: 'keydown',+ key: 'i',+ callback: () => {+ askAiModalRef.current?.toggle();+ },+ triggerIfInputFieldFocused: true,+ keepRegisteredWhenNotHighestContext: true,+ commandCtrlKey: true,+ preventDefault: true,+ })+ : null;const cKey = keybindings.registerKeybinding({event: 'keypress',diff --git a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx b/packages/studio/src/components/KeyboardShortcutsExplainer.tsxindex 9f00fd4a3c..7ecc4c3184 100644--- a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx+++ b/packages/studio/src/components/KeyboardShortcutsExplainer.tsx@@ -298,20 +298,20 @@ export const KeyboardShortcutsExplainer: React.FC = () => {</div><div style={right}>Save</div></Row>- { process.env.ASK_AI_ENABLED &&- <>- <br />- <div style={title}>AI</div>- <Row align="center">- <div style={left}>- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>- <Spacing x={0.3} />- <kbd style={key}>I</kbd>- </div>- <div style={right}>Ask AI</div>- </Row>- </>- }+ {process.env.ASK_AI_ENABLED && (+ <>+ <br />+ <div style={title}>AI</div>+ <Row align="center">+ <div style={left}>+ <kbd style={key}>{cmdOrCtrlCharacter}</kbd>+ <Spacing x={0.3} />+ <kbd style={key}>I</kbd>+ </div>+ <div style={right}>Ask AI</div>+ </Row>+ </>+ )}</Column></Row></div>diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsxindex 7f3abce283..691ef6db03 100644--- a/packages/studio/src/components/Modals.tsx+++ b/packages/studio/src/components/Modals.tsx@@ -152,7 +152,7 @@ export const Modals: React.FC<{initialMode={modalContextType.mode}/>)}- { process.env.ASK_AI_ENABLED && <AskAiModal />}+ {process.env.ASK_AI_ENABLED && <AskAiModal />}</>);};diff --git a/packages/studio/src/helpers/use-menu-structure.tsx b/packages/studio/src/helpers/use-menu-structure.tsxindex 922230a993..69f39a30e5 100644--- a/packages/studio/src/helpers/use-menu-structure.tsx+++ b/packages/studio/src/helpers/use-menu-structure.tsx@@ -667,20 +667,22 @@ export const useMenuStructure = (label: 'Tools',leaveLeftPadding: false,items: [- process.env.ASK_AI_ENABLED ? {- id: 'ask-ai',- value: 'ask-ai',- label: 'Ask AI',- onClick: () => {- closeMenu();- askAiModalRef.current?.toggle();- },- leftItem: null,- keyHint: `${cmdOrCtrlCharacter}+I`,- subMenu: null,- type: 'item' as const,- quickSwitcherLabel: 'Ask AI',- } : null,+ process.env.ASK_AI_ENABLED+ ? {+ id: 'ask-ai',+ value: 'ask-ai',+ label: 'Ask AI',+ onClick: () => {+ closeMenu();+ askAiModalRef.current?.toggle();+ },+ leftItem: null,+ keyHint: `${cmdOrCtrlCharacter}+I`,+ subMenu: null,+ type: 'item' as const,+ quickSwitcherLabel: 'Ask AI',+ }+ : null,'EyeDropper' in window? {id: 'color-picker',