From 60535d60f012097a29159477245f0f851658e9f9 Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Sat, 19 Sep 2026 06:41:32 +0200 Subject: [PATCH] Rework dashboard with stat cards, role/Discord badges and upcoming raids Adds an at-a-glance overview (active raids, own signups, member and role counts) plus a next-raids table, all built from the existing Lumina panel/stat-card/badge components. Co-Authored-By: Claude Sonnet 5 --- dashboard.php | 150 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/dashboard.php b/dashboard.php index 26a2716..73b7201 100644 --- a/dashboard.php +++ b/dashboard.php @@ -1,21 +1,169 @@ prepare( + 'SELECT r.name FROM roles r JOIN user_roles ur ON ur.role_id = r.id WHERE ur.user_id = ? ORDER BY r.name' +); +$roleStmt->execute([$user['id']]); +$roleNames = array_column($roleStmt->fetchAll(), 'name'); + +$upcomingRaids = []; +$myActiveSignups = 0; +$raidsError = null; +if ($canViewRaids) { + try { + $upcomingRaids = fetch_raids('active'); + usort($upcomingRaids, static fn (array $a, array $b): int + => ($a['timestamp'] ?? PHP_INT_MAX) <=> ($b['timestamp'] ?? PHP_INT_MAX)); + + foreach ($upcomingRaids as &$raid) { + $signups = is_array($raid['signups'] ?? null) ? $raid['signups'] : []; + $raid['_my_signup'] = null; + foreach ($signups as $signup) { + if ($discordId && (string) ($signup['user_id'] ?? '') === (string) $discordId && (int) ($signup['group'] ?? 0) >= 0) { + $raid['_my_signup'] = $signup; + break; + } + } + if ($raid['_my_signup']) { + $myActiveSignups++; + } + } + unset($raid); + } catch (Throwable $e) { + $raidsError = $e->getMessage(); + } +} +$nextRaids = array_slice($upcomingRaids, 0, 3); + +$memberCount = $canViewUsers ? (int) db()->query("SELECT COUNT(*) FROM users WHERE status = 'active'")->fetchColumn() : null; +$roleCount = $canManageRoles ? (int) db()->query('SELECT COUNT(*) FROM roles')->fetchColumn() : null; $pageTitle = 'Dashboard'; include __DIR__ . '/includes/header.php'; ?>

Willkommen, !

-

Dies ist dein Mitgliederbereich. Die eigentliche Gilden-Homepage folgt hier später.

+

Hier ist dein Überblick über die Gilde.

+
+ + + + + Discord verbunden + + Discord nicht verbunden + +
+
+ +
+
+
+

+

Aktive Raids

+
+
+
+
+
+

+

Meine Anmeldungen

+
+
+ + +
+
+
+

+

Mitglieder

+
+
+ + +
+
+
+

+

Berechtigungsgruppen

+
+
+ +
+
+ + +
+
+

Nächste Raids

+ Alle Raids ansehen → +
+ +
Raid-Daten konnten nicht geladen werden:
+ +

Aktuell sind keine aktiven Raids geplant.

+ +
+ + + + + + + + + + + + = 1 && ($signup['class'] ?? '') !== 'Ausstehend') { + $activeCount++; + } + } + $mySignup = $raid['_my_signup'] ?? null; + ?> + + + + + + + + +
RaidTerminAnmeldungenMein Status
/ + + Angemeldet () + + Discord fehlt + + Nicht angemeldet + +
+
+ +
+ + +
+

Schnellzugriff