Admin: Reiter Matches und Einstellungen, Discord-Embeds, CSTV-Zugang
Der Admin-Bereich bekommt Reiter. Die Discord-Einstellungen liegen unter „Einstellungen“. Meldungen sind als Embeds formatiert, und die Match-Startmeldung enthält den CSTV-Zugang (Passwort und Adresse).
This commit is contained in:
1 parent
301da179ed
commit
be474ee143
6 files changed
+79
-21
No files matched your search
@@ -29,6 +29,7 @@ export default function AdminPage() {
|
||||
const [error, setError] = useState(null);
|
||||
const [notice, setNotice] = useState(null);
|
||||
const [busy, setBusy] = useState(null);
|
||||
const [tab, setTab] = useState('matches');
|
||||
|
||||
const logout = useCallback(() => {
|
||||
api('/admin/logout', { method: 'POST', token }).catch(() => {});
|
||||
@@ -92,17 +93,22 @@ export default function AdminPage() {
|
||||
<button className="btn btn-sm" onClick={logout}>Abmelden</button>
|
||||
</header>
|
||||
|
||||
{token && <NotificationSettings token={token} setNotice={setNotice} />}
|
||||
<nav className="admin-tabs" aria-label="Admin-Bereiche">
|
||||
<button className={`admin-tab ${tab === 'matches' ? 'is-active' : ''}`} onClick={() => setTab('matches')}>Matches</button>
|
||||
<button className={`admin-tab ${tab === 'settings' ? 'is-active' : ''}`} onClick={() => setTab('settings')}>Einstellungen</button>
|
||||
</nav>
|
||||
|
||||
{tab === 'settings' && token && <NotificationSettings token={token} setNotice={setNotice} />}
|
||||
{notice && <div className={`toast toast-${notice.tone}`} role="status">{notice.text}</div>}
|
||||
{error && <div className="alert alert-error">{error}</div>}
|
||||
{matches === null && !error && <p className="muted">Lade Matches …</p>}
|
||||
{matches && matches.length === 0 && <p className="muted">Noch keine Matches.</p>}
|
||||
{tab === 'matches' && matches === null && !error && <p className="muted">Lade Matches …</p>}
|
||||
{tab === 'matches' && matches && matches.length === 0 && <p className="muted">Noch keine Matches.</p>}
|
||||
|
||||
<div className="admin-list">
|
||||
{tab === 'matches' && <div className="admin-list">
|
||||
{matches?.map((m) => (
|
||||
<MatchAdminCard key={m.id} m={m} run={run} busy={busy} token={token} reload={load} setNotice={setNotice} />
|
||||
))}
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user