clear notification by toggling them off and back on

This commit is contained in:
KingKDot
2026-05-15 18:57:23 -05:00
parent 5aa3a304a8
commit b68aa4a4c7
6 changed files with 72 additions and 4 deletions
@@ -2,6 +2,7 @@ import {
startNotificationClient,
subscribeNotifications,
subscribeClientEvents,
subscribeNotificationsCleared,
subscribeReady,
subscribeStatus,
markAllNotificationsRead,
@@ -338,6 +339,18 @@ function clearTable() {
applyTableView();
}
function removeEntriesForClient(clientId) {
if (!clientId) return;
let removed = false;
for (const [uid, entry] of tableState.entries) {
if (entry.item?.clientId === clientId) {
tableState.entries.delete(uid);
removed = true;
}
}
if (removed) applyTableView();
}
// ── Client ID cell (collapsed by default, click to expand) ──────────────────
const CLIENT_ID_SHORT_LEN = 8;
@@ -718,6 +731,7 @@ function connect() {
subscribeNotifications((item) => addNotification(item, true));
subscribeClientEvents((item) => addClientEvent(item));
subscribeNotificationsCleared((clientId) => removeEntriesForClient(clientId));
}
const CLIENT_EVENT_BADGE = {