"use client"; import { useTimelineStore } from "@/stores/timeline-store"; import { useMediaStore } from "@/stores/media-store"; import { usePlaybackStore } from "@/stores/playback-store"; import { ImageTimelineTreatment } from "@/components/ui/image-timeline-treatment"; import { VideoPlayer } from "@/components/ui/video-player"; import { Button } from "@/components/ui/button"; import { Play, Pause } from "lucide-react"; export function PreviewPanel() { const { tracks } = useTimelineStore(); const { mediaItems } = useMediaStore(); const { isPlaying, toggle } = usePlaybackStore(); const firstClip = tracks[0]?.clips[0]; const firstMediaItem = firstClip ? mediaItems.find((item) => item.id === firstClip.mediaId) : null; const aspectRatio = firstMediaItem?.aspectRatio || 16 / 9; const renderContent = () => { if (!firstMediaItem) { return (
Drop media to start editing
); } if (firstMediaItem.type === "video") { return ( ); } if (firstMediaItem.type === "image") { return ( ); } if (firstMediaItem.type === "audio") { return (
🎵

{firstMediaItem.name}

); } return null; }; return (
1 ? "100%" : "auto", height: aspectRatio <= 1 ? "100%" : "auto", maxWidth: "100%", maxHeight: "100%", }} > {renderContent()}
{firstMediaItem && (

{firstMediaItem.name}

{aspectRatio.toFixed(2)} • {aspectRatio > 1 ? "Landscape" : aspectRatio < 1 ? "Portrait" : "Square"}

)}
); }