fix: hand floating chat reminders over to the BGS rail

This commit is contained in:
coyotte508 2026-09-30 14:26:01 +02:00
commit 4199bd5ccf
2 changed files with 5 additions and 3 deletions

View file

@ -394,11 +394,11 @@ export function mountActivity(
refreshAvatars() {
view?.refresh();
},
setUnread(n) {
setUnread(n, notifications = true) {
const badge = root.querySelector(".unread");
badge.textContent = n;
badge.hidden = !n;
shortcut.hidden = !n || analysis;
shortcut.hidden = !notifications || !n || analysis;
shortcut.innerHTML = `${icon("chat")} ${n}`;
shortcut.setAttribute("aria-label", `${t("chat")}: ${n}`);
},

View file

@ -431,6 +431,7 @@ export function mountGame(target, options = {}) {
activity.update(s, analysis, colorBlind);
updateUnread();
}
let chatNotifications = true;
function updateUnread() {
const n = options.chat?.snapshot.unreadIds.length ?? 0;
const badge = play.querySelector(".unread-badge");
@ -438,7 +439,7 @@ export function mountGame(target, options = {}) {
badge.textContent = n;
badge.hidden = !n;
}
activity.setUnread(n);
activity.setUnread(n, chatNotifications);
}
const offChat = options.chat?.subscribe(updateUnread);
function showDialog(html) {
@ -817,6 +818,7 @@ export function mountGame(target, options = {}) {
render();
},
setPreferences(p) {
chatNotifications = p.chatNotifications !== false;
analysis = p.analysis === true;
colorBlind = p.colorBlind === true;
sound = p.sound === true;