@hadoku/game-ui 0.1.24 → 0.1.25
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
CHANGED
|
@@ -67,6 +67,8 @@ export interface SeatListProps {
|
|
|
67
67
|
* button is drawn on a member's seat. Gated on `iLead`, never offered on the viewer's own seat.
|
|
68
68
|
*/
|
|
69
69
|
onBotReplace?: (seat: number, memberId: string) => void;
|
|
70
|
+
/** The leader hands the room to a seated member. Absent: no Lead button. Gated on `iLead`, never on the viewer's own seat. */
|
|
71
|
+
onMakeLeader?: (memberId: string) => void;
|
|
70
72
|
}
|
|
71
73
|
/** 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. */
|
|
72
|
-
export declare function SeatList({ slots, iLead, shut, fieldFixed, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace }: SeatListProps): import("react").JSX.Element;
|
|
74
|
+
export declare function SeatList({ slots, iLead, shut, fieldFixed, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace, onMakeLeader }: 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, onBotReplace }) {
|
|
24
|
+
export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace, onMakeLeader }) {
|
|
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 && iLead && (_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" }), 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' }), 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));
|
|
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 || onMakeLeader !== 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" })), onMakeLeader !== undefined && (_jsx(ActionButton, { action: "make-leader", className: "pod-seats__action", "data-testid": "pod-seat-make-leader", "data-seat": seat, "aria-label": `Make ${name} the room leader`, onPress: () => onMakeLeader(id), children: "Lead" }))] }))] }, seat));
|
|
38
38
|
}) }));
|
|
39
39
|
}
|
|
@@ -15,5 +15,7 @@ export interface SpectatorRowProps {
|
|
|
15
15
|
watchDisabled?: boolean;
|
|
16
16
|
/** Drawn under the seats rather than beside them (a pod's strip). */
|
|
17
17
|
under?: boolean;
|
|
18
|
+
/** Given to the leader only: hands the room to a spectator. Drawn on everyone but the viewer. */
|
|
19
|
+
onMakeLeader?: (memberId: string) => void;
|
|
18
20
|
}
|
|
19
|
-
export declare function SpectatorRow({ spectators, myId, leaderId, onWatch, watchDisabled, under }: SpectatorRowProps): import("react").JSX.Element | null;
|
|
21
|
+
export declare function SpectatorRow({ spectators, myId, leaderId, onWatch, watchDisabled, under, onMakeLeader }: SpectatorRowProps): import("react").JSX.Element | null;
|
|
@@ -15,8 +15,8 @@ import { ActionButton } from "../components/ActionButton.js";
|
|
|
15
15
|
import { Avatar, faceOf } from "../components/Avatar.js";
|
|
16
16
|
import { PlayerName } from "../room/look.js";
|
|
17
17
|
import { SEAT_CROWN_PATH } from "./SeatChip.js";
|
|
18
|
-
export function SpectatorRow({ spectators, myId, leaderId, onWatch, watchDisabled = false, under = false }) {
|
|
18
|
+
export function SpectatorRow({ spectators, myId, leaderId, onWatch, watchDisabled = false, under = false, onMakeLeader }) {
|
|
19
19
|
if (spectators.length === 0 && onWatch === undefined)
|
|
20
20
|
return null;
|
|
21
|
-
return (_jsxs("div", { className: under ? 'table-side table-side--under' : 'table-side', "data-testid": "room-spectators", children: [_jsx("h3", { className: "table-side__heading", children: "Spectators" }), _jsxs("ul", { className: "pod-seats", children: [spectators.map((member) => (_jsxs("li", { className: "pod-seats__seat", "data-testid": "room-spectator", "data-member": member.id, "data-mine": member.id === myId ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", children: _jsx(Avatar, { ...faceOf(member), fallback: "initial", name: member.name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), member.id === leaderId && leaderId !== '' && (_jsxs("svg", { className: "pod-seats__crown", 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: member.name, face: faceOf(member), className: "pod-seats__label" })] }, member.id))), onWatch !== undefined && (_jsxs("li", { className: "pod-seats__seat", children: [_jsx(ActionButton, { action: "stand", className: "pod-seats__avatar pod-seats__avatar--open", "data-testid": "seat-stand", "aria-label": "Spectate", disabled: watchDisabled, onPress: onWatch, 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" })] }))] })] }));
|
|
21
|
+
return (_jsxs("div", { className: under ? 'table-side table-side--under' : 'table-side', "data-testid": "room-spectators", children: [_jsx("h3", { className: "table-side__heading", children: "Spectators" }), _jsxs("ul", { className: "pod-seats", children: [spectators.map((member) => (_jsxs("li", { className: "pod-seats__seat", "data-testid": "room-spectator", "data-member": member.id, "data-mine": member.id === myId ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", children: _jsx(Avatar, { ...faceOf(member), fallback: "initial", name: member.name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), member.id === leaderId && leaderId !== '' && (_jsxs("svg", { className: "pod-seats__crown", 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: member.name, face: faceOf(member), className: "pod-seats__label" }), onMakeLeader !== undefined && member.id !== myId && (_jsx("span", { className: "pod-seats__actions", children: _jsx(ActionButton, { action: "make-leader", className: "pod-seats__action", "data-testid": "spectator-make-leader", "data-member": member.id, "aria-label": `Make ${member.name} the room leader`, onPress: () => onMakeLeader(member.id), children: "Lead" }) }))] }, member.id))), onWatch !== undefined && (_jsxs("li", { className: "pod-seats__seat", children: [_jsx(ActionButton, { action: "stand", className: "pod-seats__avatar pod-seats__avatar--open", "data-testid": "seat-stand", "aria-label": "Spectate", disabled: watchDisabled, onPress: onWatch, 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" })] }))] })] }));
|
|
22
22
|
}
|
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.25",
|
|
4
|
+
"gitHead": "7bd6f116fbcfe910127a8ca55b0e23e9b33a84c0",
|
|
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,8 +49,8 @@
|
|
|
49
49
|
"react-dom": "^19.2.8"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
53
|
-
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.
|
|
52
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.25",
|
|
53
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.25",
|
|
54
54
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.27",
|
|
55
55
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.102",
|
|
56
56
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.102",
|