Skip to content

🎥 Make videos programmatically with React

makes sense

JonnyBurgerb60dab59aef1
diff --git a/packages/studio-shared/src/index.ts b/packages/studio-shared/src/index.ts
index 689b3f8520..ced65f9706 100644
--- a/packages/studio-shared/src/index.ts
+++ b/packages/studio-shared/src/index.ts
@@ -98,7 +98,6 @@ export {
export type {CompletedClientRender} from './render-job';
export {
SCHEMA_FIELD_ROW_HEIGHT,
- UNSUPPORTED_FIELD_ROW_HEIGHT,
getEffectFieldsToShow,
getFieldsToShow,
} from './schema-field-info';
diff --git a/packages/studio-shared/src/schema-field-info.ts b/packages/studio-shared/src/schema-field-info.ts
index 25e9b69edc..b0539aa181 100644
--- a/packages/studio-shared/src/schema-field-info.ts
+++ b/packages/studio-shared/src/schema-field-info.ts
@@ -17,8 +17,7 @@ export type {CodeValues, DragOverrides, SequenceControls};
export type SchemaFieldInfo = {
key: string;
description: string | undefined;
- typeName: 'enum' | 'number' | 'boolean' | 'rotation' | 'translate';
- supported: boolean;
+ typeName: SupportedSchemaType;
rowHeight: number;
fieldSchema: VisibleFieldSchema;
};
@@ -38,15 +37,17 @@ export type AnySchemaFieldInfo =
| EffectSchemaFieldInfo;
export const SCHEMA_FIELD_ROW_HEIGHT = 22;
-export const UNSUPPORTED_FIELD_ROW_HEIGHT = 22;
-const SUPPORTED_SCHEMA_TYPES = new Set([
+const SUPPORTED_SCHEMA_TYPES = [
'number',
'boolean',
'rotation',
'translate',
'enum',
-]);
+ 'hidden',
+] as const;
+
+type SupportedSchemaType = (typeof SUPPORTED_SCHEMA_TYPES)[number];
export const getFieldsToShow = ({
getDragOverrides,
@@ -77,7 +78,10 @@ export const getFieldsToShow = ({
return Object.entries(activeSchema)
.map(([key, fieldSchema]): SequenceSchemaFieldInfo | null => {
const typeName = fieldSchema.type;
- const supported = SUPPORTED_SCHEMA_TYPES.has(typeName);
+ if (SUPPORTED_SCHEMA_TYPES.indexOf(typeName) === -1) {
+ throw new Error(`Unsupported field type: ${typeName}`);
+ }
+
if (typeName === 'hidden') {
return null;
}
@@ -87,10 +91,7 @@ export const getFieldsToShow = ({
key,
description: fieldSchema.description,
typeName,
- supported,
- rowHeight: supported
- ? SCHEMA_FIELD_ROW_HEIGHT
- : UNSUPPORTED_FIELD_ROW_HEIGHT,
+ rowHeight: SCHEMA_FIELD_ROW_HEIGHT,
fieldSchema,
};
})
@@ -113,17 +114,16 @@ export const getEffectFieldsToShow = (
return null;
}
- const supported = SUPPORTED_SCHEMA_TYPES.has(typeName);
+ if (SUPPORTED_SCHEMA_TYPES.indexOf(typeName) === -1) {
+ throw new Error(`Unsupported field type: ${typeName}`);
+ }
return {
kind: 'effect-field',
key,
description: fieldSchema.description,
typeName,
- supported,
- rowHeight: supported
- ? SCHEMA_FIELD_ROW_HEIGHT
- : UNSUPPORTED_FIELD_ROW_HEIGHT,
+ rowHeight: SCHEMA_FIELD_ROW_HEIGHT,
fieldSchema,
effectSchema,
effectIndex,
diff --git a/packages/studio/src/components/Timeline/TimelineSchemaField.tsx b/packages/studio/src/components/Timeline/TimelineSchemaField.tsx
index 0ba67de9c7..b494894e62 100644
--- a/packages/studio/src/components/Timeline/TimelineSchemaField.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSchemaField.tsx
@@ -65,10 +65,6 @@ export const TimelineFieldValue: React.FC<{
? notEditableBackground
: undefined;
- if (!field.supported) {
- return <span style={unsupportedLabel}>unsupported</span>;
- }
-
if (field.typeName === 'number') {
return (
<span style={wrapperStyle}>
diff --git a/packages/studio/src/helpers/timeline-layout.ts b/packages/studio/src/helpers/timeline-layout.ts
index eaa7244c6b..ed0a97a311 100644
--- a/packages/studio/src/helpers/timeline-layout.ts
+++ b/packages/studio/src/helpers/timeline-layout.ts
@@ -24,7 +24,6 @@ export type {
};
export {
SCHEMA_FIELD_ROW_HEIGHT,
- UNSUPPORTED_FIELD_ROW_HEIGHT,
getEffectFieldsToShow,
getFieldsToShow,
} from '@remotion/studio-shared';