From e6c6193638e4247ff1e6f2df40de2a057112c773 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 26 Apr 2026 03:06:13 +0200 Subject: [PATCH] fix: linter --- .../timeline/components/timeline-element.tsx | 33 +++++++++++-------- .../timeline/hooks/use-timeline-playhead.ts | 6 ++-- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/apps/web/src/timeline/components/timeline-element.tsx b/apps/web/src/timeline/components/timeline-element.tsx index e0eeb378..d85288b1 100644 --- a/apps/web/src/timeline/components/timeline-element.tsx +++ b/apps/web/src/timeline/components/timeline-element.tsx @@ -49,7 +49,12 @@ import { import { buildWaveformGainSamples } from "@/timeline/audio-state"; import { getTimelinePixelsPerSecond } from "@/timeline"; import { buildWaveformSourceKey } from "@/media/waveform-summary"; -import { addMediaTime, TICKS_PER_SECOND, ZERO_MEDIA_TIME } from "@/wasm"; +import { + addMediaTime, + type MediaTime, + TICKS_PER_SECOND, + ZERO_MEDIA_TIME, +} from "@/wasm"; import { getActionDefinition, type TAction, @@ -96,7 +101,7 @@ const PixelsPerSecondContext = createContext(null); const THUMBNAIL_ASPECT_RATIO = 16 / 9; interface KeyframeIndicator { - time: number; + time: MediaTime; offsetPx: number; keyframes: SelectedKeyframeRef[]; } @@ -112,11 +117,11 @@ export function buildKeyframeIndicator({ keyframe: ElementKeyframe; trackId: string; elementId: string; - displayedStartTime: number; + displayedStartTime: MediaTime; zoomLevel: number; elementLeft: number; }): { - time: number; + time: MediaTime; offsetPx: number; keyframeRef: SelectedKeyframeRef; } { @@ -149,7 +154,7 @@ export function getKeyframeIndicators({ keyframes: ElementKeyframe[]; trackId: string; elementId: string; - displayedStartTime: number; + displayedStartTime: MediaTime; zoomLevel: number; elementLeft: number; elementWidth: number; @@ -158,7 +163,7 @@ export function getKeyframeIndicators({ return []; } - const keyframesByTime = new Map(); + const keyframesByTime = new Map(); for (const keyframe of keyframes) { const indicator = buildKeyframeIndicator({ keyframe, @@ -662,7 +667,7 @@ function KeyframeIndicators({ }: { indicators: KeyframeIndicator[]; dragState: KeyframeDragState; - displayedStartTime: number; + displayedStartTime: MediaTime; elementLeft: number; onKeyframeMouseDown: (params: { event: React.MouseEvent; @@ -672,13 +677,13 @@ function KeyframeIndicators({ event: React.MouseEvent; keyframes: SelectedKeyframeRef[]; orderedKeyframes: SelectedKeyframeRef[]; - indicatorTime: number; + indicatorTime: MediaTime; }) => void; getVisualOffsetPx: (params: { - indicatorTime: number; + indicatorTime: MediaTime; indicatorOffsetPx: number; isBeingDragged: boolean; - displayedStartTime: number; + displayedStartTime: MediaTime; elementLeft: number; }) => number; }) { @@ -756,7 +761,7 @@ function ExpandedKeyframeLanes({ keyframes: ElementKeyframe[]; trackId: string; elementId: string; - displayedStartTime: number; + displayedStartTime: MediaTime; zoomLevel: number; elementLeft: number; keyframeDragState: KeyframeDragState; @@ -777,13 +782,13 @@ function ExpandedKeyframeLanes({ event: React.MouseEvent; keyframes: SelectedKeyframeRef[]; orderedKeyframes: SelectedKeyframeRef[]; - indicatorTime: number; + indicatorTime: MediaTime; }) => void; getVisualOffsetPx: (params: { - indicatorTime: number; + indicatorTime: MediaTime; indicatorOffsetPx: number; isBeingDragged: boolean; - displayedStartTime: number; + displayedStartTime: MediaTime; elementLeft: number; }) => number; }) { diff --git a/apps/web/src/timeline/hooks/use-timeline-playhead.ts b/apps/web/src/timeline/hooks/use-timeline-playhead.ts index 6fbf2147..0ec39f69 100644 --- a/apps/web/src/timeline/hooks/use-timeline-playhead.ts +++ b/apps/web/src/timeline/hooks/use-timeline-playhead.ts @@ -102,7 +102,7 @@ export function useTimelinePlayhead({ ) as MediaTime; const shouldSnap = snappingEnabled && !isShiftHeldRef.current; - const time = (() => { + const time: MediaTime = (() => { if (!shouldSnap) return frameTime; const tracks = editor.scenes.getActiveScene().tracks; const bookmarks = editor.scenes.getActiveScene()?.bookmarks ?? []; @@ -118,7 +118,9 @@ export function useTimelinePlayhead({ snapPoints, maxSnapDistance: getTimelineSnapThresholdInTicks({ zoomLevel }), }); - return snapResult.snapPoint ? snapResult.snappedTime : frameTime; + return snapResult.snapPoint + ? (snapResult.snappedTime as MediaTime) + : frameTime; })(); scrubTimeRef.current = time;