@hadoku/game-ui 0.1.19 → 0.1.20
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/dist/seats/SeatChip.d.ts +14 -7
- package/dist/seats/SeatChip.js +2 -2
- package/package.json +4 -4
package/dist/seats/SeatChip.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface SeatSlot {
|
|
|
30
30
|
}
|
|
31
31
|
export interface SeatListProps {
|
|
32
32
|
slots: readonly SeatSlot[];
|
|
33
|
-
/** Whether the viewer leads the room: gates Close/Open, and an open seat's Close past `realSeatCount`. */
|
|
33
|
+
/** Whether the viewer leads the room: gates Close/Open, Remove/Bot on a member's seat, and an open seat's Close past `realSeatCount`. */
|
|
34
34
|
iLead: boolean;
|
|
35
35
|
/** An event's room before its seats open: nobody sits, nor gives a seat to the bot. */
|
|
36
36
|
shut?: boolean;
|
|
@@ -47,13 +47,20 @@ export interface SeatListProps {
|
|
|
47
47
|
onOpenSeat?: (seat: number) => void;
|
|
48
48
|
/**
|
|
49
49
|
* The leader removes a SEATED human (never a bot — that is `onBotOff`), landing them a
|
|
50
|
-
* spectator (
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* elsewhere, not a self-removal.
|
|
50
|
+
* spectator (`rooms-protocol`'s seat op, wave 119 §P/§S, wave 120 §S2's wiring). Absent: no
|
|
51
|
+
* Remove button is drawn on anyone's seat, which keeps a caller wired only up to
|
|
52
|
+
* `onCloseSeat`/`onBotOn` (today's `PodSeats.tsx`) byte-identical to before this lift. Gated on
|
|
53
|
+
* `iLead` same as Close/Open, and never offered on the viewer's own seat (`occupant.mine`):
|
|
54
|
+
* standing is `onSit` elsewhere, not a self-removal.
|
|
55
55
|
*/
|
|
56
56
|
onRemoveMember?: (seat: number, memberId: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* The leader puts the bot in a SEATED human's place, in one action (wave 120 §S2) — the
|
|
59
|
+
* generic `seats/bot` op, addressed by seat; distinct from `onBotOn`, which only ever offers
|
|
60
|
+
* the bot an OPEN seat (today's one add-bot affordance for an empty one). Absent: no Bot
|
|
61
|
+
* button is drawn on a member's seat. Gated on `iLead`, never offered on the viewer's own seat.
|
|
62
|
+
*/
|
|
63
|
+
onBotReplace?: (seat: number, memberId: string) => void;
|
|
57
64
|
}
|
|
58
65
|
/** A strip of seats, one `<li>` each: dashed-open / "×"-closed / the bot's own look / a member's avatar, a label underneath, every action its own always-visible button. */
|
|
59
|
-
export declare function SeatList({ slots, iLead, shut, fieldFixed, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember }: SeatListProps): import("react").JSX.Element;
|
|
66
|
+
export declare function SeatList({ slots, iLead, shut, fieldFixed, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace }: SeatListProps): import("react").JSX.Element;
|
package/dist/seats/SeatChip.js
CHANGED
|
@@ -21,7 +21,7 @@ import { StatusPill } from "../components/StatusPill.js";
|
|
|
21
21
|
/** The same crown `magic-room-ui.tsx` draws for its own direct uses — duplicated, not imported, so this file pulls in nothing of Magic's. */
|
|
22
22
|
export const SEAT_CROWN_PATH = 'M2 9V3.5l2.2 2L6 2.6l1.8 2.9L10 3.5V9Z';
|
|
23
23
|
/** A strip of seats, one `<li>` each: dashed-open / "×"-closed / the bot's own look / a member's avatar, a label underneath, every action its own always-visible button. */
|
|
24
|
-
export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember }) {
|
|
24
|
+
export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace }) {
|
|
25
25
|
return (_jsx("ul", { className: "pod-seats", "data-testid": "pod-seats", children: slots.map(({ seat, occupant }) => {
|
|
26
26
|
if (occupant.kind === 'open') {
|
|
27
27
|
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, children: [_jsx(ActionButton, { action: "sit", className: "pod-seats__avatar pod-seats__avatar--open", "data-testid": "pod-seat-sit", "data-seat": seat, "aria-label": `Sit in seat ${seat + 1}`, disabled: shut || (mySeat !== null && seat >= realSeatCount), onPress: () => onSit?.(seat), children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M12 5v14M5 12h14" }) }) }), _jsx("span", { className: "pod-seats__label", children: "Open" }), !fieldFixed && (_jsxs("span", { className: "pod-seats__actions", children: [_jsx(ActionButton, { action: "ai", className: "pod-seats__action", "data-testid": "pod-seat-ai", "data-seat": seat, "aria-label": `Fill seat ${seat + 1} with AI`, disabled: shut, onPress: () => onBotOn?.(seat), children: "AI" }), iLead && seat < realSeatCount && (_jsx(ActionButton, { action: "close", className: "pod-seats__action", "data-testid": "pod-seat-close", "data-seat": seat, "aria-label": `Close seat ${seat + 1}`, onPress: () => onCloseSeat?.(seat), children: "Close" }))] }))] }, seat));
|
|
@@ -34,6 +34,6 @@ export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realS
|
|
|
34
34
|
}
|
|
35
35
|
const { id, name, avatarId, look, ready, leader, mine } = occupant;
|
|
36
36
|
const face = { id: avatarId ?? null, look };
|
|
37
|
-
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-mine": mine ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", "data-ready": ready ? 'true' : 'false', children: _jsx(Avatar, { ...face, fallback: "initial", name: name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), leader && (_jsxs("svg", { className: "pod-seats__crown", "data-testid": `pod-seat-${seat}-leader`, viewBox: "0 0 12 12", role: "img", "aria-label": "Room owner", children: [_jsx("title", { children: "Room owner" }), _jsx("path", { d: SEAT_CROWN_PATH })] }))] }), _jsx(PlayerName, { name: name, face: face, className: "pod-seats__label" }), _jsx(StatusPill, { testId: `pod-seat-${seat}-ready`, state: ready ? 'yes' : 'no', mark: ready ? 'tick' : 'ring', label: ready ? 'ready' : 'not ready' }), onRemoveMember !== undefined
|
|
37
|
+
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-mine": mine ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", "data-ready": ready ? 'true' : 'false', children: _jsx(Avatar, { ...face, fallback: "initial", name: name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), leader && (_jsxs("svg", { className: "pod-seats__crown", "data-testid": `pod-seat-${seat}-leader`, viewBox: "0 0 12 12", role: "img", "aria-label": "Room owner", children: [_jsx("title", { children: "Room owner" }), _jsx("path", { d: SEAT_CROWN_PATH })] }))] }), _jsx(PlayerName, { name: name, face: face, className: "pod-seats__label" }), _jsx(StatusPill, { testId: `pod-seat-${seat}-ready`, state: ready ? 'yes' : 'no', mark: ready ? 'tick' : 'ring', label: ready ? 'ready' : 'not ready' }), iLead && !mine && (onRemoveMember !== undefined || onBotReplace !== undefined) && (_jsxs("span", { className: "pod-seats__actions", children: [onRemoveMember !== undefined && (_jsx(ActionButton, { action: "remove", className: "pod-seats__action", "data-testid": "pod-seat-remove", "data-seat": seat, "aria-label": `Remove ${name} from the table`, onPress: () => onRemoveMember(seat, id), children: "Remove" })), onBotReplace !== undefined && (_jsx(ActionButton, { action: "bot-replace", className: "pod-seats__action", "data-testid": "pod-seat-bot-replace", "data-seat": seat, "aria-label": `Put the bot in ${name}'s seat`, onPress: () => onBotReplace(seat, id), children: "Bot" }))] }))] }, seat));
|
|
38
38
|
}) }));
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-ui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.20",
|
|
4
|
+
"gitHead": "368a12a609c1d1ebb096c5b78e18ca64a098c4a6",
|
|
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.",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"react-dom": "^19.2.8"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
25
|
-
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.
|
|
24
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.20",
|
|
25
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.20",
|
|
26
26
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.27",
|
|
27
27
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.99",
|
|
28
28
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.99",
|