From 9e761a9c0b005da948b296ac0c2054ac4e0bf574 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Tue, 24 Jun 2025 13:58:38 +0200 Subject: [PATCH] style: clean up timeline --- apps/web/src/components/editor/timeline.tsx | 117 +++++++++++++------- 1 file changed, 74 insertions(+), 43 deletions(-) diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 9dec5bb..f1dd04a 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -524,17 +524,24 @@ export function Timeline() { onClick={toggle} className="mr-2" > - {isPlaying ? : } + {isPlaying ? ( + + ) : ( + + )} - {isPlaying ? "Pause (Space)" : "Play (Space)"} + + {isPlaying ? "Pause (Space)" : "Play (Space)"} +
{/* Time Display */}
- {Math.floor(currentTime * 10) / 10}s / {Math.floor(duration * 10) / 10}s + {Math.floor(currentTime * 10) / 10}s /{" "} + {Math.floor(duration * 10) / 10}s
@@ -606,7 +613,11 @@ export function Timeline() { - @@ -710,17 +721,19 @@ export function Timeline() { return (
{(() => { const formatTime = (seconds: number) => { @@ -762,18 +775,8 @@ export function Timeline() { {/* Tracks Area */}
{/* Track Labels */} -
- {tracks.length === 0 ? ( -
-
- -
-

No tracks

-

- Drop media to create tracks -

-
- ) : ( + {tracks.length > 0 && ( +
{tracks.map((track) => (
{ e.preventDefault(); setContextMenu({ - type: 'track', + type: "track", trackId: track.id, x: e.clientX, y: e.clientY, @@ -795,8 +798,8 @@ export function Timeline() { track.type === "video" ? "bg-blue-500" : track.type === "audio" - ? "bg-green-500" - : "bg-purple-500" + ? "bg-green-500" + : "bg-purple-500" }`} /> @@ -811,12 +814,16 @@ export function Timeline() {
))}
- )} -
+
+ )} {/* Timeline Tracks Content */}
-
+
{/* Timeline grid and clips area (with left margin for sidebar) */}
{ e.preventDefault(); setContextMenu({ - type: 'track', + type: "track", trackId: track.id, x: e.clientX, y: e.clientY, @@ -893,19 +900,23 @@ export function Timeline() { style={{ left: contextMenu.x, top: contextMenu.y }} onContextMenu={(e) => e.preventDefault()} > - {contextMenu.type === 'track' ? ( + {contextMenu.type === "track" ? ( // Track context menu <>