add active class to selected filter

show no-notifs if there are no unreads
This commit is contained in:
Barış Soner Uşaklı
2026-03-16 21:07:44 -04:00
parent 19bb37cae8
commit d458eadb66
2 changed files with 5 additions and 2 deletions

View File

@@ -108,7 +108,7 @@
"nodebb-plugin-spam-be-gone": "2.3.2",
"nodebb-plugin-web-push": "0.7.7",
"nodebb-rewards-essentials": "1.0.2",
"nodebb-theme-harmony": "2.2.58",
"nodebb-theme-harmony": "2.2.59",
"nodebb-theme-lavender": "7.1.21",
"nodebb-theme-peace": "2.2.57",
"nodebb-theme-persona": "14.2.32",

View File

@@ -24,7 +24,8 @@ define('forum/header/notifications', function () {
dropdownEl.on('click', '[data-filter]', (e) => {
const filter = e.target.getAttribute('data-filter');
dropdownEl.find('[data-filter]').removeClass('active');
e.target.classList.add('active');
if (filter === 'unread') {
listEl.get(0).querySelectorAll('[data-nid]:not(.unread)').forEach((e) => {
e.classList.toggle('hidden', true);
@@ -34,6 +35,8 @@ define('forum/header/notifications', function () {
e.classList.toggle('hidden', false);
});
}
const visibleNotifCount = dropdownEl.find('[data-nid]:not(.hidden)').length;
dropdownEl.find('.no-notifs').toggleClass('hidden', visibleNotifCount !== 0);
});
});