Show class icons next to raid signups
Maps the class names the raid bot returns (a mix of English icon filenames and German in-game terms like "Magier"/"Jäger") to the icon files under assets/images/Classes via class_icon_url(), case- and whitespace-insensitive. Classes without a matching file (e.g. "Templer", or the "Ausstehend" placeholder) just keep the plain text label instead of showing a broken image. Verified against live signup data from the API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
@ -389,6 +389,13 @@ input:focus, select:focus, textarea:focus {
|
|||
.raid-group ul { margin: 0; padding-left: 1.1rem; }
|
||||
.raid-group li { margin-bottom: 0.25rem; }
|
||||
|
||||
.class-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
vertical-align: middle;
|
||||
margin-right: 0.3rem;
|
||||
}
|
||||
|
||||
.panel-archived { opacity: 0.7; }
|
||||
|
||||
.filter-tabs {
|
||||
|
|
|
|||
BIN
assets/images/Classes/Assassin_ICO.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
assets/images/Classes/Chanter_ICO.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
assets/images/Classes/Cleric_ICO.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/images/Classes/Gladiator_ICO.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/images/Classes/Ranger_ICO.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/images/Classes/Sorcerer_ICO.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
assets/images/Classes/Spiritmaster_ICO.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -77,3 +77,34 @@ function icon(string $name): string
|
|||
return '<svg class="icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" '
|
||||
. 'stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' . $path . '</svg>';
|
||||
}
|
||||
|
||||
// Ordnet die (teils deutschen) Klassennamen aus dem Raid-Bot den Icon-Dateien
|
||||
// unter assets/images/Classes zu. Gibt null zurück, wenn keine passende
|
||||
// Datei existiert (z.B. bei "Templer" oder "Ausstehend").
|
||||
function class_icon_url(string $className): ?string
|
||||
{
|
||||
static $map = [
|
||||
'assassin' => 'Assassin_ICO.png',
|
||||
'assassine' => 'Assassin_ICO.png',
|
||||
'chanter' => 'Chanter_ICO.png',
|
||||
'barde' => 'Chanter_ICO.png',
|
||||
'gesangsmeister' => 'Chanter_ICO.png',
|
||||
'cleric' => 'Cleric_ICO.png',
|
||||
'kleriker' => 'Cleric_ICO.png',
|
||||
'gladiator' => 'Gladiator_ICO.png',
|
||||
'ranger' => 'Ranger_ICO.png',
|
||||
'waldläufer' => 'Ranger_ICO.png',
|
||||
'jäger' => 'Ranger_ICO.png',
|
||||
'sorcerer' => 'Sorcerer_ICO.png',
|
||||
'magier' => 'Sorcerer_ICO.png',
|
||||
'spiritmaster' => 'Spiritmaster_ICO.png',
|
||||
'geisterbeschwörer' => 'Spiritmaster_ICO.png',
|
||||
];
|
||||
|
||||
$key = mb_strtolower(trim($className), 'UTF-8');
|
||||
if (!isset($map[$key])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return '/assets/images/Classes/' . $map[$key];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,9 +101,16 @@ include __DIR__ . '/includes/header.php';
|
|||
<?php else: ?>
|
||||
<ul>
|
||||
<?php foreach ($members as $member): ?>
|
||||
<?php
|
||||
$memberClass = (string) ($member['class'] ?? '');
|
||||
$classIconUrl = class_icon_url($memberClass);
|
||||
?>
|
||||
<li>
|
||||
<?php if ($classIconUrl): ?>
|
||||
<img src="<?= e($classIconUrl) ?>" alt="" title="<?= e($memberClass) ?>" class="class-icon">
|
||||
<?php endif; ?>
|
||||
<?= e((string) ($member['name'] ?? '?')) ?>
|
||||
<span class="text-muted">(<?= e((string) ($member['class'] ?? '')) ?>)</span>
|
||||
<span class="text-muted">(<?= e($memberClass) ?>)</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
|
|
|||