"use client"; import { useElementSelection } from "@/hooks/timeline/element/use-element-selection"; import { TimelineElement } from "./timeline-element"; import type { TimelineTrack } from "@/lib/timeline"; import type { TimelineElement as TimelineElementType } from "@/lib/timeline"; import type { SnapPoint } from "@/lib/timeline/snap-utils"; import { TIMELINE_LAYERS } from "./layers"; import { BASE_TIMELINE_PIXELS_PER_SECOND } from "@/lib/timeline/scale"; import { useEdgeAutoScroll } from "@/hooks/timeline/use-edge-auto-scroll"; import type { ElementDragState } from "@/lib/timeline"; import { useEditor } from "@/hooks/use-editor"; interface TimelineTrackContentProps { track: TimelineTrack; zoomLevel: number; dragState: ElementDragState; rulerScrollRef: React.RefObject; tracksScrollRef: React.RefObject; lastMouseXRef: React.RefObject; onSnapPointChange?: (snapPoint: SnapPoint | null) => void; onResizeStateChange?: (params: { isResizing: boolean }) => void; onElementMouseDown: (params: { event: React.MouseEvent; element: TimelineElementType; track: TimelineTrack; }) => void; onElementClick: (params: { event: React.MouseEvent; element: TimelineElementType; track: TimelineTrack; }) => void; onTrackMouseDown?: (event: React.MouseEvent) => void; onTrackMouseUp?: (event: React.MouseEvent) => void; shouldIgnoreClick?: () => boolean; targetElementId?: string | null; } export function TimelineTrackContent({ track, zoomLevel, dragState, rulerScrollRef, tracksScrollRef, lastMouseXRef, onSnapPointChange, onResizeStateChange, onElementMouseDown, onElementClick, onTrackMouseDown, onTrackMouseUp, shouldIgnoreClick, targetElementId = null, }: TimelineTrackContentProps) { const { isElementSelected } = useElementSelection(); const duration = useEditor((e) => e.timeline.getTotalDuration()); useEdgeAutoScroll({ isActive: dragState.isDragging, getMouseClientX: () => lastMouseXRef.current ?? 0, rulerScrollRef, tracksScrollRef, contentWidth: duration * BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevel, }); return (