import React, { useState, useEffect } from 'react'; import { Loader2, Download, Film } from 'lucide-react'; import { apiJson } from '../lib/api'; // The signed-in user's saved video library (stored in R2). Private, signed links. export default function HistoryTab() { const [videos, setVideos] = useState(null); const [error, setError] = useState(''); useEffect(() => { apiJson('/api/history') .then((d) => setVideos(d.videos || [])) .catch(() => setError('Could not load your library.')); }, []); const fmtDate = (iso) => (iso ? new Date(iso).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }) : ''); if (videos === null && !error) { return
06 ยท HISTORY
All the shorts you've generated, saved while your plan is active. Kept for 7 days after your plan ends.
{error &&{error}
} {videos && videos.length === 0 && (No videos yet. Generate your first short from the Clip Generator.
{v.title || 'Short'}