🎥 Make videos programmatically with React
fix(studio): widen timeline field labels and drop layout tests
Jonny Burger9a931205d791
diff --git a/packages/studio/src/components/Timeline/timeline-row-layout.ts b/packages/studio/src/components/Timeline/timeline-row-layout.tsindex 9ec64537d5..3b8a3ff40c 100644--- a/packages/studio/src/components/Timeline/timeline-row-layout.ts+++ b/packages/studio/src/components/Timeline/timeline-row-layout.ts@@ -3,6 +3,7 @@ import {TIMELINE_INDENT} from './timeline-indent';export const TIMELINE_ROW_BASE_PADDING = 5;export const TIMELINE_EYE_COLUMN_WIDTH = 22;export const TIMELINE_ARROW_COLUMN_WIDTH = 16;+export const TIMELINE_FIELD_LABEL_EXTRA_WIDTH = 15;export const getTimelineRowIndentWidth = (depth: number): number => {return depth * TIMELINE_INDENT;@@ -18,7 +19,7 @@ export const getTimelineRowLeftChromeWidth = (depth: number): number => {};export const getTimelineFieldLabelFlexBasis = (depth: number): string => {- return `calc(50% - ${getTimelineRowLeftChromeWidth(depth)}px)`;+ return `calc(50% - ${getTimelineRowLeftChromeWidth(depth) - TIMELINE_FIELD_LABEL_EXTRA_WIDTH}px)`;};export const getExpandedRowDepth = ({diff --git a/packages/studio/src/test/timeline-tree-layout.test.ts b/packages/studio/src/test/timeline-tree-layout.test.tsdeleted file mode 100644index d99b0a4e40..0000000000--- a/packages/studio/src/test/timeline-tree-layout.test.ts+++ /dev/null@@ -1,144 +0,0 @@-import {expect, test} from 'bun:test';-import type {- SequenceNodePath,- SequencePropsSubscriptionKey,- TSequence,-} from 'remotion';-import {- getExpandedRowDepth,- getTimelineFieldLabelFlexBasis,- getTimelineRowIndentWidth,- getTimelineRowLeftChromeWidth,-} from '../components/Timeline/timeline-row-layout';-import type {SequenceNodePathInfo} from '../helpers/get-timeline-sequence-sort-key';-import {- buildTimelineTree,- flattenVisibleTreeNodes,-} from '../helpers/timeline-layout';--const makeSubscriptionKey = (- nodePath: SequenceNodePath,-): SequencePropsSubscriptionKey => ({- absolutePath: '/project/src/Comp.tsx',- nodePath,- sequenceKeys: ['from', 'durationInFrames'],- effectKeys: [],-});--const nodePathInfo: SequenceNodePathInfo = {- sequenceSubscriptionKey: makeSubscriptionKey(['Composition', 'Sequence']),- auxiliaryKeys: [],- index: 0,- numberOfSequencesWithThisNodePath: 1,-};--const makeSequence = (): TSequence => ({- from: 0,- duration: 100,- id: 'seq-1',- displayName: 'HtmlInCanvas',- parent: null,- rootId: 'seq-1',- showInTimeline: true,- type: 'sequence',- nonce: [[0, 0]],- getStack: () => null,- premountDisplay: null,- postmountDisplay: null,- loopDisplay: undefined,- controls: {- overrideId: 'test',- schema: {- translate: {- type: 'translate',- description: 'Translate',- default: '0px 0px',- },- },- currentRuntimeValueDotNotation: {},- },- effects: [- {- label: 'Halftone',- schema: {- color: {- type: 'color',- description: 'Color',- default: '#ffffff',- },- },- },- ] as unknown as TSequence['effects'],-});--test('effect field auxiliaryKeys include effect path', () => {- const tree = buildTimelineTree({- sequence: makeSequence(),- nodePathInfo,- getDragOverrides: () => ({}),- codeValues: {},- });-- const effectsGroup = tree.find(- (n) => n.kind === 'group' && n.label === 'Effects',- );- expect(effectsGroup?.kind).toBe('group');- if (effectsGroup?.kind !== 'group') {- throw new Error('expected Effects group');- }-- const halftone = effectsGroup.children[0];- expect(halftone.kind).toBe('group');- if (halftone.kind !== 'group') {- throw new Error('expected Halftone group');- }-- const colorField = halftone.children[0];- expect(colorField.kind).toBe('field');- if (colorField.kind !== 'field') {- throw new Error('expected Color field');- }-- expect(colorField.nodePathInfo.auxiliaryKeys).toEqual([- 'effects',- '0',- 'color',- ]);-});--test('flattenVisibleTreeNodes assigns increasing tree depth', () => {- const tree = buildTimelineTree({- sequence: makeSequence(),- nodePathInfo,- getDragOverrides: () => ({}),- codeValues: {},- });-- const flat = flattenVisibleTreeNodes({- nodes: tree,- getIsExpanded: () => true,- });-- expect(flat.map(({node, depth}) => ({label: node.label, depth}))).toEqual([- {label: 'Translate', depth: 0},- {label: 'Effects', depth: 0},- {label: 'Halftone', depth: 1},- {label: 'Color', depth: 2},- ]);-});--test('getExpandedRowDepth combines composition and tree depth', () => {- expect(- getExpandedRowDepth({- nestedDepth: 1,- treeDepth: 2,- }),- ).toBe(4);- expect(getTimelineRowIndentWidth(4)).toBe(40);-});--test('getTimelineFieldLabelFlexBasis subtracts left chrome width', () => {- expect(getTimelineRowLeftChromeWidth(0)).toBe(43);- expect(getTimelineRowLeftChromeWidth(4)).toBe(83);- expect(getTimelineFieldLabelFlexBasis(4)).toBe('calc(50% - 83px)');-});