import { useEffect } from 'react'; import { X, Download } from 'lucide-react'; import { Button } from './Button'; import { api } from '../api/client'; interface QRCodeModalProps { archiveId: number; archiveName: string; onClose: () => void; } export function QRCodeModal({ archiveId, archiveName, onClose }: QRCodeModalProps) { const qrCodeUrl = api.getArchiveQRCodeUrl(archiveId, 300); // Close on Escape key useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', handleKeyDown); return () => window.removeEventListener('keydown', handleKeyDown); }, [onClose]); const handleDownload = () => { const link = document.createElement('a'); link.href = qrCodeUrl; link.download = `${archiveName}_qrcode.png`; link.click(); }; return (
e.stopPropagation()} > {/* Header */}

QR Code

{/* Content */}

{archiveName}

QR Code

Scan to open this archive

); }