From 8f583c25e0bf35636ce9355ad08f47fe70e6d18a Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Tue, 24 Jun 2025 22:20:17 +0200 Subject: [PATCH] feat(timeline): add context menu handling to TimelineTrackContent component --- apps/web/src/components/editor/timeline.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 0d02160..76f1bf8 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -933,6 +933,7 @@ export function Timeline() { track={track} zoomLevel={zoomLevel} setContextMenu={setContextMenu} + contextMenu={contextMenu} /> ))} @@ -1117,6 +1118,7 @@ function TimelineTrackContent({ track, zoomLevel, setContextMenu, + contextMenu, }: { track: TimelineTrack; zoomLevel: number; @@ -1129,6 +1131,13 @@ function TimelineTrackContent({ y: number; } | null ) => void; + contextMenu: { + type: "track" | "clip"; + trackId: string; + clipId?: string; + x: number; + y: number; + } | null; }) { const { mediaItems } = useMediaStore(); const { @@ -1715,6 +1724,13 @@ function TimelineTrackContent({ style={{ width: `${clipWidth}px`, left: `${clipLeft}px` }} onClick={(e) => { e.stopPropagation(); + + // Close context menu if it's open + if (contextMenu) { + setContextMenu(null); + return; // Don't handle selection when closing context menu + } + const isSelected = selectedClips.some( (c) => c.trackId === track.id && c.clipId === clip.id );