diff --git a/assets/css/style.css b/assets/css/style.css index 59969dd..ba2e833 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -782,24 +782,48 @@ input:focus, select:focus, textarea:focus { .raid-premade-row select { width: auto; } -.premade-member-list { - list-style: none; +.premade-members { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; margin: 0.75rem 0 0; - padding: 0; } -.premade-member-list li { +.premade-chip { display: flex; align-items: center; - justify-content: space-between; gap: 0.5rem; - padding: 0.4rem 0; - border-bottom: 1px solid var(--border); + padding: 0.3rem 0.65rem 0.3rem 0.3rem; + background: var(--bg-panel-alt); + border: 1px solid var(--border); + border-radius: 999px; } -.premade-member-list li:last-child { border-bottom: none; } +.premade-chip-lead { + border-color: var(--gold); + background: rgba(201, 162, 39, 0.12); +} -.premade-member-pending { color: var(--text-muted); } +.premade-chip-pending { + border-style: dashed; + color: var(--text-muted); +} + +.premade-crown { + display: inline-flex; + color: var(--gold); + flex-shrink: 0; +} + +.premade-crown .icon { width: 15px; height: 15px; } + +.premade-chip .icon-button { + width: 22px; + height: 22px; + margin-left: 0.1rem; +} + +.premade-chip .icon-button .icon { width: 13px; height: 13px; } .premade-invite-row { display: flex; diff --git a/includes/functions.php b/includes/functions.php index 30f9670..e97e250 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -118,6 +118,7 @@ function icon(string $name): string 'archive' => '', 'restore' => '', 'trash' => '', + 'crown' => '', ]; $path = $paths[$name] ?? ''; diff --git a/premades.php b/premades.php index 8f205f0..83deea7 100644 --- a/premades.php +++ b/premades.php @@ -27,13 +27,15 @@ foreach ($premades as $p) { $allDiscordIds = array_values(array_unique(array_filter($allDiscordIds))); $namesByDiscordId = []; +$linkedUsersByDiscordId = []; if (!empty($allDiscordIds)) { $placeholders = implode(',', array_fill(0, count($allDiscordIds), '?')); - $stmt = db()->prepare("SELECT discord_id, discord_username, display_name FROM users WHERE discord_id IN ($placeholders)"); + $stmt = db()->prepare("SELECT id, discord_id, discord_username, display_name, avatar_filename FROM users WHERE discord_id IN ($placeholders)"); $stmt->execute($allDiscordIds); foreach ($stmt->fetchAll() as $row) { $name = $row['display_name'] !== '' ? $row['display_name'] : $row['discord_username']; $namesByDiscordId[(int) $row['discord_id']] = $name; + $linkedUsersByDiscordId[(int) $row['discord_id']] = $row; } } @@ -48,6 +50,17 @@ function premade_name_for(int $discordId, array $namesByDiscordId, ?string $apiN return $namesByDiscordId[$discordId] ?? ('Discord-Nutzer ' . $discordId); } +// Baut ein fuer avatar_html() nutzbares Nutzer-Array: das echte, hochgeladene Profilbild, +// falls die Discord-ID zu einem verknuepften Website-Account gehoert, sonst ein Platzhalter +// mit dem Anfangsbuchstaben des (von der API aufgeloesten) Namens. +function premade_avatar_user(int $discordId, array $linkedUsersByDiscordId, string $displayName): array +{ + if (isset($linkedUsersByDiscordId[$discordId])) { + return $linkedUsersByDiscordId[$discordId]; + } + return ['id' => $discordId, 'display_name' => $displayName, 'username' => $displayName, 'avatar_filename' => null]; +} + $myRelation = $discordId ? find_my_premade($premades, $discordId) : null; $myPendingInvites = $discordId ? find_my_pending_invites($premades, $discordId) : []; @@ -147,44 +160,61 @@ include __DIR__ . '/includes/header.php';

⚔️

- 👑 Mitglieder
-
    +
    + +
    + + + +
    -
  • - + +
    + +
    - +
    -
  • +
    -
  • - ⏳ (Einladung offen) + +
    + + ⏳
    - +
    -
  • + - -
  • Noch keine weiteren Mitglieder.
  • - -
+