LuminaWebsite/assets/js/premades.js
Maaxxs 8d82065220 Premades: bigger class icons, distinct class-action design
Member class icons were too small to read - bumped from 14px to 20px.
The own-class action tile no longer reuses the angled member-card shape
(clip-path border trick); it is now a plain rounded button with a gold
dashed outline so it reads as an action, not another roster slot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 01:25:29 +02:00

74 lines
2.7 KiB
JavaScript

(function () {
'use strict';
function openModal(modal) {
if (modal) modal.hidden = false;
}
function closeModal(modal) {
if (modal) modal.hidden = true;
}
function wireModal(modal) {
if (!modal) return;
var closeBtn = modal.querySelector('.modal-close');
if (closeBtn) closeBtn.addEventListener('click', function () { closeModal(modal); });
modal.addEventListener('click', function (e) {
if (e.target === modal) closeModal(modal);
});
}
// ---- Mitglied einladen ----
var inviteModal = document.getElementById('premade-invite-modal');
var inviteForm = document.getElementById('premade-invite-form');
var invitePremadeIdField = document.getElementById('premade-invite-premade-id');
var inviteUserIdField = document.getElementById('premade-invite-user-id');
wireModal(inviteModal);
document.querySelectorAll('.premade-slot-invite-btn').forEach(function (btn) {
btn.addEventListener('click', function () {
invitePremadeIdField.value = btn.getAttribute('data-premade-id') || '';
openModal(inviteModal);
});
});
if (inviteModal) {
inviteModal.querySelectorAll('.premade-invite-option').forEach(function (btn) {
btn.addEventListener('click', function () {
inviteUserIdField.value = btn.getAttribute('data-user-id') || '';
inviteForm.submit();
});
});
}
// ---- Klasse festlegen/aendern ----
var classModal = document.getElementById('premade-class-modal');
var classForm = document.getElementById('premade-class-form');
var classPremadeIdField = document.getElementById('premade-class-premade-id');
var classValueField = document.getElementById('premade-class-value');
wireModal(classModal);
document.querySelectorAll('.premade-class-action').forEach(function (btn) {
btn.addEventListener('click', function () {
classPremadeIdField.value = btn.getAttribute('data-premade-id') || '';
var currentClass = btn.getAttribute('data-current-class') || '';
if (classModal) {
classModal.querySelectorAll('.class-picker-option').forEach(function (option) {
option.classList.toggle('selected', option.getAttribute('data-class') === currentClass);
});
}
openModal(classModal);
});
});
if (classModal) {
classModal.querySelectorAll('.class-picker-option').forEach(function (btn) {
btn.addEventListener('click', function () {
classValueField.value = btn.getAttribute('data-class') || '';
classForm.submit();
});
});
}
})();