import { useRef, useState } from "react"; import "../../styles/ImageUploadModal.css"; export default function ImageUploadModal({ itemName, onConfirm, onSkip, onCancel }) { const [selectedImage, setSelectedImage] = useState(null); const [imagePreview, setImagePreview] = useState(null); const cameraInputRef = useRef(null); const galleryInputRef = useRef(null); const handleImageChange = (e) => { const file = e.target.files[0]; if (file) { setSelectedImage(file); const reader = new FileReader(); reader.onloadend = () => { setImagePreview(reader.result); }; reader.readAsDataURL(file); } }; const removeImage = () => { setSelectedImage(null); setImagePreview(null); }; const handleConfirm = () => { onConfirm(selectedImage); }; const handleCancel = () => { if (onCancel) { onCancel(); } }; const handleCameraClick = () => { cameraInputRef.current?.click(); }; const handleGalleryClick = () => { galleryInputRef.current?.click(); }; return (
e.stopPropagation()}>

Add Image for "{itemName}"

This is a new item. Would you like to add a verification image?

{!imagePreview ? (
) : (
Preview
)}
); }