'use client'; import { QrCode, X } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; const ModalQrCode = ({ isOpen, onClose, onScan }) => { const inputRef = useRef(null); const [tempValue, setTempValue] = useState(''); useEffect(() => { if (isOpen && inputRef.current) { inputRef.current.focus(); } }, [isOpen]); const handleKeyDown = (e) => { if (e.key === 'Enter') { e.preventDefault(); onScan(tempValue); setTempValue(''); onClose(); } }; if (!isOpen) return null; return (