@hadoku/game-ui 0.1.88 → 0.1.90

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.
@@ -20,4 +20,6 @@ export declare function GameAppShell(props: GameAppShellProps): import("react").
20
20
  * does not fetch whoami a second time. An identity HINT, never a way to present a tier the edge did
21
21
  * not assign: every gate that matters is enforced server-side off the edge-stamped tier.
22
22
  */
23
- export declare function GameHeader(props: Omit<AppHeaderProps, 'settingsProps'>): import("react").JSX.Element;
23
+ export declare function GameHeader({ children, appTabs, ...props }: Omit<AppHeaderProps, 'settingsProps'>): import("react").JSX.Element;
24
+ /** The `appTabs` id `GameHeader` adds the chat sound switch to. */
25
+ export declare const SOUND_TAB_ID = "sound";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /*
3
3
  * A game's standalone page frame: everything a game's `App.tsx` would otherwise copy.
4
4
  *
@@ -23,7 +23,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
23
23
  * This is the standalone page only. Embedded in a host's page the room and the theme are the host's,
24
24
  * and a game draws none of this (`@hadoku/ui-shell/embed`'s `mountEmbed`).
25
25
  */
26
- import { useRef } from 'react';
26
+ import { lazy, Suspense, useRef } from 'react';
27
27
  import { AppHeader, LoadingSkeleton } from '@wolffm/task-ui-components';
28
28
  import { HadokuThemeRoot, useHadokuTheme, usePlatform } from '@wolffm/themes';
29
29
  import { useResolvedWhoami, useWhoami, WhoProvider } from "../room/whoami.js";
@@ -44,8 +44,23 @@ function ShellInner({ containerRef, className, children }) {
44
44
  * does not fetch whoami a second time. An identity HINT, never a way to present a tier the edge did
45
45
  * not assign: every gate that matters is enforced server-side off the edge-stamped tier.
46
46
  */
47
- export function GameHeader(props) {
47
+ export function GameHeader({ children, appTabs, ...props }) {
48
48
  const who = useWhoami();
49
49
  const viewer = who === 'pending' ? null : who;
50
- return _jsx(AppHeader, { ...props, settingsProps: viewer === null ? undefined : { userType: viewer.tier, name: viewer.name } });
50
+ // The room chat's sound switch goes beside the game's own sound settings when it has a Sound tab,
51
+ // else in the App tab: never a tab of its own for one row.
52
+ const soundTab = appTabs?.some((t) => t.id === SOUND_TAB_ID) ?? false;
53
+ return (_jsx(AppHeader, { ...props, settingsProps: viewer === null ? undefined : { userType: viewer.tier, name: viewer.name }, appTabs: soundTab ? appTabs.map((t) => (t.id === SOUND_TAB_ID ? { ...t, render: () => _jsxs(_Fragment, { children: [t.render(), chatSound] }) } : t)) : appTabs,
54
+ // Passed only when it holds something: any `children` at all draws an App tab.
55
+ children: soundTab ? children : _jsxs(_Fragment, { children: [children, chatSound] }) }));
51
56
  }
57
+ /** The `appTabs` id `GameHeader` adds the chat sound switch to. */
58
+ export const SOUND_TAB_ID = 'sound';
59
+ /**
60
+ * The room chat's "Chat sound" on/off (watchparty's chime after a quiet minute). It is watchparty's,
61
+ * from the same room-chrome module `RoomShell` loads, so it writes the store that chrome's chime
62
+ * reads. Lazy: the popout renders a tab only while it is open, so the chunk is fetched then (and
63
+ * usually already is, for the room).
64
+ */
65
+ const ChatSoundSetting = lazy(() => import('@wolffm/watchparty-ui/room-chrome').then((m) => ({ default: m.ChatSoundSetting })));
66
+ const chatSound = (_jsx(Suspense, { fallback: null, children: _jsx(ChatSoundSetting, {}) }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-ui",
3
- "version": "0.1.88",
4
- "gitHead": "a48a97a570e6e442a8ea745c5c18eaad41f1bfdd",
3
+ "version": "0.1.90",
4
+ "gitHead": "bb7f33730fddc9dab093eee5a537e289c8e0d4a1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "The browser parts any hosted game shares, above ui-shell: the room shell and session, seats and looks, the room route, the front page's generic pieces (gate, polls, gallery, patch notes), the bundle slot and relay channel a game's client mounts in, settings and trim screens, the HTTP and socket helpers, and the generic components (modal, popover, avatar, action button, radio cards). Knows no game; Magic's UI (games/magic/ui) plugs in, composed by the site (apps/ui). MIT; imports only react, react-dom, socket.io-client, @wolffm/* and the platform packages.",
@@ -49,14 +49,14 @@
49
49
  "react-dom": "^19.2.8"
50
50
  },
51
51
  "dependencies": {
52
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.92",
53
- "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.92",
52
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.94",
53
+ "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.94",
54
54
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.31",
55
- "@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.127",
56
- "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.127",
55
+ "@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.128",
56
+ "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.128",
57
57
  "@wolffm/task-ui-components": "npm:@hadoku/task-ui-components@^4.23.44",
58
58
  "@wolffm/themes": "npm:@hadoku/themes@^5.14.13",
59
- "@wolffm/watchparty-ui": "npm:@hadoku/watchparty-ui@^0.45.127",
59
+ "@wolffm/watchparty-ui": "npm:@hadoku/watchparty-ui@^0.45.128",
60
60
  "socket.io-client": "^4.8.3",
61
61
  "zod": "4.5.4"
62
62
  },