import { useEffect, useState, useCallback, useRef, useMemo } from 'react' import { Link } from 'react-router-dom' import { LayoutGrid, List, MoreVertical, X, Globe, Users, Lock, CheckCircle2, Archive, CircleDot, FilePenLine, Copyright, Image, Video, FileText, File, Upload, ScrollText, } from 'lucide-react' import { useAuth } from '../context/AuthContext' import api from '../utils/api' import { activeClubMemberships } from '../utils/activeClub' import { resolveMediaAssetFileUrl } from '../utils/exerciseMediaUrl' import RightsDeclarationDialog from '../components/RightsDeclarationDialog' 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' }, ] const MEDIA_KIND_OPTIONS = [ { value: 'all', label: 'Alle Typen' }, { value: 'image', label: 'Bild' }, { value: 'video', label: 'Video' }, { value: 'pdf', label: 'PDF' }, { value: 'other', label: 'Sonstiges' }, ] const LC_STATUS_LABELS = { active: 'Aktiv', trash_soft: 'Papierkorb (1)', trash_hidden: 'Ausgeblendet (2)', } function visibilityUiLabel(v) { const o = VIS_OPTIONS.find((x) => x.value === (v || '').toLowerCase()) return o ? o.label : v || '—' } function MediaCardScopeStatus({ visibility, lifecycleState }) { const v = (visibility || 'private').toLowerCase() const lc = (lifecycleState || 'active').toLowerCase() const visLabel = visibilityUiLabel(v) const lcLabel = LC_STATUS_LABELS[lc] || lcLabelFromOptions(lc) const tip = `${visLabel} · ${lcLabel}` let VisIcon = Lock if (v === 'official') VisIcon = Globe else if (v === 'club') VisIcon = Users let LcIcon = FilePenLine if (lc === 'active') LcIcon = CheckCircle2 else if (lc === 'archived' || lc === 'trash_hidden') LcIcon = Archive else if (lc === 'in_review' || lc === 'trash_soft') LcIcon = CircleDot return (