import { motion } from 'framer-motion'; import { getClipDownloadUrl } from '../api/client'; export default function DownloadGrid({ sessionId, clips }) { const completedClips = clips.filter(c => c.status === 'done'); const failedClips = clips.filter(c => c.status === 'error'); const downloadAll = () => { // Download each clip completedClips.forEach((clip, i) => { setTimeout(() => { const link = document.createElement('a'); link.href = getClipDownloadUrl(clip.clip_id); link.download = `viral_clip_${i + 1}.mp4`; document.body.appendChild(link); link.click(); document.body.removeChild(link); }, i * 1000); // Stagger downloads }); }; return (
🎉

Your Viral Clips Are Ready!

{completedClips.length} clip{completedClips.length !== 1 ? 's' : ''} generated successfully {failedClips.length > 0 && ` • ${failedClips.length} failed`}

{/* Download All Button */} {completedClips.length > 1 && (
)} {/* Clip Cards Grid */}
{clips.map((clip, i) => ( {/* Thumbnail / Preview */}
{clip.status === 'done' ? '🎬' : clip.status === 'error' ? '❌' : '⏳'} {/* Duration badge */}
{clip.duration?.toFixed(0)}s
{/* Virality score badge */}
🔥 {clip.virality_score?.toFixed(0)}
{/* Card Info */}

{clip.title || `Viral Clip ${i + 1}`}

⏱️ {clip.duration?.toFixed(1)}s 1080×1920 60fps
{/* Actions */} {clip.status === 'done' ? (
⬇️ Download MP4
) : clip.status === 'error' ? (
Generation failed
) : (
Processing...
)} ))}
{/* Start Over */}
); }