Fix signup modal showing on load and switch group picker to buttons
.modal-overlay set display:flex unconditionally, which beats the
browser's default [hidden] { display: none } since author styles
always win over the UA stylesheet - so the popup was visible on every
page load regardless of the hidden attribute. Now display is none by
default and only :not([hidden]) switches to flex.
Also: class picker was auto-fill grid producing an uneven 3/3/2 layout
for 8 classes - now a fixed 4x2 grid (2x4 on narrow screens). Group
selection is no longer a <select>, but the same pill-button pattern as
the class picker (Automatisch/group names/Ersatzbank), built by JS to
match the class picker's look.
Verified via screenshots: modal closed by default, opens only via
button click, uniform icon grid, group pills render and highlight
correctly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fea0cc3a91
commit
5c28cb5735
3 changed files with 65 additions and 20 deletions
|
|
@ -651,11 +651,18 @@ input:focus, select:focus, textarea:focus {
|
|||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
z-index: 1000;
|
||||
padding: 1rem;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Das "hidden"-Attribut steuert die Sichtbarkeit; ohne diese Regel würde
|
||||
"display: flex" das Standard-UA-"display: none" von [hidden] überstimmen
|
||||
und das Popup waere immer sichtbar. */
|
||||
.modal-overlay:not([hidden]) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.modal {
|
||||
|
|
@ -679,11 +686,41 @@ input:focus, select:focus, textarea:focus {
|
|||
|
||||
.class-picker {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 0.6rem;
|
||||
margin: 1.25rem 0;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.class-picker { grid-template-columns: repeat(2, 1fr); }
|
||||
}
|
||||
|
||||
.group-picker {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin: 0.75rem 0 1.25rem;
|
||||
}
|
||||
|
||||
.group-picker-option {
|
||||
padding: 0.5rem 1rem;
|
||||
background: var(--bg-panel-alt);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.group-picker-option:hover { border-color: var(--gold); }
|
||||
|
||||
.group-picker-option.selected {
|
||||
border-color: var(--gold);
|
||||
background: rgba(201, 162, 39, 0.15);
|
||||
color: var(--gold);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.class-picker-option {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,27 @@
|
|||
|
||||
// ---- Anmelde-Popup ----
|
||||
var modal = document.getElementById('raid-signup-modal');
|
||||
var groupSelect = document.getElementById('raid-signup-group');
|
||||
var groupPicker = document.getElementById('raid-signup-group-picker');
|
||||
var feedbackEl = document.getElementById('raid-signup-feedback');
|
||||
var confirmBtn = document.getElementById('raid-signup-confirm');
|
||||
var currentRaidId = null;
|
||||
var selectedClass = null;
|
||||
var selectedGroup = null; // null = automatisch zuteilen
|
||||
|
||||
function makeGroupButton(label, value, isSelected) {
|
||||
var btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'group-picker-option' + (isSelected ? ' selected' : '');
|
||||
btn.textContent = label;
|
||||
btn.setAttribute('data-group', value === null ? '' : String(value));
|
||||
btn.addEventListener('click', function () {
|
||||
selectedGroup = value;
|
||||
groupPicker.querySelectorAll('.group-picker-option').forEach(function (b) {
|
||||
b.classList.toggle('selected', b === btn);
|
||||
});
|
||||
});
|
||||
return btn;
|
||||
}
|
||||
|
||||
function openSignupModal(card) {
|
||||
if (!modal) return;
|
||||
|
|
@ -34,20 +50,14 @@
|
|||
groups = [];
|
||||
}
|
||||
var myGroup = card.getAttribute('data-my-group') || '';
|
||||
selectedGroup = myGroup === '' ? null : parseInt(myGroup, 10);
|
||||
|
||||
groupSelect.innerHTML = '<option value="">Automatisch zuteilen</option>';
|
||||
groupPicker.innerHTML = '';
|
||||
groupPicker.appendChild(makeGroupButton('Automatisch', null, selectedGroup === null));
|
||||
groups.forEach(function (name, index) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = String(index + 1);
|
||||
opt.textContent = name;
|
||||
if (String(index + 1) === myGroup) opt.selected = true;
|
||||
groupSelect.appendChild(opt);
|
||||
groupPicker.appendChild(makeGroupButton(name, index + 1, selectedGroup === index + 1));
|
||||
});
|
||||
var benchOpt = document.createElement('option');
|
||||
benchOpt.value = '0';
|
||||
benchOpt.textContent = 'Ersatzbank';
|
||||
if (myGroup === '0') benchOpt.selected = true;
|
||||
groupSelect.appendChild(benchOpt);
|
||||
groupPicker.appendChild(makeGroupButton('Ersatzbank', 0, selectedGroup === 0));
|
||||
|
||||
modal.querySelectorAll('.class-picker-option').forEach(function (btn) {
|
||||
btn.classList.toggle('selected', btn.getAttribute('data-class') === selectedClass);
|
||||
|
|
@ -97,7 +107,7 @@
|
|||
postJson('/raid_signup_action.php', {
|
||||
raid_id: currentRaidId,
|
||||
class: selectedClass,
|
||||
group: groupSelect.value === '' ? null : parseInt(groupSelect.value, 10)
|
||||
group: selectedGroup
|
||||
}).then(function (result) {
|
||||
feedbackEl.textContent = result.message || '';
|
||||
feedbackEl.className = 'raid-modal-feedback ' + (result.status === 'success' ? 'success' : 'error');
|
||||
|
|
|
|||
|
|
@ -332,10 +332,8 @@ include __DIR__ . '/includes/header.php';
|
|||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="raid-signup-group">Wunschgruppe (optional)</label>
|
||||
<select id="raid-signup-group">
|
||||
<option value="">Automatisch zuteilen</option>
|
||||
</select>
|
||||
<label>Wunschgruppe (optional)</label>
|
||||
<div class="group-picker" id="raid-signup-group-picker"></div>
|
||||
</div>
|
||||
<div id="raid-signup-feedback" class="raid-modal-feedback"></div>
|
||||
<div class="actions">
|
||||
|
|
|
|||
Loading…
Reference in a new issue