"use client"; import { useTimelineStore } from "@/stores/timeline-store"; import { useMediaStore } from "@/stores/media-store"; import { ImageTimelineTreatment } from "@/components/ui/image-timeline-treatment"; import { Button } from "@/components/ui/button"; import { Play, Pause } from "lucide-react"; import { useState } from "react"; export function PreviewPanel() { const { tracks } = useTimelineStore(); const { mediaItems } = useMediaStore(); const [isPlaying, setIsPlaying] = useState(false); // Get the first clip from the first track for preview (simplified for now) const firstClip = tracks[0]?.clips[0]; const firstMediaItem = firstClip ? 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 (
Drop media here or click to import
); } if (firstMediaItem.type === "image") { return ( ); } if (firstMediaItem.type === "video") { return firstMediaItem.thumbnailUrl ? ( {firstMediaItem.name} ) : (
Video Preview
); } if (firstMediaItem.type === "audio") { return (
🎵

{firstMediaItem.name}

); } return null; }; return (
1 ? "100%" : "auto", height: aspectRatio <= 1 ? "100%" : "auto", maxWidth: "100%", maxHeight: "100%", }} > {renderPreviewContent()} {/* Playback Controls Overlay */} {firstMediaItem && (
{firstClip?.name || "No clip selected"}
)}
{/* Preview Info */} {firstMediaItem && (

Preview: {firstMediaItem.name} {firstMediaItem.type === "image" && " (with CapCut-style treatment)"}
Aspect Ratio: {aspectRatio.toFixed(2)} ( {aspectRatio > 1 ? "Landscape" : aspectRatio < 1 ? "Portrait" : "Square"} )

)}
); }