From 5cd9f3c8c0666eb976ceb85fd93f2167f4d83562 Mon Sep 17 00:00:00 2001 From: Alan Trebugeais Date: Fri, 8 May 2026 12:27:13 +0200 Subject: [PATCH] del: unused components/css like Track, SubRow.. --- .../video-editor/timeline/Item.module.css | 0 .../video-editor/timeline/Subrow.tsx | 17 -------- .../video-editor/timeline/Timeline.module.css | 28 ------------- .../video-editor/timeline/Track.tsx | 39 ------------------- .../components/viewport/TimelineCanvas.tsx | 28 +++++-------- 5 files changed, 10 insertions(+), 102 deletions(-) delete mode 100644 src/components/video-editor/timeline/Item.module.css delete mode 100644 src/components/video-editor/timeline/Subrow.tsx delete mode 100644 src/components/video-editor/timeline/Timeline.module.css delete mode 100644 src/components/video-editor/timeline/Track.tsx diff --git a/src/components/video-editor/timeline/Item.module.css b/src/components/video-editor/timeline/Item.module.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/video-editor/timeline/Subrow.tsx b/src/components/video-editor/timeline/Subrow.tsx deleted file mode 100644 index e16e578d..00000000 --- a/src/components/video-editor/timeline/Subrow.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { cn } from "@/lib/utils"; - -interface SubrowProps { - children: React.ReactNode; -} - -export default function Subrow({ children }: SubrowProps) { - return ( -
- {children} -
- ); -} diff --git a/src/components/video-editor/timeline/Timeline.module.css b/src/components/video-editor/timeline/Timeline.module.css deleted file mode 100644 index 88b1b49c..00000000 --- a/src/components/video-editor/timeline/Timeline.module.css +++ /dev/null @@ -1,28 +0,0 @@ -.scrollArea { - scrollbar-width: thin; - scrollbar-color: hsl(var(--foreground) / 0.25) transparent; -} - -.scrollArea::-webkit-scrollbar { - width: 8px; - height: 8px; - background-color: transparent; -} - -.scrollArea::-webkit-scrollbar-corner { - background-color: transparent; -} - -.scrollArea::-webkit-scrollbar-thumb { - background-color: hsl(var(--foreground) / 0.25); - border-radius: 10px; - border: 2px solid hsl(var(--editor-surface)); -} - -.scrollArea::-webkit-scrollbar-thumb:hover { - background-color: hsl(var(--foreground) / 0.35); -} - -.scrollArea::-webkit-scrollbar-thumb:active { - background-color: hsl(var(--foreground) / 0.45); -} diff --git a/src/components/video-editor/timeline/Track.tsx b/src/components/video-editor/timeline/Track.tsx deleted file mode 100644 index a732b484..00000000 --- a/src/components/video-editor/timeline/Track.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import type { RowDefinition } from "dnd-timeline"; -import { useRow } from "dnd-timeline"; -import type { CSSProperties, ReactNode } from "react"; - -interface TrackProps extends RowDefinition { - children: ReactNode; - hint?: string; - isEmpty?: boolean; - trackStyle?: CSSProperties; -} - -export default function Track({ id, children, hint, isEmpty, trackStyle }: TrackProps) { - const { setNodeRef, rowWrapperStyle, rowStyle, rowSidebarStyle, setSidebarRef } = useRow({ - id, - }); - - return ( -
-
-
- {isEmpty && hint ? ( -
- - {hint} - -
- ) : null} - {children} -
-
- ); -} diff --git a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx index 9499fd87..0fd077c2 100644 --- a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx +++ b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx @@ -8,6 +8,7 @@ import { TIMELINE_AXIS_HEIGHT_PX, } from "../../timelineLayout"; import type { AudioPeaksData } from "../../useAudioPeaks"; +import { isAnnotationTrackRowId, isAudioTrackRowId } from "../../core/rows"; import type { TimelineRenderItem } from "../../model/timelineModel"; import TimelineAxis from "../axis/TimelineAxis"; import PlaybackCursor from "../playhead/PlaybackCursor"; @@ -21,17 +22,13 @@ interface TimelineCanvasProps { onSeek?: (time: number) => void; canPlaceZoomAtMs?: (startMs: number) => boolean; onSelectZoom?: (id: string | null) => void; - onSelectTrim?: (id: string | null) => void; onSelectClip?: (id: string | null) => void; onSelectAnnotation?: (id: string | null) => void; - onSelectSpeed?: (id: string | null) => void; onSelectAudio?: (id: string | null) => void; onAddZoomAtMs?: (startMs: number) => void; selectedZoomId: string | null; - selectedTrimId?: string | null; selectedClipId?: string | null; selectedAnnotationId?: string | null; - selectedSpeedId?: string | null; selectedAudioId?: string | null; selectAllBlocksActive?: boolean; onClearBlockSelection?: () => void; @@ -47,16 +44,12 @@ export default function TimelineCanvas({ onAddZoomAtMs, canPlaceZoomAtMs, onSelectZoom, - onSelectTrim, onSelectClip, onSelectAnnotation, - onSelectSpeed, onSelectAudio, selectedZoomId, - selectedTrimId: _selectedTrimId, selectedClipId, selectedAnnotationId, - selectedSpeedId: _selectedSpeedId, selectedAudioId, selectAllBlocksActive = false, onClearBlockSelection, @@ -80,10 +73,8 @@ export default function TimelineCanvas({ if (!onSeek || videoDurationMs <= 0) return; onSelectZoom?.(null); - onSelectTrim?.(null); onSelectClip?.(null); onSelectAnnotation?.(null); - onSelectSpeed?.(null); onSelectAudio?.(null); onClearBlockSelection?.(); @@ -97,10 +88,8 @@ export default function TimelineCanvas({ [ onSeek, onSelectZoom, - onSelectTrim, onSelectClip, onSelectAnnotation, - onSelectSpeed, onSelectAudio, onClearBlockSelection, videoDurationMs, @@ -110,12 +99,15 @@ export default function TimelineCanvas({ ], ); - const audioRowIds = useMemo( - () => new Set(items.map((item) => item.rowId)).size, - [items], - ); - - const timelineRowCount = Math.max(2, audioRowIds); + const timelineRowCount = useMemo(() => { + const annotationRowIds = new Set(); + const audioRowIds = new Set(); + for (const item of items) { + if (isAnnotationTrackRowId(item.rowId)) annotationRowIds.add(item.rowId); + if (isAudioTrackRowId(item.rowId)) audioRowIds.add(item.rowId); + } + return 2 + annotationRowIds.size + audioRowIds.size; + }, [items]); const timelineRowsMinHeightPx = getTimelineRowsMinHeightPx(timelineRowCount); const timelineContentMinHeightPx = getTimelineContentMinHeightPx(timelineRowCount); const timelineViewportStretchFactor = getTimelineViewportStretchFactor(timelineRowCount);