import React, { useState, useCallback } from 'react' import { useDropzone } from 'react-dropzone' import { Upload, Trash2, ExternalLink, X, FileText, FileImage, File, MapPin, Ticket } from 'lucide-react' import { useToast } from '../shared/Toast' import { useTranslation } from '../../i18n' function isImage(mimeType) { if (!mimeType) return false return mimeType.startsWith('image/') // covers jpg, png, gif, webp, etc. } function getFileIcon(mimeType) { if (!mimeType) return File if (mimeType === 'application/pdf') return FileText if (isImage(mimeType)) return FileImage return File } function formatSize(bytes) { if (!bytes) return '' if (bytes < 1024) return `${bytes} B` if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB` return `${(bytes / 1024 / 1024).toFixed(1)} MB` } function formatDateWithLocale(dateStr, locale) { if (!dateStr) return '' try { return new Date(dateStr).toLocaleDateString(locale, { day: '2-digit', month: '2-digit', year: 'numeric' }) } catch { return '' } } // Image lightbox function ImageLightbox({ file, onClose }) { const { t } = useTranslation() return (
) } // Source badge — unified style for both place and reservation function SourceBadge({ icon: Icon, label }) { return ({files.length === 1 ? t('files.countSingular') : t('files.count', { count: files.length })}
{t('files.dropzone')}
{t('files.dropzoneHint')}
> )}{t('files.empty')}
{t('files.emptyHint')}
{file.description}
)}