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;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(0, 0, 0, 0.65);
|
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;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 1000;
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
|
|
@ -679,11 +686,41 @@ input:focus, select:focus, textarea:focus {
|
||||||
|
|
||||||
.class-picker {
|
.class-picker {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
grid-template-columns: repeat(4, 1fr);
|
||||||
gap: 0.6rem;
|
gap: 0.6rem;
|
||||||
margin: 1.25rem 0;
|
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 {
|
.class-picker-option {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,27 @@
|
||||||
|
|
||||||
// ---- Anmelde-Popup ----
|
// ---- Anmelde-Popup ----
|
||||||
var modal = document.getElementById('raid-signup-modal');
|
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 feedbackEl = document.getElementById('raid-signup-feedback');
|
||||||
var confirmBtn = document.getElementById('raid-signup-confirm');
|
var confirmBtn = document.getElementById('raid-signup-confirm');
|
||||||
var currentRaidId = null;
|
var currentRaidId = null;
|
||||||
var selectedClass = 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) {
|
function openSignupModal(card) {
|
||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
|
|
@ -34,20 +50,14 @@
|
||||||
groups = [];
|
groups = [];
|
||||||
}
|
}
|
||||||
var myGroup = card.getAttribute('data-my-group') || '';
|
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) {
|
groups.forEach(function (name, index) {
|
||||||
var opt = document.createElement('option');
|
groupPicker.appendChild(makeGroupButton(name, index + 1, selectedGroup === index + 1));
|
||||||
opt.value = String(index + 1);
|
|
||||||
opt.textContent = name;
|
|
||||||
if (String(index + 1) === myGroup) opt.selected = true;
|
|
||||||
groupSelect.appendChild(opt);
|
|
||||||
});
|
});
|
||||||
var benchOpt = document.createElement('option');
|
groupPicker.appendChild(makeGroupButton('Ersatzbank', 0, selectedGroup === 0));
|
||||||
benchOpt.value = '0';
|
|
||||||
benchOpt.textContent = 'Ersatzbank';
|
|
||||||
if (myGroup === '0') benchOpt.selected = true;
|
|
||||||
groupSelect.appendChild(benchOpt);
|
|
||||||
|
|
||||||
modal.querySelectorAll('.class-picker-option').forEach(function (btn) {
|
modal.querySelectorAll('.class-picker-option').forEach(function (btn) {
|
||||||
btn.classList.toggle('selected', btn.getAttribute('data-class') === selectedClass);
|
btn.classList.toggle('selected', btn.getAttribute('data-class') === selectedClass);
|
||||||
|
|
@ -97,7 +107,7 @@
|
||||||
postJson('/raid_signup_action.php', {
|
postJson('/raid_signup_action.php', {
|
||||||
raid_id: currentRaidId,
|
raid_id: currentRaidId,
|
||||||
class: selectedClass,
|
class: selectedClass,
|
||||||
group: groupSelect.value === '' ? null : parseInt(groupSelect.value, 10)
|
group: selectedGroup
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
feedbackEl.textContent = result.message || '';
|
feedbackEl.textContent = result.message || '';
|
||||||
feedbackEl.className = 'raid-modal-feedback ' + (result.status === 'success' ? 'success' : 'error');
|
feedbackEl.className = 'raid-modal-feedback ' + (result.status === 'success' ? 'success' : 'error');
|
||||||
|
|
|
||||||
|
|
@ -332,10 +332,8 @@ include __DIR__ . '/includes/header.php';
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="raid-signup-group">Wunschgruppe (optional)</label>
|
<label>Wunschgruppe (optional)</label>
|
||||||
<select id="raid-signup-group">
|
<div class="group-picker" id="raid-signup-group-picker"></div>
|
||||||
<option value="">Automatisch zuteilen</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="raid-signup-feedback" class="raid-modal-feedback"></div>
|
<div id="raid-signup-feedback" class="raid-modal-feedback"></div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue