powergrid-viewer 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powergrid-viewer",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/boardgamers/powergrid.git",
package/src/game-chat.ts CHANGED
@@ -36,8 +36,10 @@ export function mountGameChat(emitter: ViewerEmitter<any, any>, host: Element):
36
36
  .chat-suggestions button[aria-pressed="true"]{outline:2px solid #527f89}
37
37
  .bgs-game-chat .chat-status{font-size:12px;margin-top:6px}
38
38
  .bgs-game-chat .chat-status:empty{display:none}
39
- .chat-shortcut{position:fixed;left:16px;bottom:max(16px,env(safe-area-inset-bottom));z-index:900;padding:7px 12px;border:1px solid #6a8589;border-radius:3px;background:#263521;color:#fff;font:600 14px Arial,sans-serif;cursor:pointer;box-shadow:0 2px 6px #0003}
39
+ .chat-shortcut{position:fixed;right:89px;bottom:max(17px,env(safe-area-inset-bottom));z-index:900;display:inline-flex;align-items:center;gap:7px;box-sizing:border-box;height:40px;padding:0 10px 0 13px;border:1px solid #6a8589;border-radius:20px;background:#263521;color:#fff;font:600 14px Arial,sans-serif;cursor:pointer;box-shadow:0 2px 6px #0003}
40
40
  .chat-shortcut[hidden]{display:none}
41
+ .chat-shortcut svg{flex:none}
42
+ .chat-shortcut-count{box-sizing:border-box;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:#f2c230;color:#172d34;font:700 12px/22px Arial,sans-serif;text-align:center}
41
43
  .game-feed-tabs{display:none}
42
44
  @media(max-width:700px){
43
45
  .game-feed-tabs{display:flex;gap:4px;margin-top:8px}
@@ -58,6 +60,14 @@ export function mountGameChat(emitter: ViewerEmitter<any, any>, host: Element):
58
60
  shortcut.type = 'button';
59
61
  shortcut.className = 'chat-shortcut';
60
62
  shortcut.hidden = true;
63
+ // Bottom-right, just left of the platform's settings gear (fixed at right:25px, 45px wide):
64
+ // the slot the platform's own chat button used. Shown only for unread messages, since the
65
+ // feed itself is always reachable below the board.
66
+ shortcut.innerHTML =
67
+ '<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M3.5 1.5h9A1.5 1.5 0 0 1 14 3v6.5A1.5 1.5 0 0 1 12.5 11H6.6l-3.3 2.8a.5.5 0 0 1-.8-.4V11A1.5 1.5 0 0 1 2 9.5V3a1.5 1.5 0 0 1 1.5-1.5z"/></svg><span>Chat</span>';
68
+ const shortcutCount = document.createElement('span');
69
+ shortcutCount.className = 'chat-shortcut-count';
70
+ shortcut.append(shortcutCount);
61
71
  (host.querySelector('.chat-tabs-host') || slot).append(shortcut);
62
72
  const feeds = host.querySelector<HTMLElement>('.journal-and-chat');
63
73
  const tabs = document.createElement('nav');
@@ -100,8 +110,8 @@ export function mountGameChat(emitter: ViewerEmitter<any, any>, host: Element):
100
110
  function updateShortcut() {
101
111
  const count = chat.unread;
102
112
  const label = count ? `Chat · ${count} unread` : 'Chat';
103
- shortcut.textContent = label;
104
- shortcut.hidden = chatVisible;
113
+ shortcutCount.textContent = String(count);
114
+ shortcut.hidden = chatVisible || !count;
105
115
  shortcut.setAttribute('aria-label', `Open ${label}`);
106
116
  chatTab.textContent = label;
107
117
  }