import React, { useState } from 'react'; import axios from 'axios'; import { Loader2, Video, Play, Film } from 'lucide-react'; import { useAuth } from '../AuthContext'; interface VideoGeneratorProps { project: any; onVideoGenerated: () => void; } const VIDEO_PRESETS = [ { id: 'cinematic_pan', label: 'Cinematic Pan', icon: '↔️', description: 'Slow horizontal pan across the artwork' }, { id: 'slow_zoom', label: 'Slow Zoom', icon: '🔍', description: 'Gentle zoom in to highlight details' }, { id: 'windy_atmosphere', label: 'Windy Atmosphere', icon: '🍃', description: 'Subtle movement suggesting a breeze' }, { id: 'page_flip', label: 'Page Flip (Conceptual)', icon: '📖', description: 'Simulated page turning effect' }, ]; export const VideoGenerator: React.FC = ({ project, onVideoGenerated }) => { const [generating, setGenerating] = useState(false); const [selectedPreset, setSelectedPreset] = useState(null); const [error, setError] = useState(null); const { refreshUser } = useAuth(); const handleGenerate = async () => { if (!selectedPreset) return; setGenerating(true); setError(null); try { const token = localStorage.getItem('token'); const apiKey = localStorage.getItem('gemini_api_key'); await axios.post( `/api/projects/${project.id}/video-mockups`, { presetId: selectedPreset }, { headers: { Authorization: `Bearer ${token}`, 'X-Gemini-API-Key': apiKey || '' } } ); onVideoGenerated(); setSelectedPreset(null); await refreshUser(); } catch (err: any) { console.error("Video generation failed:", err); const msg = err.response?.data?.error || "Failed to generate video"; if (err.response?.status === 402) alert(`⚠️ ${msg}`); setError(msg); } finally { setGenerating(false); } }; return (

Video Studio (Beta)

Transform static designs into cinematic video mockups

{VIDEO_PRESETS.map((preset) => ( ))}
{error && (
{error}
)}
); };