import { useState } from 'react'; import { X, Download, Pencil } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useModelStore } from '@/stores/useModelStore'; import { AnnotationEditor } from '@/components/AnnotationEditor'; export function ScreenshotGallery() { const { screenshots, removeScreenshot, clearScreenshots, addScreenshot } = useModelStore(); const [editingIndex, setEditingIndex] = useState(null); if (screenshots.length === 0 && editingIndex === null) return null; const handleSaveAnnotated = (dataUrl: string) => { if (editingIndex !== null) { // Replace the original screenshot with the annotated version useModelStore.setState((state) => ({ screenshots: state.screenshots.map((s, i) => (i === editingIndex ? dataUrl : s)), })); setEditingIndex(null); } }; return ( <>

Capturas ({screenshots.length})

{screenshots.map((src, i) => (
{`Captura
#{i + 1}
))}
{editingIndex !== null && screenshots[editingIndex] && ( setEditingIndex(null)} /> )} ); }