fix: hand floating chat reminders over to the BGS rail
This commit is contained in:
parent
0e9d3cc8ac
commit
1e8e7441a5
3 changed files with 9 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ export function mountActivity(target, { chat, openPlayer, backToBoard } = {}) {
|
|||
</div><button type="button" class="text-button activity-back">Back to board ↑</button></header>
|
||||
<div id="${id}-chat" class="activity-chat" role="tabpanel" aria-labelledby="${id}-chat-tab" hidden></div>
|
||||
<div id="${id}-journal" class="activity-journal" role="tabpanel" aria-labelledby="${id}-journal-tab" hidden><ol class="journal-list" tabindex="0" aria-label="Game journal"></ol></div>`;
|
||||
let chatNotifications = true;
|
||||
const shortcut = document.createElement("button");
|
||||
shortcut.type = "button";
|
||||
shortcut.className = "soup-chat-shortcut";
|
||||
|
|
@ -138,7 +139,7 @@ export function mountActivity(target, { chat, openPlayer, backToBoard } = {}) {
|
|||
count.hidden = !unread;
|
||||
count.textContent = unread;
|
||||
count.setAttribute("aria-label", `${unread} unread messages`);
|
||||
shortcut.hidden = analysis || !unread;
|
||||
shortcut.hidden = !chatNotifications || analysis || !unread;
|
||||
shortcut.innerHTML = `${icon("chat")} Chat <span>${unread}</span>`;
|
||||
shortcut.setAttribute(
|
||||
"aria-label",
|
||||
|
|
@ -148,11 +149,15 @@ export function mountActivity(target, { chat, openPlayer, backToBoard } = {}) {
|
|||
select(active);
|
||||
return {
|
||||
open,
|
||||
setChatNotifications(enabled) {
|
||||
chatNotifications = enabled;
|
||||
shortcut.hidden = !chatNotifications || analysis || !chat?.unread;
|
||||
},
|
||||
setAnalysisMode(value) {
|
||||
analysis = value;
|
||||
tabs.find((tab) => tab.dataset.tab === "chat").hidden = analysis || !chat;
|
||||
select(analysis ? "journal" : active);
|
||||
shortcut.hidden = analysis || !chat?.unread;
|
||||
shortcut.hidden = !chatNotifications || analysis || !chat?.unread;
|
||||
},
|
||||
update(state) {
|
||||
players = state.players;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ registerViewer(
|
|||
},
|
||||
async onPreferences(preferences) {
|
||||
if (!(await localization.setLocale(preferences.locale))) return;
|
||||
ui.setChatNotifications(preferences.chatNotifications !== false);
|
||||
ui.setAnalysisMode(preferences.analysis === true);
|
||||
ui.setColorBlind(preferences[COLOR_BLIND_PREFERENCE.name] === true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ export function mountGame(
|
|||
state = viewerState(s);
|
||||
render();
|
||||
},
|
||||
setChatNotifications: activity.setChatNotifications,
|
||||
setAnalysisMode(analysis) {
|
||||
const button = $('[data-ui="chat"]');
|
||||
if (button) button.hidden = analysis;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue