fix: remove notifications link from user menu, add view-all button to notification dropdown, fix admin link

This commit is contained in:
2026-06-14 09:31:27 -04:00
parent 74cf9739d6
commit 00bad074d3
3 changed files with 27 additions and 4 deletions

View File

@@ -3300,4 +3300,21 @@ input[type="range"]::-moz-range-track {
overflow-y: auto;
}
.notif-view-all {
display: flex;
align-items: center;
justify-content: center;
padding: 10px 16px;
font-size: 0.82rem;
color: var(--accent);
text-decoration: none;
border-top: 1px solid var(--border-color);
transition: background var(--transition);
}
.notif-view-all:hover {
background: var(--bg-hover);
color: var(--accent-hover);
}

View File

@@ -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';

View File

@@ -169,11 +169,10 @@ if (!isset($user) || $user === null) {
</div>
<div class="dropdown-divider"></div>
<a href="/profile" class="dropdown-item"><i class="fas fa-user-cog"></i> My Account</a>
<a href="/notifications" class="dropdown-item"><i class="fas fa-bell"></i> Notifications</a>
<?php if (is_admin() || is_super_admin()): ?>
<div class="dropdown-divider"></div>
<a href="/admin/audit" class="dropdown-item"><i class="fas fa-history"></i> Audit Log</a>
<a href="/admin" class="dropdown-item"><i class="fas fa-cog"></i> Administration</a>
<a href="/admin/users" class="dropdown-item"><i class="fas fa-users-cog"></i> Administration</a>
<?php endif; ?>
<div class="dropdown-divider"></div>
<form method="POST" action="/logout" style="padding:0;margin:0">