import { useEffect, useState, useCallback } from 'react' import { Link } from 'react-router-dom' import { LayoutGrid, List, MoreVertical, X, } from 'lucide-react' import { useAuth } from '../context/AuthContext' import api from '../utils/api' import AdminPageNav from '../components/AdminPageNav' import { resolveMediaAssetFileUrl } from '../utils/exerciseMediaUrl' const LC_OPTIONS = [ { value: 'active', label: 'Aktiv' }, { value: 'trash_soft', label: 'Papierkorb (1)' }, { value: 'trash_hidden', label: 'Ausgeblendet (2)' }, { value: 'all', label: 'Alle' }, ] const VIS_OPTIONS = [ { value: 'private', label: 'Privat' }, { value: 'club', label: 'Verein' }, { value: 'official', label: 'Offiziell' }, ] function lcLabel(code) { const o = LC_OPTIONS.find((x) => x.value === code) return o ? o.label : code } function uploaderLabel(it, viewer) { if (!viewer?.show_uploader_meta) return null const n = (it.uploader_name || '').trim() const e = (it.uploader_email || '').trim() if (n) return n if (e) return e return it.uploaded_by_profile_id != null ? `Profil #${it.uploaded_by_profile_id}` : '—' } function MediaThumb({ mediaId, mimeType }) { const url = resolveMediaAssetFileUrl(mediaId) const mime = (mimeType || '').toLowerCase() if (mime.startsWith('video/')) { return (