From 7e3a80eb74af23a36cfff43aa61175e1630222e1 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 22 Jun 2025 22:10:50 +0200 Subject: improve lots of stuff around the editor --- apps/web/src/components/editor/preview-panel.tsx | 28 +++++++++++++++++++++--- apps/web/src/components/editor/timeline.tsx | 23 +++++++------------ 2 files changed, 33 insertions(+), 18 deletions(-) (limited to 'apps/web/src/components/editor') diff --git a/apps/web/src/components/editor/preview-panel.tsx b/apps/web/src/components/editor/preview-panel.tsx index 488e1fc9..16c808f4 100644 --- a/apps/web/src/components/editor/preview-panel.tsx +++ b/apps/web/src/components/editor/preview-panel.tsx @@ -18,6 +18,9 @@ export function PreviewPanel() { ? mediaItems.find((item) => item.id === firstClip.mediaId) : null; + // Calculate dynamic aspect ratio - default to 16:9 if no media + const aspectRatio = firstMediaItem?.aspectRatio || 16 / 9; + const renderPreviewContent = () => { if (!firstMediaItem) { return ( @@ -32,7 +35,7 @@ export function PreviewPanel() { @@ -68,8 +71,17 @@ export function PreviewPanel() { }; return ( -
-
+
+
1 ? "100%" : "auto", + height: aspectRatio <= 1 ? "100%" : "auto", + maxWidth: "100%", + maxHeight: "100%", + }} + > {renderPreviewContent()} {/* Playback Controls Overlay */} @@ -103,6 +115,16 @@ export function PreviewPanel() { Preview: {firstMediaItem.name} {firstMediaItem.type === "image" && " (with CapCut-style treatment)"} +
+ + Aspect Ratio: {aspectRatio.toFixed(2)} ( + {aspectRatio > 1 + ? "Landscape" + : aspectRatio < 1 + ? "Portrait" + : "Square"} + ) +

)} diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index 2e23bfba..4ae42660 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -472,19 +472,12 @@ function TimelineTrackComponent({ track }: { track: TimelineTrack }) { if (mediaItem.type === "image") { return ( -
-
- -
- - {clip.name} - +
+ {mediaItem.name}
); } @@ -536,9 +529,9 @@ function TimelineTrackComponent({ track }: { track: TimelineTrack }) { track.clips.map((clip, index) => (
handleClipDragStart(e, clip)} -- cgit v1.3.1