'use client' // ============================================================================= // QRCodeModal — extracted from DocumentUploadSection for LOC compliance // ============================================================================= import { useEffect, useState } from 'react' import { QRIcon, CloseIcon } from './DocumentUploadIcons' interface QRModalProps { isOpen: boolean onClose: () => void sessionId: string onFileUploaded?: (file: File) => void } export function QRCodeModal({ isOpen, onClose, sessionId }: QRModalProps) { const [uploadUrl, setUploadUrl] = useState('') const [qrCodeUrl, setQrCodeUrl] = useState(null) useEffect(() => { if (!isOpen) return let baseUrl = typeof window !== 'undefined' ? window.location.origin : '' // Hostname to IP mapping for local network const hostnameToIP: Record = { 'macmini': '192.168.178.100', 'macmini.local': '192.168.178.100', } Object.entries(hostnameToIP).forEach(([hostname, ip]) => { if (baseUrl.includes(hostname)) { baseUrl = baseUrl.replace(hostname, ip) } }) // Force HTTP for mobile access (SSL cert is for hostname, not IP) // This is safe because it's only used on the local network if (baseUrl.startsWith('https://')) { baseUrl = baseUrl.replace('https://', 'http://') } const uploadPath = `/upload/sdk/${sessionId}` const fullUrl = `${baseUrl}${uploadPath}` setUploadUrl(fullUrl) const qrApiUrl = `https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${encodeURIComponent(fullUrl)}` setQrCodeUrl(qrApiUrl) }, [isOpen, sessionId]) const copyToClipboard = async () => { try { await navigator.clipboard.writeText(uploadUrl) } catch (err) { console.error('Copy failed:', err) } } if (!isOpen) return null return (

Mit Handy hochladen

QR-Code scannen

{qrCodeUrl ? ( QR Code ) : (
)}

Scannen Sie den Code mit Ihrem Handy,
um Dokumente hochzuladen.

Oder Link teilen:

Hinweis: Ihr Handy muss im gleichen Netzwerk sein.

) }