Badges: Chat-Punkt am Avatar, Notif-Punkt am Burger, Aktuelles aus Sidebar, SW by-v327

This commit is contained in:
rene 2026-04-24 08:33:32 +02:00
parent 546551a8db
commit 0a3ad2207e
3 changed files with 22 additions and 22 deletions

View file

@ -145,10 +145,7 @@
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#chat-circle-dots"></use></svg> Nachrichten <svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#chat-circle-dots"></use></svg> Nachrichten
<span class="sidebar-item-badge" id="chat-badge" style="display:none">0</span> <span class="sidebar-item-badge" id="chat-badge" style="display:none">0</span>
</div> </div>
<div class="sidebar-item" data-page="notifications">
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#bell"></use></svg> Aktuelles
<span class="sidebar-item-badge" id="notif-badge" style="display:none">0</span>
</div>
<span class="sidebar-section-label">Community</span> <span class="sidebar-section-label">Community</span>
<div class="sidebar-item" data-page="poison"> <div class="sidebar-item" data-page="poison">
@ -228,13 +225,18 @@
style="width:18px;height:18px;color:var(--c-text-muted)"> style="width:18px;height:18px;color:var(--c-text-muted)">
<use href="/icons/phosphor.svg#user"></use> <use href="/icons/phosphor.svg#user"></use>
</svg> </svg>
<span id="notif-nav-badge" class="hidden" <span id="chat-nav-badge" class="hidden"
style="position:absolute;top:-3px;right:-3px;min-width:16px;height:16px; style="position:absolute;top:-3px;right:-3px;width:10px;height:10px;
border-radius:8px;background:var(--c-danger);color:#fff;font-size:10px; border-radius:50%;background:var(--c-danger);
font-weight:700;line-height:16px;text-align:center;padding:0 3px; pointer-events:none;z-index:1"></span>
</button>
<button class="header-menu-btn" id="header-menu-btn" aria-label="Menü" style="position:relative">
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#list"></use></svg>
<span id="notif-nav-badge" class="hidden"
style="position:absolute;top:4px;right:4px;width:10px;height:10px;
border-radius:50%;background:var(--c-danger);
pointer-events:none;z-index:1"></span> pointer-events:none;z-index:1"></span>
</button> </button>
<button class="header-menu-btn" id="header-menu-btn" aria-label="Menü"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#list"></use></svg></button>
</header> </header>
<!-- HAUPT-INHALTSBEREICH --> <!-- HAUPT-INHALTSBEREICH -->

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung. Router, State-Management, Navigation, Initialisierung.
============================================================ */ ============================================================ */
const APP_VER = '314'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VER = '315'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const App = (() => { const App = (() => {
@ -471,16 +471,12 @@ const App = (() => {
if (!state.user) return; if (!state.user) return;
try { try {
const { count } = await API.notifications.unreadCount(); const { count } = await API.notifications.unreadCount();
// Sidebar-Badge (Zahl) — entfernt aus Sidebar, aber ID bleibt für Kompatibilität
const badge = document.getElementById('notif-badge'); const badge = document.getElementById('notif-badge');
if (badge) { if (badge) { badge.textContent = count; badge.style.display = count > 0 ? '' : 'none'; }
badge.textContent = count; // Burger-Punkt
badge.style.display = count > 0 ? '' : 'none';
}
const navBadge = document.getElementById('notif-nav-badge'); const navBadge = document.getElementById('notif-nav-badge');
if (navBadge) { if (navBadge) navBadge.classList.toggle('hidden', count === 0);
navBadge.textContent = count;
navBadge.classList.toggle('hidden', count === 0);
}
} catch { /* ignorieren */ } } catch { /* ignorieren */ }
} }
@ -489,10 +485,12 @@ const App = (() => {
try { try {
const convs = await API.chat.conversations(); const convs = await API.chat.conversations();
const total = convs.reduce((s, c) => s + (c.unread_count || 0), 0); const total = convs.reduce((s, c) => s + (c.unread_count || 0), 0);
// Sidebar-Badge (Zahl)
const badge = document.getElementById('chat-badge'); const badge = document.getElementById('chat-badge');
if (!badge) return; if (badge) { badge.textContent = total; badge.style.display = total > 0 ? '' : 'none'; }
badge.textContent = total; // Avatar-Punkt
badge.style.display = total > 0 ? '' : 'none'; const navBadge = document.getElementById('chat-nav-badge');
if (navBadge) navBadge.classList.toggle('hidden', total === 0);
} catch { /* ignorieren */ } } catch { /* ignorieren */ }
} }

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache Offline-Cache + Push Notifications + Tile-Cache
============================================================ */ ============================================================ */
const CACHE_VERSION = 'by-v326'; const CACHE_VERSION = 'by-v327';
const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten