From 944935075a861fd90584d6544d27edb73f72beff Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Fri, 25 Sep 2026 03:34:24 +0200 Subject: [PATCH] Premade banners: leads give their premade a banner, shown on the card, dashboard and raids The lead of a premade (or the leadership with premades.manage) picks one of the landscapes or uploads an own image in edit mode under "Banner" and moves the crop with a slider (live preview). - Shown on top of the premade card (name on the banner), above the roster under "Meine Premade" on the dashboard, and behind the heading of the raid group that carries the premade's name (invited premade groups are named after it). - New table premade_banners (per premade ID of the bot, with the name for the raid groups, the choice and the crop; schema 54, also in sql/schema.sql). Own images are member_gallery rows with is_background = 1 and the new column premade_id, so they go through the same moderation (badge "Premade-Banner"), data export and account deletion as gallery pictures. The own profile background and the profile reset ignore banner rows. - premade_action.php: banner_save, banner_upload, banner_delete_upload; renaming updates the name, dissolving removes banner and upload. premade_banners_sync() on premades.php cleans up banners of premades that no longer exist. Leadership changes to other premades are logged. - Live updates of the premades page include banner changes; privacy policy, patch notes and README mention the banners. Co-Authored-By: Claude Opus 5.5 --- README.md | 9 ++ assets/css/style.css | 64 ++++++++++++ assets/js/premades.js | 37 +++++++ dashboard.php | 9 +- datenschutz.php | 4 +- includes/account_deletion.php | 1 + includes/data_export.php | 3 +- includes/data_reset.php | 9 +- includes/live_updates.php | 6 +- includes/member_profile.php | 4 +- includes/patchnotes.php | 11 ++ includes/premade_banner.php | 187 ++++++++++++++++++++++++++++++++++ includes/raid_card.php | 13 ++- includes/schema.php | 23 ++++- member_action.php | 2 +- moderation.php | 4 +- premade_action.php | 62 +++++++++++ premades.php | 85 +++++++++++++++- raids.php | 1 + raids_live.php | 1 + sql/schema.sql | 20 +++- 21 files changed, 535 insertions(+), 20 deletions(-) create mode 100644 includes/premade_banner.php diff --git a/README.md b/README.md index 0e73cb3..30136a3 100644 --- a/README.md +++ b/README.md @@ -338,6 +338,15 @@ Neue Berechtigungen `premades.view` (Premades einsehen, eigene verwalten) und `p Account nachträglich unter Berechtigungsgruppen angelegt/zugewiesen werden. `premades.lead_multiple` legt die Website selbst an (bekommt nur die Administrator-Gruppe automatisch). +**Banner:** Der Lead (oder die Leitung mit `premades.manage`) gibt der Premade im Bearbeiten-Modus ein +Banner: eine der Landschaften (wie beim Profil-Hintergrund) oder ein eigenes Bild, dazu den Bildausschnitt +(senkrecht, 0-100 %). Es steht oben auf der Premade-Karte, bei „Meine Premade“ im Dashboard und in Raids +hinter der Gruppe, die wie die Premade heißt (so heißen eingeladene Premade-Gruppen). Gespeichert in +`premade_banners` (je Premade-ID des Bots, mit dem Namen für die Raid-Gruppen); eigene Bilder sind Zeilen in +`member_gallery` mit `is_background = 1` und `premade_id` - dieselbe Moderation, Datenauskunft und Löschung +wie Galeriebilder. `premade_banners_sync()` räumt beim Anzeigen der Premades Banner aufgelöster Gruppen weg. +Logik in `includes/premade_banner.php`. + **Benachrichtigungen:** Der Lead einer Gruppe bekommt von Nezekan eine PN, wenn jemand beitritt (Einladung angenommen - im Discord oder auf der Website), von der Leitung eingeteilt oder entfernt wird oder eine Einladung ablehnt. Wird eine Gruppe aufgelöst, bekommen alle Mitglieder und offen diff --git a/assets/css/style.css b/assets/css/style.css index 4022be3..d86b782 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1553,6 +1553,70 @@ body.lumina-dialog-open { overflow: hidden; } /* Dashboard: mehrere eigene Premades untereinander */ .dashboard-premade-name { margin: 1rem 0 0; font-size: 1rem; color: var(--text-muted); } + +/* ---- Premade-Banner (includes/premade_banner.php): oben auf der Karte, im Dashboard, in Raids ---- */ +.premade-banner { + display: flex; + align-items: flex-end; + min-height: 150px; + margin: -1.5rem -2rem 1.25rem; + padding: 1rem 2rem 0.9rem; + border-radius: 10px 10px 0 0; + background-image: linear-gradient(to top, rgba(12, 12, 12, 0.9), rgba(12, 12, 12, 0.12) 70%), var(--banner-image); + background-size: cover; + background-position: center, center var(--banner-focus, 50%); + background-repeat: no-repeat; +} +.premade-banner .raid-header { width: 100%; } +.premade-banner h2, .premade-banner h3 { margin: 0; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85); } +.premade-banner .badge { background: rgba(0, 0, 0, 0.55); border-color: rgba(255, 255, 255, 0.25); color: #eee; } +.premade-banner .icon-button { background: rgba(0, 0, 0, 0.5); } +.premade-banner-small { min-height: 90px; margin: 0.75rem 0; padding: 0.75rem 1rem; border-radius: 8px; } +.premade-banner-small h3 { font-size: 1.05rem; } +@media (max-width: 600px) { + .premade-banner { min-height: 110px; } +} + +.premade-banner-edit { margin: 0.25rem 0 0.5rem; } +.premade-banner-edit > summary { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-weight: 600; } +.premade-banner-edit > summary .icon { width: 16px; height: 16px; } +.premade-banner-edit[open] > summary { margin-bottom: 0.75rem; } +.premade-banner-form { gap: 0.75rem; } +.premade-banner-preview { + display: flex; + align-items: flex-end; + min-height: 120px; + padding: 0.75rem 1rem; + border: 1px solid var(--border); + border-radius: 8px; + background-image: linear-gradient(to top, rgba(12, 12, 12, 0.9), rgba(12, 12, 12, 0.12) 70%), var(--banner-image, none); + background-size: cover; + background-position: center, center var(--banner-focus, 50%); + background-repeat: no-repeat; + color: #fff; + font-size: 1.2rem; + font-weight: 700; + text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85); +} +.premade-banner-preview.is-empty { background: var(--bg-panel-alt); color: var(--text-muted); text-shadow: none; } +.premade-banner-focus-label { display: flex; align-items: center; gap: 0.75rem; } +.premade-banner-focus-label input { flex: 1; } +.premade-banner-focus-label input:disabled { opacity: 0.4; } +.premade-banner-none { display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--text-muted); } +.premade-banner-upload { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; } + +/* Raid-Gruppe, die wie eine Premade mit Banner heisst (includes/raid_card.php) */ +.raid-group-premade h3 { + margin: -1rem -1rem 0.6rem; + padding: 0.9rem 1rem; + border-radius: 8px 8px 0 0; + background-image: linear-gradient(to right, rgba(12, 12, 12, 0.85), rgba(12, 12, 12, 0.35)), var(--banner-image); + background-size: cover; + background-position: center, center var(--banner-focus, 50%); + color: #fff; + text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85); +} +.raid-group-premade h3 .raid-group-count { color: rgba(255, 255, 255, 0.75); } .dashboard-premade-name:first-of-type { margin-top: 0.5rem; } /* Klasse wechseln: Symbol im eigenen Platz, oeffnet die Klassenauswahl */ diff --git a/assets/js/premades.js b/assets/js/premades.js index 5706935..34ae016 100644 --- a/assets/js/premades.js +++ b/assets/js/premades.js @@ -244,4 +244,41 @@ }); }); } + + // ---- Banner: Vorschau beim Auswaehlen und beim Verschieben des Bildausschnitts ---- + // Nach dem Speichern (Seite laedt neu) ist der Banner-Bereich wieder offen. + var BANNER_OPEN_KEY = 'lumina.premadeBannerOpen'; + document.querySelectorAll('.premade-banner-edit').forEach(function (details) { + var panel = details.closest('.premade-panel'); + var id = panel ? panel.getAttribute('data-premade-id') : ''; + try { + if (sessionStorage.getItem(BANNER_OPEN_KEY) === id) { + details.open = true; + sessionStorage.removeItem(BANNER_OPEN_KEY); + } + } catch (e) { /* egal */ } + details.querySelectorAll('form').forEach(function (form) { + form.addEventListener('submit', function () { + try { sessionStorage.setItem(BANNER_OPEN_KEY, id); } catch (e) { /* egal */ } + }); + }); + + var form = details.querySelector('.premade-banner-form'); + var preview = form.querySelector('.premade-banner-preview'); + var focus = form.querySelector('.premade-banner-focus'); + function update() { + var checked = form.querySelector('input[name="banner"]:checked'); + var url = checked ? checked.getAttribute('data-url') || '' : ''; + preview.style.setProperty('--banner-image', url ? 'url("' + url + '")' : 'none'); + preview.style.setProperty('--banner-focus', focus.value + '%'); + preview.classList.toggle('is-empty', !url); + focus.disabled = !url; + form.querySelectorAll('.background-option').forEach(function (option) { + option.classList.toggle('is-selected', !!checked && option.contains(checked)); + }); + } + form.addEventListener('change', update); + focus.addEventListener('input', update); + update(); + }); })(); diff --git a/dashboard.php b/dashboard.php index 92b6562..e5e3727 100644 --- a/dashboard.php +++ b/dashboard.php @@ -4,6 +4,7 @@ require_once __DIR__ . '/includes/raids_api.php'; require_once __DIR__ . '/includes/contributions.php'; require_once __DIR__ . '/includes/bugs.php'; require_once __DIR__ . '/includes/activity_points.php'; +require_once __DIR__ . '/includes/premade_banner.php'; require_permission('dashboard.view'); $user = current_user(); @@ -291,7 +292,13 @@ include __DIR__ . '/includes/header.php'; Zu den Premades → - 1): ?> + + + +
+ 1): ?>

+
+ 1): ?>

diff --git a/datenschutz.php b/datenschutz.php index 46335ea..4baa020 100644 --- a/datenschutz.php +++ b/datenschutz.php @@ -193,7 +193,7 @@ include __DIR__ . '/includes/header.php';