fix: remove notifications link from user menu, add view-all button to notification dropdown, fix admin link
This commit is contained in:
@@ -48,14 +48,14 @@ function fetchNotifications() {
|
||||
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--text-muted)">Could not load notifications.</div>';
|
||||
return;
|
||||
}
|
||||
renderNotifications(d.data || [], d.unread_count || 0);
|
||||
renderNotifications(d.data || [], d.unread_count || 0, d.pagination?.total || 0);
|
||||
})
|
||||
.catch(() => {
|
||||
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--danger)">Failed to load notifications.</div>';
|
||||
});
|
||||
}
|
||||
|
||||
function renderNotifications(items, unreadCount) {
|
||||
function renderNotifications(items, unreadCount, total) {
|
||||
const list = document.getElementById('notifList');
|
||||
|
||||
if (!items.length) {
|
||||
@@ -85,6 +85,13 @@ function renderNotifications(items, unreadCount) {
|
||||
+ (n.is_read ? '' : '<div class="notif-dot"></div>')
|
||||
+ '</div>';
|
||||
});
|
||||
|
||||
if (total > items.length) {
|
||||
html += '<a href="/notifications" class="notif-view-all">'
|
||||
+ 'View all notifications (' + total + ' total)'
|
||||
+ '</a>';
|
||||
}
|
||||
|
||||
list.innerHTML = html;
|
||||
|
||||
document.getElementById('markAllReadBtn').style.display = unreadCount > 0 ? 'inline-flex' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user