import React, { useState, useEffect, useCallback } from 'react' import { Link } from 'react-router-dom' import api from '../utils/api' import { notifyOrgInboxChanged, useOrgInbox } from '../context/OrgInboxContext' const CLUB_ROLE_OPTIONS = [ { code: 'club_admin', label: 'Vereinsadmin' }, { code: 'trainer', label: 'Trainer' }, { code: 'division_lead', label: 'Spartenleitung' }, { code: 'content_editor', label: 'Inhalte bearbeiten' }, ] function formatWhen(iso) { if (!iso) return '' const s = String(iso) const d = s.includes('T') ? s.split('T')[0] : s.slice(0, 10) const t = s.includes('T') ? s.split('T')[1] : '' const time = t ? t.slice(0, 5) : '' return time ? `${d} · ${time}` : d } export default function InboxPage() { const { canAccessOrgInbox, refreshOrgInbox, inboxJoinRequests } = useOrgInbox() const [loading, setLoading] = useState(true) const [acceptModal, setAcceptModal] = useState(null) const load = useCallback(async () => { if (!canAccessOrgInbox) { setLoading(false) return } setLoading(true) try { await refreshOrgInbox() } finally { setLoading(false) } }, [canAccessOrgInbox, refreshOrgInbox]) useEffect(() => { load() }, [load]) if (!canAccessOrgInbox) { return (
Kein Zugriff. Nur Plattform-Admins und Vereinsadmins sehen den Posteingang.
Zur Übersicht
Offene Beitrittsanträge zu Vereinen, für die du zuständig bist.
Keine offenen Beitrittsanträge.
{req.message}
: null}{acceptModal.label}