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

@ -3,7 +3,7 @@
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 = (() => {
@ -471,16 +471,12 @@ const App = (() => {
if (!state.user) return;
try {
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');
if (badge) {
badge.textContent = count;
badge.style.display = count > 0 ? '' : 'none';
}
if (badge) { badge.textContent = count; badge.style.display = count > 0 ? '' : 'none'; }
// Burger-Punkt
const navBadge = document.getElementById('notif-nav-badge');
if (navBadge) {
navBadge.textContent = count;
navBadge.classList.toggle('hidden', count === 0);
}
if (navBadge) navBadge.classList.toggle('hidden', count === 0);
} catch { /* ignorieren */ }
}
@ -489,10 +485,12 @@ const App = (() => {
try {
const convs = await API.chat.conversations();
const total = convs.reduce((s, c) => s + (c.unread_count || 0), 0);
// Sidebar-Badge (Zahl)
const badge = document.getElementById('chat-badge');
if (!badge) return;
badge.textContent = total;
badge.style.display = total > 0 ? '' : 'none';
if (badge) { badge.textContent = total; badge.style.display = total > 0 ? '' : 'none'; }
// Avatar-Punkt
const navBadge = document.getElementById('chat-nav-badge');
if (navBadge) navBadge.classList.toggle('hidden', total === 0);
} catch { /* ignorieren */ }
}