import React, { useState } from 'react'; import { Loader2, AlertCircle, ImageIcon, X } from 'lucide-react'; import { resolveFileUrl } from '../../resolveFileUrl'; // ----------------------------------------------------------------------------- // Component // ----------------------------------------------------------------------------- /** * Horizontal rail of scene chips, similar to Imagine's variation chips. * Shows scene thumbnails with status indicators - clean, minimal design. */ export function SceneChips({ scenes, activeIndex, onSelect, onDelete, className = '' }) { const [hoveredIdx, setHoveredIdx] = useState(null); if (scenes.length === 0) return null; const handleDeleteClick = (e, idx) => { e.stopPropagation(); e.preventDefault(); // Use confirm dialog for clarity if (window.confirm(`Delete scene ${idx + 1}? This cannot be undone.`)) { console.log('[SceneChips] Deleting scene:', idx); onDelete?.(idx); } }; return (
{scenes.map((scene) => { const isActive = scene.idx === activeIndex; const hasThumb = Boolean(scene.thumbnailUrl); const isHovered = hoveredIdx === scene.idx; const showDelete = onDelete && isHovered && scenes.length > 1; return (
setHoveredIdx(scene.idx)} onMouseLeave={() => setHoveredIdx(null)}> {/* Delete Button */} {showDelete && ()}
); })}
); } // ----------------------------------------------------------------------------- // Sub-components // ----------------------------------------------------------------------------- function StatusIndicator({ status }) { switch (status) { case 'generating': return (
); case 'ready': // Ready state - no indicator needed (clean look) return null; case 'error': return (
); case 'pending': default: return (
); } } export default SceneChips;