diff --git a/assets/css/style.css b/assets/css/style.css index a4361bd..6d8438e 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -9161,3 +9161,79 @@ a.members-chip, a.members-chip:hover { text-decoration: none; } .role-preview-bar .inline-form { flex-shrink: 0; } .role-preview-picker { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.75rem 0 1rem; } .role-preview-picker label { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; } + +/* ---- Checkliste (checklist.php, Karte im Dashboard) ---- */ +.checklist-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; } +.checklist-head h1 { margin: 0 0 0.25rem; } +.checklist-head p { margin: 0; } +.checklist-head-actions { display: inline-flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; } +.checklist-open-toggle.is-active { background: var(--gold); border-color: var(--gold); color: #1a1a1a; } +.checklist-dashboard .raid-header { margin-bottom: 1rem; } + +.checklist-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; } +.checklist-char { background: var(--bg-panel-alt); border: 1px solid var(--border); border-top: 3px solid var(--text-muted); border-radius: 10px; padding: 0.7rem 0.9rem; } +.checklist-char-main { border-top-color: var(--gold); } +.checklist-char.is-full { border-color: rgba(76, 175, 80, 0.6); border-top-color: var(--success); background: rgba(76, 175, 80, 0.08); } +.checklist-char-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; } +.checklist-char-head strong { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.checklist-role { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); } +.checklist-char-main .checklist-role { color: var(--gold); } +.checklist-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.45rem; } +.checklist-bar-label span { color: var(--text); font-weight: 600; } +.checklist-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 0.2rem; } +.checklist-bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; transition: width 0.2s; } +.checklist-bar.is-full i { background: var(--success); } +.checklist-class-icon { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; vertical-align: middle; } + +.checklist-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; align-items: start; } +/* Aufladung: unter beiden Tabellen, Eintraege nebeneinander */ +.checklist-card-info { grid-column: 1 / -1; } +.checklist-info-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 1.25rem; } +@media (max-width: 1000px) { .checklist-columns { grid-template-columns: minmax(0, 1fr); } } +.checklist-card { background: var(--bg-panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1rem; } +.checklist-card-head { display: flex; justify-content: space-between; align-items: center; } +.checklist-card-head h3 { margin: 0; } +.checklist-pill { background: var(--bg); color: var(--gold); font-weight: 700; font-size: 0.8rem; padding: 0.15rem 0.7rem; border-radius: 99px; } +.checklist-reset { color: var(--text-muted); font-size: 0.82rem; margin: 0.2rem 0 0.6rem; } +.checklist-reset.is-urgent { color: #e2937a; font-weight: 600; } + +.checklist-table { overflow-x: auto; } +.checklist-row { display: grid; grid-template-columns: minmax(130px, 1fr) repeat(var(--checklist-cols), minmax(44px, 72px)); align-items: center; gap: 0.25rem; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--border); } +.checklist-table .checklist-row:nth-last-child(2) { border-bottom: 0; } +.checklist-row > :not(:first-child) { justify-self: center; } +.checklist-row:not(.checklist-row-head):hover { background: rgba(255, 255, 255, 0.03); } +.checklist-row-head { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; padding-top: 0.2rem; } +.checklist-row-head span:not(:first-child) { display: inline-flex; align-items: center; justify-content: center; gap: 0.2rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 0.15rem; box-shadow: inset 0 -2px 0 var(--border); } +.checklist-row-head .checklist-col-main { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); } +.checklist-row-head .checklist-class-icon { width: 14px; height: 14px; } +.checklist-task { min-width: 0; } +.checklist-amt { display: inline-block; min-width: 2.4em; color: var(--gold); font-weight: 700; } +.checklist-dash { color: var(--text-muted); } +.checklist-row.is-done .checklist-task { color: var(--text-muted); text-decoration: line-through; } +.checklist-row.is-done .checklist-amt { opacity: 0.6; } +.checklist-check { appearance: none; width: 24px; height: 24px; margin: 0; border-radius: 6px; background: var(--bg); border: 1.5px solid #555c68; cursor: pointer; display: grid; place-items: center; } +.checklist-check:hover { border-color: var(--gold); } +.checklist-check:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; } +.checklist-check:checked { background: var(--gold); border-color: var(--gold); } +.checklist-check:checked::after { content: "✓"; color: #1a1a1a; font-weight: 800; font-size: 0.9rem; line-height: 1; } +.checklist-check:disabled { opacity: 0.6; cursor: progress; } +.checklist-empty { display: none; color: var(--text-muted); padding: 0.6rem 0.25rem; } +.is-open-only .checklist-row.is-done { display: none; } +.is-open-only .checklist-table.is-all-done .checklist-empty { display: block; } +.is-open-only .checklist-table.is-all-done .checklist-row-head { display: none; } + +.checklist-info { padding: 0.6rem 0; border-top: 1px solid var(--border); } +.checklist-info strong { color: var(--gold); margin-left: 0.25rem; font-weight: 600; } +.checklist-info-who { display: table; margin-top: 0.3rem; font-size: 0.75rem; color: var(--text-muted); background: var(--bg); border-radius: 99px; padding: 0.05rem 0.6rem; } + +.checklist-settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem 1rem; } +.checklist-setting { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; background: var(--bg-panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.75rem; } +.checklist-setting label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; min-width: 0; } +.checklist-setting select { width: auto; margin: 0; } + +@media (max-width: 600px) { + .checklist-row { grid-template-columns: minmax(105px, 1fr) repeat(var(--checklist-cols), minmax(40px, 58px)); } + .checklist-check { width: 28px; height: 28px; } + .checklist-card { padding: 0.75rem 0.6rem; } +} +@media (prefers-reduced-motion: reduce) { .checklist-bar i { transition: none; } } diff --git a/assets/js/checklist.js b/assets/js/checklist.js new file mode 100644 index 0000000..fd78a04 --- /dev/null +++ b/assets/js/checklist.js @@ -0,0 +1,162 @@ +// Checkliste (checklist.php, Karte im Dashboard): Haken sofort speichern, Zaehler und Balken +// nachziehen, Reset-Countdown und der Filter "Nur offene" (Browserspeicher lumina-checklist-open). +(function () { + 'use strict'; + + var root = document.querySelector('[data-checklist]'); + if (!root) { + return; + } + var tokenMeta = document.querySelector('meta[name="csrf-token"]'); + var OPEN_KEY = 'lumina-checklist-open'; + // Uhrzeit des Servers - eine falsch gehende Uhr im Browser soll den Countdown nicht verschieben + var clockOffset = root.dataset.checklistNow ? Number(root.dataset.checklistNow) - Date.now() / 1000 : 0; + + function checks(selector) { + return Array.prototype.slice.call(root.querySelectorAll('.checklist-check' + (selector || ''))); + } + + // Zaehler, Balken und erledigte Zeilen aus den Haken neu berechnen + function refresh() { + var counts = {}; + var pills = {}; + checks().forEach(function (box) { + var key = box.dataset.kind + '|' + box.dataset.char; + counts[key] = counts[key] || { done: 0, total: 0 }; + pills[box.dataset.kind] = pills[box.dataset.kind] || { done: 0, total: 0 }; + counts[key].total++; + pills[box.dataset.kind].total++; + if (box.checked) { + counts[key].done++; + pills[box.dataset.kind].done++; + } + }); + Object.keys(counts).forEach(function (key) { + var c = counts[key]; + var label = root.querySelector('[data-checklist-count="' + key + '"]'); + var bar = root.querySelector('[data-checklist-bar="' + key + '"]'); + if (label) { + label.textContent = c.done + '/' + c.total; + } + if (bar) { + bar.firstElementChild.style.width = (c.total ? c.done / c.total * 100 : 0) + '%'; + bar.classList.toggle('is-full', c.done === c.total); + } + }); + Array.prototype.forEach.call(root.querySelectorAll('[data-checklist-char]'), function (card) { + var id = card.dataset.checklistChar; + var full = ['daily', 'weekly'].every(function (kind) { + var c = counts[kind + '|' + id]; + return !c || c.done === c.total; + }); + card.classList.toggle('is-full', full); + }); + Object.keys(pills).forEach(function (kind) { + var pill = root.querySelector('[data-checklist-pill="' + kind + '"]'); + if (pill) { + pill.textContent = pills[kind].done + '/' + pills[kind].total; + } + }); + Array.prototype.forEach.call(root.querySelectorAll('.checklist-row:not(.checklist-row-head)'), function (row) { + var boxes = row.querySelectorAll('.checklist-check'); + var done = Array.prototype.every.call(boxes, function (b) { return b.checked; }); + row.classList.toggle('is-done', done); + }); + Array.prototype.forEach.call(root.querySelectorAll('.checklist-table'), function (table) { + table.classList.toggle('is-all-done', !table.querySelector('.checklist-row:not(.checklist-row-head):not(.is-done)')); + }); + } + + root.addEventListener('change', function (event) { + var box = event.target; + if (!box.classList || !box.classList.contains('checklist-check')) { + return; + } + refresh(); + box.disabled = true; + fetch('/checklist_action.php', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + credentials: 'same-origin', + body: JSON.stringify({ + csrf_token: tokenMeta ? tokenMeta.content : '', + character_id: Number(box.dataset.char), + task: box.dataset.task, + done: box.checked + }) + }).then(function (response) { + return response.json().catch(function () { return { status: 'error', message: 'Speichern fehlgeschlagen.' }; }); + }).then(function (data) { + if (data.status !== 'success') { + throw new Error(data.message || 'Speichern fehlgeschlagen.'); + } + }).catch(function (error) { + box.checked = !box.checked; + refresh(); + window.alert(error.message || 'Speichern fehlgeschlagen. Bitte die Seite neu laden.'); + }).then(function () { + box.disabled = false; + }); + }); + + // Nur offene Aufgaben zeigen + var openToggle = root.querySelector('[data-checklist-open-only]'); + function setOpenOnly(on) { + root.classList.toggle('is-open-only', on); + if (openToggle) { + openToggle.setAttribute('aria-pressed', on ? 'true' : 'false'); + openToggle.classList.toggle('is-active', on); + } + } + try { + setOpenOnly(window.localStorage.getItem(OPEN_KEY) === '1'); + } catch (e) { + setOpenOnly(false); + } + if (openToggle) { + openToggle.addEventListener('click', function () { + var on = !root.classList.contains('is-open-only'); + setOpenOnly(on); + try { + if (on) { + window.localStorage.setItem(OPEN_KEY, '1'); + } else { + window.localStorage.removeItem(OPEN_KEY); + } + } catch (e) { /* ohne Browserspeicher gilt der Filter nur bis zum Neuladen */ } + }); + } + + // Countdown bis zum Reset; ist er vorbei, die Seite neu laden (neuer Zeitraum, leere Haken) + function countdown(seconds) { + var minutes = Math.max(0, Math.floor(seconds / 60)); + var days = Math.floor(minutes / 1440); + var hours = Math.floor(minutes % 1440 / 60); + return days > 0 ? days + ' ' + (days === 1 ? 'Tag' : 'Tagen') + ' ' + hours + ' Std' : hours + ' Std ' + (minutes % 60) + ' Min'; + } + function tick() { + var now = Date.now() / 1000 + clockOffset; + var expired = false; + Array.prototype.forEach.call(root.querySelectorAll('[data-checklist-reset]'), function (el) { + var left = Number(el.dataset.checklistReset) - now; + if (left <= 0) { + expired = true; + } + el.querySelector('span').textContent = countdown(left); + el.classList.toggle('is-urgent', left < Number(el.dataset.checklistUrgent)); + }); + if (expired) { + window.location.reload(); + } + } + window.setInterval(tick, 30000); + + // Rollen-Auswahl auf checklist.php speichert sofort + Array.prototype.forEach.call(document.querySelectorAll('[data-checklist-autosubmit]'), function (select) { + select.addEventListener('change', function () { + select.form.submit(); + }); + }); + + refresh(); +})(); diff --git a/checklist.php b/checklist.php new file mode 100644 index 0000000..b392966 --- /dev/null +++ b/checklist.php @@ -0,0 +1,80 @@ + $c['role'] !== 'hidden')); +$periods = checklist_periods(); +$ticks = checklist_ticks($userId, $periods); +$weekdays = [1 => 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag']; +$resetTime = sprintf('%02d:00 Uhr', CHECKLIST_RESET_HOUR); + +$pageTitle = 'Checkliste'; +include __DIR__ . '/includes/header.php'; +?> +
+
+
+

Checkliste

+

Reset täglich um · wöchentlich , (deutsche Zeit). Main-Charaktere sehen alle Aufgaben, Twinks nur ihre.

+
+ + + +
+ + + +

Alle deine Charaktere sind ausgeblendet – unten unter „Charaktere in der Checkliste“ holst du sie zurück.

+ + +
+ + +
+

Aufladung

+
Lädt sich von selbst auf
+
+ +
+ + +
+ +
+
+
+ +
+ + +
+

Charaktere in der Checkliste

+

Automatisch ist dein Hauptcharakter Main und alle anderen sind Twinks. Hier kannst du das je Charakter ändern oder einen ganz ausblenden. + Charaktere anlegen und umbenennen geht auf deiner Profilseite.

+
+ +
+ + + + + + +
+ +
+
+ + + + diff --git a/checklist_action.php b/checklist_action.php new file mode 100644 index 0000000..eb86bee --- /dev/null +++ b/checklist_action.php @@ -0,0 +1,49 @@ +prepare('UPDATE member_characters SET checklist_role = ? WHERE id = ?') + ->execute([$role !== '' ? $role : null, (int) $character['id']]); + set_flash('success', '„' . $character['name'] . '“: ' . CHECKLIST_ROLES[$role] . ($role === '' ? ' (Hauptcharakter = Main, sonst Twink)' : '') . '.'); + redirect('/checklist.php#einstellungen'); +} + +// Haken (JSON) +$body = read_json_body(); +verify_csrf_token($body['csrf_token'] ?? ''); +$character = $ownCharacter((int) ($body['character_id'] ?? 0)); +$task = checklist_task((string) ($body['task'] ?? '')); +if ($character === null || $task === null || !checklist_applies($task, $character['role'])) { + json_response(false, 'Diese Aufgabe gibt es für den Charakter nicht (mehr). Bitte die Seite neu laden.'); +} +checklist_set($userId, (int) $character['id'], $task, !empty($body['done'])); +json_response(true); diff --git a/dashboard.php b/dashboard.php index 8c589af..fd08cc3 100644 --- a/dashboard.php +++ b/dashboard.php @@ -5,6 +5,7 @@ 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_once __DIR__ . '/includes/checklist.php'; require_login(); // Mitglieder verbuendeter Legionen haben ihre eigene Startseite (consilium.php) - hierher kommen sie nach dem Login if (consilium_only()) { @@ -141,6 +142,17 @@ try { $myBugs = []; } $bugForm = $_SESSION['bug_form'] ?? null; + +// Checkliste der eigenen Charaktere (includes/checklist.php) - ausgeblendete Charaktere nicht +$checklistCharacters = []; +$checklistAny = false; +if (user_has_permission('checklist.view')) { + $checklistAll = checklist_characters((int) $user['id']); + $checklistAny = $checklistAll !== []; + $checklistCharacters = array_values(array_filter($checklistAll, static fn (array $c): bool => $c['role'] !== 'hidden')); + $checklistPeriods = checklist_periods(); + $checklistTicks = checklist_ticks((int) $user['id'], $checklistPeriods); +} unset($_SESSION['bug_form']); $pageTitle = 'Dashboard'; @@ -166,6 +178,30 @@ include __DIR__ . '/includes/header.php'; + +
+
+

Checkliste

+ + + + + Ganze Checkliste → + +
+ + + + +
+ + +
+ +
+ + +
@@ -460,6 +496,9 @@ if (empty($user['tour_completed_at'])): $tourSteps[] = ['target' => $link('/members.php'), 'title' => 'Mitglieder', 'text' => 'Hier findest du alle Mitglieder der Legion, sortiert nach ihren Rängen. Ein Klick auf einen Namen öffnet die Profilseite mit Charakteren und Galerie.']; $tourSteps[] = ['target' => $link('/gallery.php'), 'title' => 'Galerie', 'text' => 'Die Screenshots aller Mitglieder auf einer Seite. Die Zahl am Menüpunkt zeigt, wie viele seit deinem letzten Besuch dazugekommen sind. Eigene lädst du auf deiner Profilseite hoch.']; } + if (user_has_permission('checklist.view')) { + $tourSteps[] = ['target' => '[data-tour="checklist"]', 'title' => 'Checkliste', 'text' => 'Deine täglichen und wöchentlichen Aufgaben in Aion 2 zum Abhaken - für jeden Charakter aus deinem Profil. Die Haken setzen sich beim Reset von selbst zurück. Unter „Checkliste“ im Menü siehst du alles auf einer Seite und legst fest, welcher Charakter Main oder Twink ist.']; + } if ($myPoints !== null) { $tourSteps[] = ['target' => '[data-tour="points"]', 'title' => 'Lumipunkte', 'text' => 'Für deinen Einsatz in der Legion, z.B. bei Raids, bekommst du Lumipunkte - und für jeden Tag, an dem du vorbeischaust, eine kleine Belohnung. Hier siehst du deinen Stand und deinen Platz in der Rangliste.']; } diff --git a/datenschutz.php b/datenschutz.php index 3d0fb2c..5636ee0 100644 --- a/datenschutz.php +++ b/datenschutz.php @@ -140,6 +140,11 @@ include __DIR__ . '/includes/header.php'; Anbieter, deren Videos oder Bilder du „immer direkt laden“ möchtest (Abschnitt ) bis du die Freigabe zurücksetzt + + lumina-checklist-open
Browserspeicher + ob die Checkliste nur offene Aufgaben zeigt + bis du den Filter ausschaltest + gear-plan-note, gear-dv-board, premades-editing, premades-open
Sitzungsspeicher kleine Zwischenstände im Gear-Planer und bei den Premades (z. B. welche Leads aufgeklappt sind) @@ -222,6 +227,7 @@ include __DIR__ . '/includes/header.php';

Im Mitgliederbereich verarbeiten wir, was du selbst einträgst oder was bei der Nutzung entsteht - je nach Funktion: