Premades: move class action out of member cards into own grid slot

The own class control no longer sits inside the lead/member card. It now
renders as a dedicated 6th roster-grid tile (the cell left free next to
slot 5) showing the current class icon and a Festlegen/Aendern label,
opening the same class-picker popup as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-20 01:10:44 +02:00
parent 2d3a3562c2
commit 89ba2ebb35
3 changed files with 49 additions and 14 deletions

View file

@ -840,20 +840,33 @@ input:focus, select:focus, textarea:focus {
.premade-slot-invite-btn:hover { color: var(--gold); }
.premade-class-btn {
background: none;
/* Eigene Klassen-Aktion: sitzt als zusaetzliche Kachel im (bei 5 Slots stets
freien) 6. Grid-Feld neben der Mitgliederliste statt in einer der Karten. */
.premade-slot-class-action:hover { background: var(--gold); }
.premade-class-action-btn {
width: 100%;
height: 100%;
border: none;
padding: 0;
margin: 0;
font: inherit;
font-size: 0.78rem;
font-weight: 600;
border-radius: 0;
color: inherit;
text-align: left;
color: var(--gold);
font: inherit;
cursor: pointer;
}
.premade-class-btn:hover { color: var(--gold-hover); text-decoration: underline; }
.premade-class-action-btn:hover { background: var(--bg-panel-alt); }
.premade-class-action-icon { color: var(--text-muted); }
.premade-class-action-label {
margin-left: auto;
flex-shrink: 0;
font-size: 0.75rem;
font-weight: 600;
color: var(--gold);
white-space: nowrap;
}
.premade-invite-list {
display: flex;

View file

@ -50,7 +50,7 @@
wireModal(classModal);
document.querySelectorAll('.premade-class-btn').forEach(function (btn) {
document.querySelectorAll('.premade-class-action-btn').forEach(function (btn) {
btn.addEventListener('click', function () {
classPremadeIdField.value = btn.getAttribute('data-premade-id') || '';
var currentClass = btn.getAttribute('data-current-class') || '';

View file

@ -193,6 +193,8 @@ include __DIR__ . '/includes/header.php';
while (count($slots) < 5) {
$slots[] = ['type' => 'empty'];
}
$isMemberHere = false;
$myClass = null;
?>
<div class="premade-roster">
<?php foreach ($slots as $slot): ?>
@ -211,6 +213,10 @@ include __DIR__ . '/includes/header.php';
<?php
$slotUser = premade_avatar_user((int) $slot['id'], $linkedUsersByDiscordId, $slot['name']);
$isMe = $discordId !== null && (int) $slot['id'] === $discordId;
if ($isMe && $slot['type'] !== 'pending') {
$myClass = $slot['class'] ?? null;
$isMemberHere = true;
}
?>
<div class="premade-slot premade-slot-<?= e($slot['type']) ?>">
<div class="premade-slot-inner">
@ -219,10 +225,6 @@ include __DIR__ . '/includes/header.php';
<strong><?= $slot['type'] === 'pending' ? '⏳ ' : '' ?><?= e($slot['name']) ?></strong>
<?php if ($slot['type'] === 'pending'): ?>
<span class="text-muted">Einladung offen</span>
<?php elseif ($isMe): ?>
<button type="button" class="premade-class-btn" data-premade-id="<?= $premadeId ?>" data-current-class="<?= e((string) ($slot['class'] ?? '')) ?>">
<?= empty($slot['class']) ? 'Klasse festlegen' : 'Klasse ändern' ?>
</button>
<?php elseif (!empty($slot['class'])): ?>
<span class="text-muted"><?= e($slot['class']) ?></span>
<?php endif; ?>
@ -242,6 +244,26 @@ include __DIR__ . '/includes/header.php';
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($isMemberHere): ?>
<?php $myClassIcon = !empty($myClass) ? class_icon_url($myClass) : null; ?>
<div class="premade-slot premade-slot-class-action">
<button type="button" class="premade-slot-inner premade-class-action-btn" data-premade-id="<?= $premadeId ?>" data-current-class="<?= e((string) ($myClass ?? '')) ?>">
<span class="class-icon-frame premade-class-action-icon">
<?php if ($myClassIcon): ?>
<img src="<?= e($myClassIcon) ?>" alt="">
<?php else: ?>
<?= icon('edit') ?>
<?php endif; ?>
</span>
<span class="premade-slot-name">
<strong>Deine Klasse</strong>
<span class="text-muted"><?= $myClass ? e($myClass) : 'Nicht festgelegt' ?></span>
</span>
<span class="premade-class-action-label"><?= $myClass ? 'Ändern' : 'Festlegen' ?></span>
</button>
</div>
<?php endif; ?>
</div>
<?php if ($canManageThis): ?>