@hadoku/game-ui 0.1.80 → 0.1.81
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/screens/route.d.ts +5 -1
- package/dist/screens/route.js +12 -4
- package/package.json +4 -4
package/dist/screens/route.d.ts
CHANGED
|
@@ -21,11 +21,15 @@ export type Route = {
|
|
|
21
21
|
kind: 'replay';
|
|
22
22
|
matchId: string;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* `tableId` is one table of the room's rounds (`screens/room/TablePage.tsx`); absent is the room itself.
|
|
26
|
+
* `step` is a full-screen step of that table, named by its game.
|
|
27
|
+
*/
|
|
25
28
|
| {
|
|
26
29
|
kind: 'room';
|
|
27
30
|
roomId: string;
|
|
28
31
|
tableId?: string;
|
|
32
|
+
step?: string;
|
|
29
33
|
}
|
|
30
34
|
/** Friend tier and above: each screen renders nothing until the server's `/api/sounds` answers (`canView`). */
|
|
31
35
|
| {
|
package/dist/screens/route.js
CHANGED
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
*
|
|
23
23
|
* `#/` the lobby — the list of rooms, and the only front door
|
|
24
24
|
* `room/<roomId>` a room, at that PATH: who is here, readiness, and the game it is for; once rounds start, the hub
|
|
25
|
-
* `#/room/<roomId>/table/<tableId>` one match of a room's rounds:
|
|
25
|
+
* `#/room/<roomId>/table/<tableId>` one match of a room's rounds: who plays it, where it stands and the way in
|
|
26
|
+
* `#/room/<roomId>/table/<tableId>/<step>` a step of that table that takes the whole screen (the game's own word, `sideboard`)
|
|
26
27
|
* `#/draft/<draftId>` LEGACY — redirects to `#/room/<draftId>`. See below.
|
|
27
28
|
* `#/deck/<draftId>` the deck built out of that draft's pool
|
|
28
29
|
* `#/play` constructed: pick a format and a deck, start a match
|
|
@@ -112,9 +113,14 @@ export function parseRoute(hash) {
|
|
|
112
113
|
const id = decodeSegment(parts[2]);
|
|
113
114
|
return embedAddress.get()(catalogue, view) && id !== '' ? { kind: 'rally-embed', catalogue, id, view } : { kind: 'lobby' };
|
|
114
115
|
}
|
|
115
|
-
if (parts.length === 4 && parts[0] === 'room' && parts[2] === 'table') {
|
|
116
|
+
if ((parts.length === 4 || parts.length === 5) && parts[0] === 'room' && parts[2] === 'table') {
|
|
116
117
|
const [roomId, tableId] = [decodeSegment(parts[1]), decodeSegment(parts[3])];
|
|
117
|
-
|
|
118
|
+
if (roomId === '')
|
|
119
|
+
return { kind: 'lobby' };
|
|
120
|
+
if (tableId === '')
|
|
121
|
+
return { kind: 'room', roomId };
|
|
122
|
+
const step = parts[4];
|
|
123
|
+
return step !== undefined && TABLE_STEP.test(step) ? { kind: 'room', roomId, tableId, step } : { kind: 'room', roomId, tableId };
|
|
118
124
|
}
|
|
119
125
|
if (parts.length !== 2)
|
|
120
126
|
return { kind: 'lobby' };
|
|
@@ -178,7 +184,7 @@ export function routeHash(route) {
|
|
|
178
184
|
case 'replay':
|
|
179
185
|
return `#/replay/${encodeURIComponent(route.matchId)}`;
|
|
180
186
|
case 'room':
|
|
181
|
-
return `#/room/${encodeURIComponent(route.roomId)}${route.tableId === undefined ? '' : `/table/${encodeURIComponent(route.tableId)}`}`;
|
|
187
|
+
return `#/room/${encodeURIComponent(route.roomId)}${route.tableId === undefined ? '' : `/table/${encodeURIComponent(route.tableId)}${route.step === undefined ? '' : `/${route.step}`}`}`;
|
|
182
188
|
case 'stats':
|
|
183
189
|
if (route.player !== undefined)
|
|
184
190
|
return `#/stats/${encodeURIComponent(route.player)}`;
|
|
@@ -191,6 +197,8 @@ export function routeHash(route) {
|
|
|
191
197
|
return `#/embed/${route.catalogue}/${encodeURIComponent(route.id)}/${route.view}`;
|
|
192
198
|
}
|
|
193
199
|
}
|
|
200
|
+
/** A table's step in an address: a plain word. */
|
|
201
|
+
const TABLE_STEP = /^[a-z][a-z-]*$/;
|
|
194
202
|
/** A room's own page, not one of its tables: the one route whose address is a path. */
|
|
195
203
|
function roomPage(route) {
|
|
196
204
|
return route.kind === 'room' && route.tableId === undefined ? route.roomId : null;
|
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.81",
|
|
4
|
+
"gitHead": "1a3573c1826fba797814c0e5198c8edbbad3f831",
|
|
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.85",
|
|
53
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.85",
|
|
54
54
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.31",
|
|
55
55
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.125",
|
|
56
56
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.125",
|