import { useEffect } from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Camera, X } from 'lucide-react'; import { PhotoType } from '@/types/sale'; interface CameraModalProps { isOpen: boolean; photoType: PhotoType | null; videoRef: React.RefObject; canvasRef: React.RefObject; isCapturing: boolean; onClose: () => void; onCapture: () => void; } export default function CameraModal({ isOpen, photoType, videoRef, canvasRef, isCapturing, onClose, onCapture }: CameraModalProps) { useEffect(() => { if (isOpen && videoRef.current) { // Ensure video starts playing when modal opens videoRef.current.play().catch(console.error); } }, [isOpen, videoRef]); return ( Photo {photoType ? photoType.charAt(0).toUpperCase() + photoType.slice(1) : ''}
); }