Skip to content

🎥 Make videos programmatically with React

so sick

Jonny Burgercaee3f9bf448
diff --git a/packages/convert/app/components/PickFile.tsx b/packages/convert/app/components/PickFile.tsx
index f781b56494..6931396031 100644
--- a/packages/convert/app/components/PickFile.tsx
+++ b/packages/convert/app/components/PickFile.tsx
@@ -47,7 +47,7 @@ export const PickFile: React.FC<{
>
<div className="bg-[#F9FAFC] w-full">
<div className="h-10" />
- <TextMarkLogo />
+ <TextMarkLogo text="Remotion Convert" />
<div className="h-5" />
<div className="w-full pb-4">
<h1 className="text-center text-3xl font-brand font-black max-w-[600px] m-auto text-balance px-4">
diff --git a/packages/convert/app/components/TextMarkLogo.tsx b/packages/convert/app/components/TextMarkLogo.tsx
index 6f0fb0e197..de309b1901 100644
--- a/packages/convert/app/components/TextMarkLogo.tsx
+++ b/packages/convert/app/components/TextMarkLogo.tsx
@@ -1,6 +1,8 @@
import React from 'react';
-export const TextMarkLogo: React.FC = () => {
+export const TextMarkLogo: React.FC<{
+ readonly text: string;
+}> = ({text}) => {
return (
<div className="flex flex-row justify-center items-center">
<svg
@@ -29,7 +31,7 @@ export const TextMarkLogo: React.FC = () => {
/>
</svg>
<div className="w-2" />
- <div className="font-bold font-brand text-lg">Remotion Convert</div>
+ <div className="font-bold font-brand text-lg">{text}</div>
</div>
);
};
diff --git a/packages/convert/app/components/get-supported-configs.tsx b/packages/convert/app/components/get-supported-configs.tsx
index b2a560e7bf..bc74379d26 100644
--- a/packages/convert/app/components/get-supported-configs.tsx
+++ b/packages/convert/app/components/get-supported-configs.tsx
@@ -78,6 +78,10 @@ const shouldPrioritizeVideoCopyOverReencode = (routeAction: RouteAction) => {
return false;
}
+ if (routeAction.type === 'timing-editor') {
+ return true;
+ }
+
throw new Error('Unsupported route action' + (routeAction satisfies never));
};
diff --git a/packages/convert/app/components/timing-editor/AnimationDuration.tsx b/packages/convert/app/components/timing-editor/AnimationDuration.tsx
index d38d14dc5b..c23acb06ec 100644
--- a/packages/convert/app/components/timing-editor/AnimationDuration.tsx
+++ b/packages/convert/app/components/timing-editor/AnimationDuration.tsx
@@ -17,17 +17,9 @@ const row: React.CSSProperties = {
export const AnimationDuration: React.FC<{
readonly durationLabel: string;
- readonly setDurationType: React.Dispatch<
- React.SetStateAction<'seconds' | 'frames'>
- >;
-}> = ({durationLabel, setDurationType}) => {
+}> = ({durationLabel}) => {
return (
- <div
- style={row}
- onClick={() => {
- setDurationType((prev) => (prev === 'seconds' ? 'frames' : 'seconds'));
- }}
- >
+ <div style={row}>
<svg height="1em" viewBox="0 0 512 512">
<path
fill="black"
diff --git a/packages/convert/app/components/timing-editor/Canvas.tsx b/packages/convert/app/components/timing-editor/Canvas.tsx
index 59c7a33b07..9064d8cd88 100644
--- a/packages/convert/app/components/timing-editor/Canvas.tsx
+++ b/packages/convert/app/components/timing-editor/Canvas.tsx
@@ -12,15 +12,7 @@ export const Canvas: React.FC<{
readonly duration: number;
readonly fps: number;
readonly replayKey: number;
-}> = ({
- height,
- width,
- components,
- draggedState,
- duration,
- fps,
- replayKey,
-}) => {
+}> = ({height, width, components, draggedState, duration, fps, replayKey}) => {
const canvasRef = useRef<HTMLCanvasElement>(null);
const canvasStyle: React.CSSProperties = useMemo(() => {
@@ -31,14 +23,7 @@ export const Canvas: React.FC<{
};
}, []);
- const [durationType, setDurationType] = React.useState<'seconds' | 'frames'>(
- 'seconds',
- );
-
- const durationLabel =
- durationType === 'seconds'
- ? `${(duration / fps).toFixed(2)}sec`
- : `${Math.round(duration)} frames`;
+ const durationLabel = `${(duration / fps).toFixed(2)}sec`;
useEffect(() => {
if (!canvasRef.current) {
@@ -75,10 +60,7 @@ export const Canvas: React.FC<{
height={height}
style={canvasStyle}
/>
- <AnimationDuration
- setDurationType={setDurationType}
- durationLabel={durationLabel}
- />
+ <AnimationDuration durationLabel={durationLabel} />
</>
);
};
diff --git a/packages/convert/app/components/timing-editor/CodeModal.tsx b/packages/convert/app/components/timing-editor/CodeModal.tsx
index 0d43344d68..97d61d5b6a 100644
--- a/packages/convert/app/components/timing-editor/CodeModal.tsx
+++ b/packages/convert/app/components/timing-editor/CodeModal.tsx
@@ -1,4 +1,4 @@
-import {Button} from '@remotion/design';
+import {Button, InlineCode, Link} from '@remotion/design';
import React, {useEffect, useState} from 'react';
import {codeToHtml} from 'shikiji';
import {
@@ -80,58 +80,84 @@ export const CodeModal: React.FC<{
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <div className="overflow-y-auto max-h-[500px]">
- <DialogContent className="max-w-2xl">
- <DialogHeader>
- <DialogDescription>
- Copy this code into your Remotion project:
- </DialogDescription>
- </DialogHeader>
- <div className="space-y-4">
- {generated.imports ? (
- <div>
- <div className="flex items-center justify-between mb-2">
- <span className="text-sm font-medium text-muted-foreground">
- Imports
- </span>
- <Button
- type="button"
- onClick={() => handleCopy('imports')}
- className="h-7 px-2 text-xs w-[60px]"
- depth={0.5}
- >
- {copied === 'imports' ? 'Copied!' : 'Copy'}
- </Button>
- </div>
- <CodeBlock
- code={generated.imports}
- highlightedHtml={highlightedImports}
- />
- </div>
- ) : null}
-
+ <DialogContent className="max-w-2xl max-h-[80vh] flex flex-col">
+ <DialogHeader>
+ <DialogDescription>
+ Copy this code into your Remotion project:
+ </DialogDescription>
+ </DialogHeader>
+ <div className="space-y-4 overflow-y-auto flex-1 min-h-0">
+ {generated.imports ? (
<div>
- <div className="flex items-center justify-between mb-2">
+ <div className="flex items-center gap-2 mb-2">
<span className="text-sm font-medium text-muted-foreground">
- Code
+ Imports
</span>
<Button
type="button"
- onClick={() => handleCopy('code')}
+ onClick={() => handleCopy('imports')}
className="h-7 px-2 text-xs w-[60px]"
depth={0.5}
>
- {copied === 'code' ? 'Copied!' : 'Copy'}
+ {copied === 'imports' ? 'Copied!' : 'Copy'}
</Button>
</div>
<CodeBlock
- code={generated.code}
- highlightedHtml={highlightedCode}
+ code={generated.imports}
+ highlightedHtml={highlightedImports}
/>
</div>
+ ) : null}
+
+ <div>
+ <div className="flex items-center gap-2 mb-2">
+ <span className="text-sm font-medium text-muted-foreground">
+ Code
+ </span>
+ <Button
+ type="button"
+ onClick={() => handleCopy('code')}
+ className="h-7 px-2 text-xs w-[60px]"
+ depth={0.5}
+ >
+ {copied === 'code' ? 'Copied!' : 'Copy'}
+ </Button>
+ </div>
+ <CodeBlock
+ code={generated.code}
+ highlightedHtml={highlightedCode}
+ />
</div>
- </DialogContent>
- </div>
+ </div>
+ <DialogDescription>
+ <InlineCode>frame</InlineCode> is from the{' '}
+ <Link
+ href="https://www.remotion.dev/docs/use-current-frame"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <InlineCode>useCurrentFrame()</InlineCode>
+ </Link>{' '}
+ hook. <div className="h-[2px]" />
+ <InlineCode>fps</InlineCode> is from the{' '}
+ <Link
+ href="https://www.remotion.dev/docs/use-video-config"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <InlineCode>useVideoConfig()</InlineCode>
+ </Link>{' '}
+ hook. <div className="h-[2px]" />
+ See also:{' '}
+ <Link
+ href="https://www.remotion.dev/docs/animating-properties"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Animating properties
+ </Link>
+ </DialogDescription>
+ </DialogContent>
</Dialog>
);
};
diff --git a/packages/convert/app/components/timing-editor/InterpolateEditor.tsx b/packages/convert/app/components/timing-editor/InterpolateEditor.tsx
index 08b7309434..73932b95dd 100644
--- a/packages/convert/app/components/timing-editor/InterpolateEditor.tsx
+++ b/packages/convert/app/components/timing-editor/InterpolateEditor.tsx
@@ -47,29 +47,37 @@ export const InterpolateEditor: React.FC<{
))}
</select>
<Slider
- min={1}
- max={200}
- value={[config.durationInFrames]}
+ min={0.02}
+ max={3.33}
+ step={0.01}
+ value={[config.durationInFrames / 60]}
onValueChange={(val) => {
- onDragChange({...config, durationInFrames: val[0]});
+ onDragChange({...config, durationInFrames: Math.round(val[0] * 60)});
}}
onPointerUp={onRelease}
/>
<SliderLabel
- label="durationInFrames"
+ label="duration"
+ suffix="s"
toggleable={null}
- value={config.durationInFrames}
+ value={Number((config.durationInFrames / 60).toFixed(2))}
/>
<Slider
min={0}
- max={400}
- value={[config.delay]}
+ max={6.67}
+ step={0.01}
+ value={[config.delay / 60]}
onValueChange={(val) => {
- onDragChange({...config, delay: val[0]});
+ onDragChange({...config, delay: Math.round(val[0] * 60)});
}}
onPointerUp={onRelease}
/>
- <SliderLabel label="delay" toggleable={null} value={config.delay} />
+ <SliderLabel
+ label="delay"
+ suffix="s"
+ toggleable={null}
+ value={Number((config.delay / 60).toFixed(2))}
+ />
</>
);
};
diff --git a/packages/convert/app/components/timing-editor/Sidebar.tsx b/packages/convert/app/components/timing-editor/Sidebar.tsx
index 95a30d1916..ec9027dbf4 100644
--- a/packages/convert/app/components/timing-editor/Sidebar.tsx
+++ b/packages/convert/app/components/timing-editor/Sidebar.tsx
@@ -1,5 +1,6 @@
import {Button} from '@remotion/design';
import React, {useState} from 'react';
+import {TextMarkLogo} from '../TextMarkLogo';
import {CodeModal} from './CodeModal';
import {ReplayIcon} from './ReplayIcon';
import {TimingComponentEditor} from './TimingComponentEditor';
@@ -41,7 +42,7 @@ export const Sidebar: React.FC<{
return (
<div className="p-4 flex flex-col flex-1 w-full md:w-[400px] md:h-full md:flex-none overflow-y-auto">
<div className="flex items-center justify-between mb-4">
- <div className="font-brand font-bold text-xl">Timing Editor</div>
+ <TextMarkLogo text="Timing Editor" />
<div className="flex gap-2">
<Button
type="button"
diff --git a/packages/convert/app/components/timing-editor/SineEditor.tsx b/packages/convert/app/components/timing-editor/SineEditor.tsx
index a31d3e75a3..a30e1fbc4b 100644
--- a/packages/convert/app/components/timing-editor/SineEditor.tsx
+++ b/packages/convert/app/components/timing-editor/SineEditor.tsx
@@ -11,18 +11,20 @@ export const SineEditor: React.FC<{
return (
<>
<Slider
- min={1}
- max={200}
- value={[config.durationInFrames]}
+ min={0.02}
+ max={3.33}
+ step={0.01}
+ value={[config.durationInFrames / 60]}
onValueChange={(val) => {
- onChange({...config, durationInFrames: val[0]});
+ onChange({...config, durationInFrames: Math.round(val[0] * 60)});
}}
onPointerUp={onRelease}
/>
<SliderLabel
- label="durationInFrames"
+ label="duration"
+ suffix="s"
toggleable={null}
- value={config.durationInFrames}
+ value={Number((config.durationInFrames / 60).toFixed(2))}
/>
<Slider
min={0.1}
@@ -56,17 +58,19 @@ export const SineEditor: React.FC<{
/>
<Slider
min={0}
- max={100}
- value={[config.frameOffset]}
+ max={1.67}
+ step={0.01}
+ value={[config.frameOffset / 60]}
onValueChange={(val) => {
- onChange({...config, frameOffset: val[0]});
+ onChange({...config, frameOffset: Math.round(val[0] * 60)});
}}
onPointerUp={onRelease}
/>
<SliderLabel
- label="frameOffset"
+ label="offset"
+ suffix="s"
toggleable={null}
- value={config.frameOffset}
+ value={Number((config.frameOffset / 60).toFixed(2))}
/>
</>
);
diff --git a/packages/convert/app/components/timing-editor/SliderLabel.tsx b/packages/convert/app/components/timing-editor/SliderLabel.tsx
index b5a5867f7c..99870178e5 100644
--- a/packages/convert/app/components/timing-editor/SliderLabel.tsx
+++ b/packages/convert/app/components/timing-editor/SliderLabel.tsx
@@ -17,7 +17,8 @@ export const SliderLabel: React.FC<{
readonly label: string;
readonly value: number | null;
readonly toggleable: null | ((newValue: boolean) => void);
-}> = ({label, value, toggleable}) => {
+ readonly suffix?: string;
+}> = ({label, value, toggleable, suffix}) => {
return (
<div style={row}>
<div style={{flex: 1}}>
@@ -31,7 +32,7 @@ export const SliderLabel: React.FC<{
<label htmlFor={label}>{label}</label>
</div>
<div style={{...valueLabel, opacity: value === null ? 0.5 : 1}}>
- {value ?? 'undefined'}
+ {value !== null ? `${value}${suffix ?? ''}` : 'undefined'}
</div>
</div>
);
diff --git a/packages/convert/app/components/timing-editor/SpringEditor.tsx b/packages/convert/app/components/timing-editor/SpringEditor.tsx
index 7c50f53188..cfc7436c21 100644
--- a/packages/convert/app/components/timing-editor/SpringEditor.tsx
+++ b/packages/convert/app/components/timing-editor/SpringEditor.tsx
@@ -73,26 +73,39 @@ export const SpringEditor: React.FC<{
/>
<Slider
min={0}
- max={400}
- value={[config.delay]}
+ max={6.67}
+ step={0.01}
+ value={[config.delay / 60]}
onValueChange={(val) => {
- onDragChange({...config, delay: val[0]});
+ onDragChange({...config, delay: Math.round(val[0] * 60)});
}}
onPointerUp={onRelease}
/>
- <SliderLabel label="delay" toggleable={null} value={config.delay} />
+ <SliderLabel
+ label="delay"
+ suffix="s"
+ toggleable={null}
+ value={Number((config.delay / 60).toFixed(2))}
+ />
<Slider
- min={1}
- max={200}
- value={[config.durationInFrames ?? calculatedDurationInFrames]}
+ min={0.02}
+ max={3.33}
+ step={0.01}
+ value={[
+ (config.durationInFrames ?? calculatedDurationInFrames) / 60,
+ ]}
style={{opacity: config.durationInFrames === null ? 0.5 : 1}}
onValueChange={(val) => {
- onDragChange({...config, durationInFrames: val[0]});
+ onDragChange({
+ ...config,
+ durationInFrames: Math.round(val[0] * 60),
+ });
}}
onPointerUp={onRelease}
/>
<SliderLabel
- label="durationInFrames"
+ label="duration"
+ suffix="s"
toggleable={(enabled) => {
if (enabled) {
onDragChange({
@@ -103,7 +116,11 @@ export const SpringEditor: React.FC<{
onDragChange({...config, durationInFrames: null});
}
}}
- value={config.durationInFrames ?? null}
+ value={
+ config.durationInFrames !== null
+ ? Number((config.durationInFrames / 60).toFixed(2))
+ : null
+ }
/>
<CheckboxWithLabel
checked={config.springConfig.overshootClamping}
diff --git a/packages/convert/app/components/timing-editor/TimingEditor.tsx b/packages/convert/app/components/timing-editor/TimingEditor.tsx
index 0da3c32439..cf8a5b5ab7 100644
--- a/packages/convert/app/components/timing-editor/TimingEditor.tsx
+++ b/packages/convert/app/components/timing-editor/TimingEditor.tsx
@@ -7,11 +7,10 @@ import {
DEFAULT_SINE_CONFIG,
DEFAULT_SPRING_CONFIG,
} from './defaults';
+import {HARDCODED_FPS} from './generate-code';
import {Sidebar} from './Sidebar';
import type {MixingMode, TimingComponent, TimingConfig} from './types';
-const fps = 60;
-
let nextId = 1;
const generateId = () => `timing-${nextId++}`;
@@ -78,33 +77,13 @@ export function TimingEditor() {
);
}, []);
- const addComponent = useCallback(() => {
- setComponents((prev) => [
- ...prev,
- {id: generateId(), config: DEFAULT_SPRING_CONFIG, mixingMode: 'additive'},
- ]);
- }, []);
-
- const removeComponent = useCallback((componentId: string) => {
- setComponents((prev) => prev.filter((c) => c.id !== componentId));
- }, []);
-
- const onMixingModeChange = useCallback(
- (componentId: string, mode: MixingMode) => {
- setComponents((prev) =>
- prev.map((c) => (c.id === componentId ? {...c, mixingMode: mode} : c)),
- );
- },
- [],
- );
-
const getDuration = (cfg: TimingConfig) => {
if (cfg.type === 'spring') {
return (
cfg.delay +
(cfg.durationInFrames ??
measureSpring({
- fps,
+ fps: HARDCODED_FPS,
threshold: 0.001,
config: cfg.springConfig,
}))
@@ -119,6 +98,34 @@ export function TimingEditor() {
return cfg.durationInFrames;
};
+ const addComponent = useCallback(() => {
+ setComponents((prev) => {
+ // Calculate total duration of existing components
+ const totalDuration = Math.max(...prev.map((c) => getDuration(c.config)));
+ const newConfig = {
+ ...DEFAULT_SPRING_CONFIG,
+ delay: totalDuration,
+ };
+ return [
+ ...prev,
+ {id: generateId(), config: newConfig, mixingMode: 'subtractive'},
+ ];
+ });
+ }, []);
+
+ const removeComponent = useCallback((componentId: string) => {
+ setComponents((prev) => prev.filter((c) => c.id !== componentId));
+ }, []);
+
+ const onMixingModeChange = useCallback(
+ (componentId: string, mode: MixingMode) => {
+ setComponents((prev) =>
+ prev.map((c) => (c.id === componentId ? {...c, mixingMode: mode} : c)),
+ );
+ },
+ [],
+ );
+
// Get current configs (applying dragged state if any)
const currentComponents = components.map((c) => {
if (draggedState && draggedState.componentId === c.id) {
@@ -154,13 +161,13 @@ export function TimingEditor() {
removeComponent={removeComponent}
onMixingModeChange={onMixingModeChange}
/>
- <div className="flex flex-col h-[300px] w-full border-b border-[#242424] md:h-auto md:flex-1 md:border-b-0">
+ <div className="flex flex-col w-full h-auto flex-1 ">
<CanvasWrapper
components={components}
draggedState={draggedState}
draggedDuration={draggedDuration}
duration={duration}
- fps={fps}
+ fps={HARDCODED_FPS}
replayKey={replayKey}
/>
<div className="hidden md:flex flex-row justify-center">
diff --git a/packages/convert/app/components/timing-editor/draw.ts b/packages/convert/app/components/timing-editor/draw.ts
index 34f10bb435..9edc43abf6 100644
--- a/packages/convert/app/components/timing-editor/draw.ts
+++ b/packages/convert/app/components/timing-editor/draw.ts
@@ -174,12 +174,12 @@ export const draw = ({
// Draw 0 line if it's within range but not already drawn as min or max
if (min < 0 && max > 0) {
- const zeroY = getYForValue(0);
- context.beginPath();
- context.moveTo(PADDING_LEFT, zeroY);
- context.lineTo(lineEndX, zeroY);
- context.stroke();
- context.closePath();
+ drawAxisLine(0);
+ }
+
+ // Draw 1 line if it's within range but not already drawn as min or max
+ if (min < 1 && max > 1) {
+ drawAxisLine(1);
}
const toStop: (() => void)[] = [];
diff --git a/packages/convert/app/components/timing-editor/generate-code.ts b/packages/convert/app/components/timing-editor/generate-code.ts
index 39109a24b1..54f9264972 100644
--- a/packages/convert/app/components/timing-editor/generate-code.ts
+++ b/packages/convert/app/components/timing-editor/generate-code.ts
@@ -1,5 +1,13 @@
import type {EasingType, TimingComponent} from './types';
+export const HARDCODED_FPS = 60;
+
+const framesToFpsExpr = (frames: number): string => {
+ const seconds = frames / HARDCODED_FPS;
+ const rounded = Number(seconds.toFixed(2));
+ return `${rounded} * fps`;
+};
+
const getEasingCode = (easing: EasingType): string => {
switch (easing) {
case 'linear':
@@ -85,11 +93,11 @@ const generateSpringCode = (
}
if (durationInFrames !== null) {
- lines.push(` durationInFrames: ${durationInFrames},`);
+ lines.push(` durationInFrames: ${framesToFpsExpr(durationInFrames)},`);
}
if (delay > 0) {
- lines.push(` delay: ${delay},`);
+ lines.push(` delay: ${framesToFpsExpr(delay)},`);
}
if (reverse) {
@@ -112,12 +120,12 @@ const generateInterpolateCode = (
const {easing, durationInFrames, delay} = component.config;
const easingCode = getEasingCode(easing);
- const frameExpr = delay > 0 ? `frame - ${delay}` : 'frame';
+ const frameExpr = delay > 0 ? `frame - ${framesToFpsExpr(delay)}` : 'frame';
const lines: string[] = [
`const ${varName} = interpolate(`,
` ${frameExpr},`,
- ` [0, ${durationInFrames}],`,
+ ` [0, ${framesToFpsExpr(durationInFrames)}],`,
' [0, 1],',
' {',
` easing: ${easingCode},`,
@@ -138,12 +146,14 @@ const generateSineCode = (
throw new Error('Expected sine config');
}
- const {durationInFrames, amplitude, frequency, frameOffset} = component.config;
+ const {durationInFrames, amplitude, frequency, frameOffset} =
+ component.config;
- const frameExpr = frameOffset !== 0 ? `(frame + ${frameOffset})` : 'frame';
+ const frameExpr =
+ frameOffset !== 0 ? `(frame + ${framesToFpsExpr(frameOffset)})` : 'frame';
const amplitudeStr = amplitude !== 1 ? `${amplitude} * ` : '';
- return `const ${varName} = ${amplitudeStr}Math.sin((2 * Math.PI * ${frequency} * ${frameExpr}) / ${durationInFrames});`;
+ return `const ${varName} = ${amplitudeStr}Math.sin((2 * Math.PI * ${frequency} * ${frameExpr}) / ${framesToFpsExpr(durationInFrames)});`;
};
export type GeneratedCode = {
@@ -160,7 +170,9 @@ export const generateCode = (components: TimingComponent[]): GeneratedCode => {
}
const hasSpring = components.some((c) => c.config.type === 'spring');
- const hasInterpolate = components.some((c) => c.config.type === 'interpolate');
+ const hasInterpolate = components.some(
+ (c) => c.config.type === 'interpolate',
+ );
const needsEasing =
hasInterpolate &&
components.some(
@@ -206,7 +218,7 @@ export const generateCode = (components: TimingComponent[]): GeneratedCode => {
// Generate total line with mixing modes
let totalExpr = varNames[0];
for (let i = 1; i < components.length; i++) {
- const mixingMode = components[i].mixingMode;
+ const {mixingMode} = components[i];
const operator = mixingMode === 'subtractive' ? '-' : '+';
totalExpr += ` ${operator} ${varNames[i]}`;
}
diff --git a/packages/convert/app/lib/default-ui.ts b/packages/convert/app/lib/default-ui.ts
index 416972a12d..f0f589dd9d 100644
--- a/packages/convert/app/lib/default-ui.ts
+++ b/packages/convert/app/lib/default-ui.ts
@@ -57,6 +57,10 @@ export const defaultRotateOrMirorState = (
return 'crop';
}
+ if (action.type === 'timing-editor') {
+ return null;
+ }
+
throw new Error(
'Rotate is not enabled by default ' + (action satisfies never),
);
@@ -115,6 +119,10 @@ export const isConvertEnabledByDefault = (action: RouteAction) => {
return true;
}
+ if (action.type === 'timing-editor') {
+ return true;
+ }
+
throw new Error(
'Convert is not enabled by default ' + (action satisfies never),
);
@@ -190,7 +198,8 @@ export const getOrderOfSections = (
action.type === 'generic-resize' ||
action.type === 'resize-format' ||
action.type === 'report' ||
- action.type === 'transcribe'
+ action.type === 'transcribe' ||
+ action.type === 'timing-editor'
) {
return {
resize: 0,
diff --git a/packages/design/src/InlineCode.tsx b/packages/design/src/InlineCode.tsx
new file mode 100644
index 0000000000..d3975a33c7
--- /dev/null
+++ b/packages/design/src/InlineCode.tsx
@@ -0,0 +1,5 @@
+export const InlineCode: React.FC<{
+ readonly children: React.ReactNode;
+}> = ({children}) => {
+ return <code className="font-brand text-brand">{children}</code>;
+};
diff --git a/packages/design/src/Link.tsx b/packages/design/src/Link.tsx
new file mode 100644
index 0000000000..4223fa3ed1
--- /dev/null
+++ b/packages/design/src/Link.tsx
@@ -0,0 +1,16 @@
+import React from 'react';
+import {cn} from './helpers/cn';
+
+export const Link: React.FC<React.AnchorHTMLAttributes<HTMLAnchorElement>> = ({
+ className,
+ ...props
+}) => {
+ return (
+ <a
+ {...props}
+ className={cn(className, 'text-brand underline underline-offset-4')}
+ >
+ {props.children}
+ </a>
+ );
+};
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index 258b7e65a9..0e6bfc8bfa 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -2,7 +2,9 @@ export {Button} from './Button';
export {Card} from './Card';
export {CheckIcon} from './CheckIcon';
export {Counter} from './Counter';
+export {InlineCode} from './InlineCode';
export {Input} from './Input';
+export {Link} from './Link';
export {PlanePaperIcon} from './PaperPlaneIcon';
export {
Select,