@sensiblestats/widget-react 0.58.0 → 0.59.0
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +480 -392
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +330 -242
- package/dist/index.js.map +1 -1
- package/dist/styles.css +25 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/StatsWidget.tsx
|
|
39
|
-
var
|
|
39
|
+
var import_react41 = require("react");
|
|
40
40
|
var import_widget_sdk5 = require("@sensiblestats/widget-sdk");
|
|
41
41
|
|
|
42
42
|
// src/kickoff.ts
|
|
@@ -1933,7 +1933,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
1935
|
// src/components/ChatPanel.tsx
|
|
1936
|
-
var
|
|
1936
|
+
var import_react40 = require("react");
|
|
1937
1937
|
|
|
1938
1938
|
// src/components/ChatHeader.tsx
|
|
1939
1939
|
var import_react11 = require("react");
|
|
@@ -4036,7 +4036,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
4036
4036
|
}
|
|
4037
4037
|
|
|
4038
4038
|
// src/components/GamesPanel.tsx
|
|
4039
|
-
var
|
|
4039
|
+
var import_react38 = require("react");
|
|
4040
4040
|
|
|
4041
4041
|
// src/components/GamesLoginWall.tsx
|
|
4042
4042
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -4170,7 +4170,7 @@ function GamesHub({
|
|
|
4170
4170
|
}
|
|
4171
4171
|
|
|
4172
4172
|
// src/components/GameScreenHost.tsx
|
|
4173
|
-
var
|
|
4173
|
+
var import_react37 = require("react");
|
|
4174
4174
|
|
|
4175
4175
|
// src/useGamePlay.ts
|
|
4176
4176
|
var import_react28 = require("react");
|
|
@@ -4245,7 +4245,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, refresh }) {
|
|
|
4245
4245
|
}
|
|
4246
4246
|
|
|
4247
4247
|
// src/components/games/MysteryTigerGame.tsx
|
|
4248
|
-
var
|
|
4248
|
+
var import_react30 = require("react");
|
|
4249
4249
|
|
|
4250
4250
|
// src/components/games/nationFlags.ts
|
|
4251
4251
|
var FLAGS = {
|
|
@@ -4328,8 +4328,29 @@ function nationalityFlag(nationality) {
|
|
|
4328
4328
|
return FLAGS[key] ?? nationality.slice(0, 3).toUpperCase();
|
|
4329
4329
|
}
|
|
4330
4330
|
|
|
4331
|
-
// src/components/games/
|
|
4331
|
+
// src/components/games/PlayerAvatar.tsx
|
|
4332
|
+
var import_react29 = require("react");
|
|
4332
4333
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4334
|
+
function initialsOf(name) {
|
|
4335
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
4336
|
+
const first = parts[0];
|
|
4337
|
+
if (!first) return "?";
|
|
4338
|
+
const last = parts[parts.length - 1];
|
|
4339
|
+
if (parts.length === 1 || !last) return first.slice(0, 2).toUpperCase();
|
|
4340
|
+
return ((first[0] ?? "") + (last[0] ?? "")).toUpperCase();
|
|
4341
|
+
}
|
|
4342
|
+
function PlayerAvatar({
|
|
4343
|
+
name,
|
|
4344
|
+
imagePath,
|
|
4345
|
+
className
|
|
4346
|
+
}) {
|
|
4347
|
+
const [failed, setFailed] = (0, import_react29.useState)(false);
|
|
4348
|
+
const showImage = Boolean(imagePath) && !failed;
|
|
4349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
// src/components/games/MysteryTigerGame.tsx
|
|
4353
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4333
4354
|
function parseClientState(json) {
|
|
4334
4355
|
if (!json) return null;
|
|
4335
4356
|
try {
|
|
@@ -4352,6 +4373,14 @@ var ATTR_KEYS = [
|
|
|
4352
4373
|
"shirtNumber",
|
|
4353
4374
|
"apps"
|
|
4354
4375
|
];
|
|
4376
|
+
var PROFILE_ROWS = [
|
|
4377
|
+
{ key: "position", label: "Position" },
|
|
4378
|
+
{ key: "nationality", label: "Nationality" },
|
|
4379
|
+
{ key: "age", label: "Age" },
|
|
4380
|
+
{ key: "shirtNumber", label: "Jersey number" },
|
|
4381
|
+
{ key: "apps", label: "Match count" }
|
|
4382
|
+
];
|
|
4383
|
+
var MAX_GUESSES = 6;
|
|
4355
4384
|
function verdictGlyph(v) {
|
|
4356
4385
|
if (v.verdict === "exact") return "\u2713";
|
|
4357
4386
|
if (v.verdict === "miss") return "\u2717";
|
|
@@ -4374,12 +4403,17 @@ function MysteryTigerGame({
|
|
|
4374
4403
|
submitting,
|
|
4375
4404
|
onSubmit
|
|
4376
4405
|
}) {
|
|
4377
|
-
const [query, setQuery] = (0,
|
|
4378
|
-
const
|
|
4406
|
+
const [query, setQuery] = (0, import_react30.useState)("");
|
|
4407
|
+
const [portraitFailed, setPortraitFailed] = (0, import_react30.useState)(false);
|
|
4408
|
+
const inputId = (0, import_react30.useId)();
|
|
4379
4409
|
const clientState = parseClientState(result?.clientStateJson);
|
|
4380
4410
|
const guessResults = clientState?.guessResults ?? [];
|
|
4381
4411
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
4412
|
+
const shirtEnabled = config?.shirtTileEnabled ?? clientState?.shirtTileEnabled ?? false;
|
|
4382
4413
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
4414
|
+
const guessesUsed = clientState?.guessesUsed ?? guessResults.length;
|
|
4415
|
+
const revealPhoto = isOver && Boolean(clientState?.revealedPlayerImagePath) && !portraitFailed;
|
|
4416
|
+
const revealName = isOver ? clientState?.revealedPlayerName : void 0;
|
|
4383
4417
|
const filtered = config && !isOver ? config.squadPlayers.filter(
|
|
4384
4418
|
(p) => !alreadyGuessedIds.has(p.id) && p.name.toLowerCase().includes(query.toLowerCase())
|
|
4385
4419
|
) : [];
|
|
@@ -4390,43 +4424,61 @@ function MysteryTigerGame({
|
|
|
4390
4424
|
setQuery("");
|
|
4391
4425
|
onSubmit(JSON.stringify({ guesses: newGuesses }));
|
|
4392
4426
|
}
|
|
4393
|
-
return /* @__PURE__ */ (0,
|
|
4394
|
-
!config && /* @__PURE__ */ (0,
|
|
4395
|
-
config && /* @__PURE__ */ (0,
|
|
4396
|
-
/* @__PURE__ */ (0,
|
|
4397
|
-
/* @__PURE__ */ (0,
|
|
4398
|
-
/* @__PURE__ */ (0,
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
4427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt", "data-testid": "game-screen-mystery-tiger", children: [
|
|
4428
|
+
!config && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
4429
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt-head", children: [
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-title", children: "Mystery Tiger" }),
|
|
4433
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-sub", children: "Guess today's squad player" })
|
|
4400
4434
|
] }),
|
|
4401
|
-
clientState && !isOver && /* @__PURE__ */ (0,
|
|
4435
|
+
clientState && !isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ss-w-gt-left", children: [
|
|
4402
4436
|
clientState.guessesRemaining,
|
|
4403
4437
|
" left"
|
|
4404
4438
|
] })
|
|
4405
4439
|
] }),
|
|
4406
|
-
/* @__PURE__ */ (0,
|
|
4407
|
-
|
|
4440
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gscroll", children: [
|
|
4441
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ss-w-gt-card${isOver ? " ss-w-gt-card--reveal" : ""}`, children: [
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-sil", children: revealPhoto ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4443
|
+
"img",
|
|
4444
|
+
{
|
|
4445
|
+
src: clientState.revealedPlayerImagePath,
|
|
4446
|
+
alt: "",
|
|
4447
|
+
onError: () => setPortraitFailed(true)
|
|
4448
|
+
}
|
|
4449
|
+
) : isOver && revealName ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(revealName) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("svg", { viewBox: "0 0 96 118", role: "img", "aria-label": "hidden player silhouette", children: [
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("circle", { cx: "48", cy: "40", r: "21", fill: "var(--ss-w-faint)" }),
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M8 118c0-25 18-39 40-39s40 14 40 39z", fill: "var(--ss-w-faint)" })
|
|
4452
|
+
] }) }),
|
|
4453
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-attrs", children: PROFILE_ROWS.filter((r) => r.key !== "shirtNumber" || shirtEnabled).map((row) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt-attr", children: [
|
|
4454
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ss-w-gt-attr-k", children: row.label }),
|
|
4455
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ss-w-gt-attr-v", children: "\u2022\u2022\u2022" })
|
|
4456
|
+
] }, row.key)) })
|
|
4457
|
+
] }),
|
|
4458
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-dots", "aria-label": `${guessesUsed} of ${MAX_GUESSES} guesses used`, children: Array.from({ length: MAX_GUESSES }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("i", { className: i < guessesUsed ? "ss-w-gt-dot ss-w-gt-dot--on" : "ss-w-gt-dot" }, i)) }),
|
|
4459
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt-lead", children: [
|
|
4408
4460
|
guessResults.length === 0 ? "Guess a squad player \u2014 each guess compares it to the mystery player on Pos, Nat, Age, Shirt & Apps: " : "Tiles: ",
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4410
|
-
/* @__PURE__ */ (0,
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ss-w-gt-key", children: [
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("b", { className: "ss-w-gt-key-ok", children: "\u2713" }),
|
|
4411
4463
|
" match \xB7 ",
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
4464
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("b", { children: "\u25B2" }),
|
|
4413
4465
|
" higher \xB7 ",
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("b", { children: "\u25BC" }),
|
|
4415
4467
|
" lower"
|
|
4416
4468
|
] })
|
|
4417
4469
|
] }),
|
|
4418
|
-
guessResults.length > 0 && /* @__PURE__ */ (0,
|
|
4470
|
+
guessResults.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gtrows", children: guessResults.map((gr, i) => {
|
|
4419
4471
|
const player = config.squadPlayers.find((p) => p.id === gr.playerId);
|
|
4420
|
-
return /* @__PURE__ */ (0,
|
|
4421
|
-
/* @__PURE__ */ (0,
|
|
4472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gtguess", children: [
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gtguess-nm", children: [
|
|
4422
4474
|
i + 1,
|
|
4423
4475
|
" \xB7 ",
|
|
4424
4476
|
player?.name ?? `#${gr.playerId}`
|
|
4425
4477
|
] }),
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gtrow", children: ATTR_KEYS.map((key) => {
|
|
4427
4479
|
const v = gr[key];
|
|
4428
4480
|
const arrow = directionArrow(v);
|
|
4429
|
-
return /* @__PURE__ */ (0,
|
|
4481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4430
4482
|
"div",
|
|
4431
4483
|
{
|
|
4432
4484
|
className: `ss-w-gtile ss-w-gtile--${v.verdict}`,
|
|
@@ -4434,10 +4486,10 @@ function MysteryTigerGame({
|
|
|
4434
4486
|
"data-verdict": v.verdict,
|
|
4435
4487
|
"aria-label": `${ATTR_LABELS[key]}: ${v.value ?? v.verdict}${v.direction ? ` ${v.direction}` : ""}`,
|
|
4436
4488
|
children: [
|
|
4437
|
-
/* @__PURE__ */ (0,
|
|
4438
|
-
/* @__PURE__ */ (0,
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ss-w-gtile-lab", children: ATTR_LABELS[key] }),
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ss-w-gtile-v", "aria-hidden": "true", children: [
|
|
4439
4491
|
tileFace(key, v),
|
|
4440
|
-
arrow && /* @__PURE__ */ (0,
|
|
4492
|
+
arrow && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ss-w-gtile-dir", children: arrow })
|
|
4441
4493
|
] })
|
|
4442
4494
|
]
|
|
4443
4495
|
},
|
|
@@ -4446,14 +4498,14 @@ function MysteryTigerGame({
|
|
|
4446
4498
|
}) })
|
|
4447
4499
|
] }, gr.playerId);
|
|
4448
4500
|
}) }),
|
|
4449
|
-
clientState?.hintLine && !isOver && /* @__PURE__ */ (0,
|
|
4501
|
+
clientState?.hintLine && !isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt-hint", children: [
|
|
4450
4502
|
"\u{1F4A1} ",
|
|
4451
4503
|
clientState.hintLine
|
|
4452
4504
|
] }),
|
|
4453
|
-
isOver && clientState && /* @__PURE__ */ (0,
|
|
4454
|
-
/* @__PURE__ */ (0,
|
|
4455
|
-
clientState.revealedPlayerName && /* @__PURE__ */ (0,
|
|
4456
|
-
/* @__PURE__ */ (0,
|
|
4505
|
+
isOver && clientState && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ss-w-gt-banner ss-w-gt-banner--${clientState.solved ? "solved" : "failed"}`, children: [
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-banner-label", children: clientState.solved ? "\u{1F42F} You found them!" : "\u{1F614} Out of guesses" }),
|
|
4507
|
+
clientState.revealedPlayerName && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gt-banner-name", children: clientState.revealedPlayerName }),
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gt-banner-sub", children: [
|
|
4457
4509
|
clientState.guessesUsed,
|
|
4458
4510
|
" guess",
|
|
4459
4511
|
clientState.guessesUsed === 1 ? "" : "es",
|
|
@@ -4461,8 +4513,8 @@ function MysteryTigerGame({
|
|
|
4461
4513
|
] })
|
|
4462
4514
|
] })
|
|
4463
4515
|
] }),
|
|
4464
|
-
!isOver && /* @__PURE__ */ (0,
|
|
4465
|
-
/* @__PURE__ */ (0,
|
|
4516
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ss-w-gpin ss-w-gtta", children: [
|
|
4517
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4466
4518
|
"input",
|
|
4467
4519
|
{
|
|
4468
4520
|
id: inputId,
|
|
@@ -4478,7 +4530,7 @@ function MysteryTigerGame({
|
|
|
4478
4530
|
"aria-autocomplete": "list"
|
|
4479
4531
|
}
|
|
4480
4532
|
),
|
|
4481
|
-
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
4533
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-gtta-drop", role: "listbox", children: filtered.map((p) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4482
4534
|
"div",
|
|
4483
4535
|
{
|
|
4484
4536
|
className: "ss-w-gtta-opt",
|
|
@@ -4499,7 +4551,7 @@ function MysteryTigerGame({
|
|
|
4499
4551
|
}
|
|
4500
4552
|
|
|
4501
4553
|
// src/components/games/HigherOrLowerGame.tsx
|
|
4502
|
-
var
|
|
4554
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4503
4555
|
var POINTS_PER_CORRECT = 10;
|
|
4504
4556
|
function parseClientState2(json) {
|
|
4505
4557
|
if (!json) return null;
|
|
@@ -4531,38 +4583,45 @@ function HigherOrLowerGame({
|
|
|
4531
4583
|
const newAnswers = [...prevAnswers, { pairIndex: currentPair.pairIndex, pick }];
|
|
4532
4584
|
onSubmit(JSON.stringify({ answers: newAnswers }));
|
|
4533
4585
|
}
|
|
4534
|
-
return /* @__PURE__ */ (0,
|
|
4535
|
-
!config && /* @__PURE__ */ (0,
|
|
4536
|
-
config && /* @__PURE__ */ (0,
|
|
4537
|
-
/* @__PURE__ */ (0,
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4539
|
-
/* @__PURE__ */ (0,
|
|
4540
|
-
/* @__PURE__ */ (0,
|
|
4586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl", "data-testid": "game-screen-higher-or-lower", children: [
|
|
4587
|
+
!config && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
4588
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-head", children: [
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { children: [
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hl-title", children: "Higher or Lower" }),
|
|
4592
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-sub", children: [
|
|
4541
4593
|
config.statLabel,
|
|
4542
4594
|
" \xB7 ",
|
|
4543
4595
|
config.seasonLabel
|
|
4544
4596
|
] })
|
|
4545
4597
|
] }),
|
|
4546
|
-
runLength > 0 && !isOver && /* @__PURE__ */ (0,
|
|
4598
|
+
runLength > 0 && !isOver && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ss-w-hl-streak", children: [
|
|
4547
4599
|
"\u{1F525} ",
|
|
4548
4600
|
runLength
|
|
4549
4601
|
] })
|
|
4550
4602
|
] }),
|
|
4551
|
-
currentPair && /* @__PURE__ */ (0,
|
|
4552
|
-
/* @__PURE__ */ (0,
|
|
4603
|
+
currentPair && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-q", children: [
|
|
4553
4605
|
"Who has more ",
|
|
4554
4606
|
config.statLabel.toLowerCase(),
|
|
4555
4607
|
"?"
|
|
4556
4608
|
] }),
|
|
4557
|
-
/* @__PURE__ */ (0,
|
|
4558
|
-
/* @__PURE__ */ (0,
|
|
4559
|
-
/* @__PURE__ */ (0,
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4609
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hlpair", children: [
|
|
4610
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hlpc", children: [
|
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4612
|
+
PlayerAvatar,
|
|
4613
|
+
{
|
|
4614
|
+
className: "ss-w-hlpc-av",
|
|
4615
|
+
name: currentPair.playerAName,
|
|
4616
|
+
imagePath: currentPair.playerAImagePath
|
|
4617
|
+
}
|
|
4618
|
+
),
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-name", children: currentPair.playerAName }),
|
|
4620
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-stat", children: config.statLabel }),
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-val", children: currentPair.playerAValue })
|
|
4563
4622
|
] }),
|
|
4564
|
-
/* @__PURE__ */ (0,
|
|
4565
|
-
/* @__PURE__ */ (0,
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hlbtns", children: [
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4566
4625
|
"button",
|
|
4567
4626
|
{
|
|
4568
4627
|
type: "button",
|
|
@@ -4572,8 +4631,8 @@ function HigherOrLowerGame({
|
|
|
4572
4631
|
children: "Higher \u25B2"
|
|
4573
4632
|
}
|
|
4574
4633
|
),
|
|
4575
|
-
/* @__PURE__ */ (0,
|
|
4576
|
-
/* @__PURE__ */ (0,
|
|
4634
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ss-w-hl-or", children: "or" }),
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4577
4636
|
"button",
|
|
4578
4637
|
{
|
|
4579
4638
|
type: "button",
|
|
@@ -4584,32 +4643,39 @@ function HigherOrLowerGame({
|
|
|
4584
4643
|
}
|
|
4585
4644
|
)
|
|
4586
4645
|
] }),
|
|
4587
|
-
/* @__PURE__ */ (0,
|
|
4588
|
-
/* @__PURE__ */ (0,
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4646
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hlpc ss-w-hlpc--b", children: [
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4648
|
+
PlayerAvatar,
|
|
4649
|
+
{
|
|
4650
|
+
className: "ss-w-hlpc-av",
|
|
4651
|
+
name: currentPair.playerBName,
|
|
4652
|
+
imagePath: currentPair.playerBImagePath
|
|
4653
|
+
}
|
|
4654
|
+
),
|
|
4655
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-name", children: currentPair.playerBName }),
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-stat", children: config.statLabel }),
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hlpc-val ss-w-hlpc-val--hidden", children: "?" })
|
|
4592
4658
|
] })
|
|
4593
4659
|
] })
|
|
4594
4660
|
] }),
|
|
4595
|
-
!isOver && /* @__PURE__ */ (0,
|
|
4596
|
-
/* @__PURE__ */ (0,
|
|
4661
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-foot", children: [
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ss-w-hl-chip", children: [
|
|
4597
4663
|
score,
|
|
4598
4664
|
" pts"
|
|
4599
4665
|
] }),
|
|
4600
|
-
/* @__PURE__ */ (0,
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ss-w-hl-chip ss-w-hl-chip--green", children: [
|
|
4601
4667
|
"+",
|
|
4602
4668
|
POINTS_PER_CORRECT,
|
|
4603
4669
|
" / correct"
|
|
4604
4670
|
] })
|
|
4605
4671
|
] }),
|
|
4606
|
-
isOver && /* @__PURE__ */ (0,
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4608
|
-
/* @__PURE__ */ (0,
|
|
4672
|
+
isOver && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-over", children: [
|
|
4673
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ss-w-hl-over-title", children: runEndedWrong ? "\u{1F6AB} Run over" : "\u{1F389} Perfect run!" }),
|
|
4674
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-over-score", children: [
|
|
4609
4675
|
score,
|
|
4610
|
-
/* @__PURE__ */ (0,
|
|
4676
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ss-w-hl-over-unit", children: " pts" })
|
|
4611
4677
|
] }),
|
|
4612
|
-
/* @__PURE__ */ (0,
|
|
4678
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ss-w-hl-over-sub", children: [
|
|
4613
4679
|
correctCount,
|
|
4614
4680
|
" correct in a row",
|
|
4615
4681
|
runEndedWrong ? " before a wrong pick" : "",
|
|
@@ -4621,8 +4687,8 @@ function HigherOrLowerGame({
|
|
|
4621
4687
|
}
|
|
4622
4688
|
|
|
4623
4689
|
// src/components/games/CareerPathGame.tsx
|
|
4624
|
-
var
|
|
4625
|
-
var
|
|
4690
|
+
var import_react31 = require("react");
|
|
4691
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4626
4692
|
function parseClientState3(json) {
|
|
4627
4693
|
if (!json) return null;
|
|
4628
4694
|
try {
|
|
@@ -4641,13 +4707,13 @@ function spellYears(spell) {
|
|
|
4641
4707
|
}
|
|
4642
4708
|
function ClubSpellCard({ spell }) {
|
|
4643
4709
|
const years = spellYears(spell);
|
|
4644
|
-
return /* @__PURE__ */ (0,
|
|
4645
|
-
spell.crestUrl ? /* @__PURE__ */ (0,
|
|
4646
|
-
/* @__PURE__ */ (0,
|
|
4710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `ss-w-cpath-club${spell.isLoan ? " ss-w-cpath-club--loan" : ""}`, children: [
|
|
4711
|
+
spell.crestUrl ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src: spell.crestUrl, alt: "", className: "ss-w-cpath-crest", loading: "lazy" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-crest ss-w-cpath-crest--fallback", "aria-hidden": "true", children: spell.clubName.slice(0, 3).toUpperCase() }),
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "ss-w-cpath-club-name", children: [
|
|
4647
4713
|
spell.clubName,
|
|
4648
|
-
spell.isLoan && /* @__PURE__ */ (0,
|
|
4714
|
+
spell.isLoan && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ss-w-cpath-loan-note", children: " (loan)" })
|
|
4649
4715
|
] }),
|
|
4650
|
-
years && /* @__PURE__ */ (0,
|
|
4716
|
+
years && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ss-w-cpath-spell-yr", children: years })
|
|
4651
4717
|
] });
|
|
4652
4718
|
}
|
|
4653
4719
|
function CareerPathGame({
|
|
@@ -4656,8 +4722,8 @@ function CareerPathGame({
|
|
|
4656
4722
|
submitting,
|
|
4657
4723
|
onSubmit
|
|
4658
4724
|
}) {
|
|
4659
|
-
const [query, setQuery] = (0,
|
|
4660
|
-
const inputId = (0,
|
|
4725
|
+
const [query, setQuery] = (0, import_react31.useState)("");
|
|
4726
|
+
const inputId = (0, import_react31.useId)();
|
|
4661
4727
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
4662
4728
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
4663
4729
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -4672,32 +4738,32 @@ function CareerPathGame({
|
|
|
4672
4738
|
setQuery("");
|
|
4673
4739
|
onSubmit(JSON.stringify({ guesses: newGuesses }));
|
|
4674
4740
|
}
|
|
4675
|
-
return /* @__PURE__ */ (0,
|
|
4676
|
-
!config && /* @__PURE__ */ (0,
|
|
4677
|
-
config && /* @__PURE__ */ (0,
|
|
4678
|
-
/* @__PURE__ */ (0,
|
|
4679
|
-
/* @__PURE__ */ (0,
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-cpath", "data-testid": "game-screen-career-path", children: [
|
|
4742
|
+
!config && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
4743
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
4744
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-cpath-head", children: [
|
|
4745
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { children: [
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-title", children: "Career Path" }),
|
|
4747
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-sub", children: "Guess the mystery player from the clubs they've played for, oldest first." })
|
|
4682
4748
|
] }),
|
|
4683
|
-
clientState && !isOver && /* @__PURE__ */ (0,
|
|
4749
|
+
clientState && !isOver && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "ss-w-cpath-left", children: [
|
|
4684
4750
|
clientState.guessesRemaining,
|
|
4685
4751
|
" left"
|
|
4686
4752
|
] })
|
|
4687
4753
|
] }),
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
4689
|
-
/* @__PURE__ */ (0,
|
|
4690
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
4691
|
-
/* @__PURE__ */ (0,
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-gscroll", children: [
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-seq", children: visiblePath.map((spell, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react31.Fragment, { children: [
|
|
4756
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ss-w-cpath-arrow", "aria-hidden": "true", children: "\u203A" }),
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClubSpellCard, { spell })
|
|
4692
4758
|
] }, `${spell.clubName}-${i}`)) }),
|
|
4693
|
-
clientState?.hintLine && !isOver && /* @__PURE__ */ (0,
|
|
4759
|
+
clientState?.hintLine && !isOver && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-cpath-hint", children: [
|
|
4694
4760
|
"\u{1F4A1} ",
|
|
4695
4761
|
clientState.hintLine
|
|
4696
4762
|
] }),
|
|
4697
|
-
isOver && clientState && /* @__PURE__ */ (0,
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
4699
|
-
clientState.revealedPlayerName && /* @__PURE__ */ (0,
|
|
4700
|
-
/* @__PURE__ */ (0,
|
|
4763
|
+
isOver && clientState && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `ss-w-cpath-banner ss-w-cpath-banner--${clientState.solved ? "solved" : "failed"}`, children: [
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-banner-label", children: clientState.solved ? "\u2705 Career traced!" : "\u{1F614} Out of guesses" }),
|
|
4765
|
+
clientState.revealedPlayerName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-cpath-banner-name", children: clientState.revealedPlayerName }),
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-cpath-banner-sub", children: [
|
|
4701
4767
|
clientState.guessesUsed,
|
|
4702
4768
|
" guess",
|
|
4703
4769
|
clientState.guessesUsed === 1 ? "" : "es",
|
|
@@ -4705,8 +4771,8 @@ function CareerPathGame({
|
|
|
4705
4771
|
] })
|
|
4706
4772
|
] })
|
|
4707
4773
|
] }),
|
|
4708
|
-
!isOver && /* @__PURE__ */ (0,
|
|
4709
|
-
/* @__PURE__ */ (0,
|
|
4774
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ss-w-gpin ss-w-gtta", children: [
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4710
4776
|
"input",
|
|
4711
4777
|
{
|
|
4712
4778
|
id: inputId,
|
|
@@ -4722,7 +4788,7 @@ function CareerPathGame({
|
|
|
4722
4788
|
"aria-autocomplete": "list"
|
|
4723
4789
|
}
|
|
4724
4790
|
),
|
|
4725
|
-
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
4791
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ss-w-gtta-drop", role: "listbox", children: filtered.map((p) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4726
4792
|
"div",
|
|
4727
4793
|
{
|
|
4728
4794
|
className: "ss-w-gtta-opt",
|
|
@@ -4743,8 +4809,8 @@ function CareerPathGame({
|
|
|
4743
4809
|
}
|
|
4744
4810
|
|
|
4745
4811
|
// src/components/games/BeatTheGridGame.tsx
|
|
4746
|
-
var
|
|
4747
|
-
var
|
|
4812
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
4813
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4748
4814
|
function parseClientState4(json) {
|
|
4749
4815
|
if (!json) return null;
|
|
4750
4816
|
try {
|
|
@@ -4775,19 +4841,19 @@ function SearchSheet({
|
|
|
4775
4841
|
onPick,
|
|
4776
4842
|
onDismiss
|
|
4777
4843
|
}) {
|
|
4778
|
-
const [query, setQuery] = (0,
|
|
4779
|
-
const inputId = (0,
|
|
4844
|
+
const [query, setQuery] = (0, import_react32.useState)("");
|
|
4845
|
+
const inputId = (0, import_react32.useId)();
|
|
4780
4846
|
const filtered = playerPool.filter(
|
|
4781
4847
|
(p) => !alreadyFilledIds.has(p.id) && p.name.toLowerCase().includes(query.toLowerCase())
|
|
4782
4848
|
);
|
|
4783
|
-
return /* @__PURE__ */ (0,
|
|
4784
|
-
/* @__PURE__ */ (0,
|
|
4785
|
-
/* @__PURE__ */ (0,
|
|
4786
|
-
/* @__PURE__ */ (0,
|
|
4787
|
-
/* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-sheet", "data-testid": "btg-search-sheet", children: [
|
|
4850
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-sheet-hdr", children: [
|
|
4851
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-sheet-ctx", children: [
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-sheet-row", children: rowLabel }),
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-sheet-sep", children: "\xD7" }),
|
|
4854
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-sheet-col", children: colLabel })
|
|
4789
4855
|
] }),
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
4856
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4791
4857
|
"button",
|
|
4792
4858
|
{
|
|
4793
4859
|
type: "button",
|
|
@@ -4799,8 +4865,8 @@ function SearchSheet({
|
|
|
4799
4865
|
}
|
|
4800
4866
|
)
|
|
4801
4867
|
] }),
|
|
4802
|
-
playerPool.length === 0 ? /* @__PURE__ */ (0,
|
|
4803
|
-
/* @__PURE__ */ (0,
|
|
4868
|
+
playerPool.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-sheet-empty", children: "No players available to search yet." }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gtta", children: [
|
|
4869
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4804
4870
|
"input",
|
|
4805
4871
|
{
|
|
4806
4872
|
id: inputId,
|
|
@@ -4816,7 +4882,7 @@ function SearchSheet({
|
|
|
4816
4882
|
autoFocus: true
|
|
4817
4883
|
}
|
|
4818
4884
|
),
|
|
4819
|
-
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
4885
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gtta-drop ss-w-btg-ta-list", role: "listbox", children: filtered.map((p) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4820
4886
|
"div",
|
|
4821
4887
|
{
|
|
4822
4888
|
className: "ss-w-gtta-opt",
|
|
@@ -4841,7 +4907,7 @@ function BeatTheGridGame({
|
|
|
4841
4907
|
onSubmit,
|
|
4842
4908
|
playerPool
|
|
4843
4909
|
}) {
|
|
4844
|
-
const [activeCell, setActiveCell] = (0,
|
|
4910
|
+
const [activeCell, setActiveCell] = (0, import_react32.useState)(null);
|
|
4845
4911
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
4846
4912
|
const filledCells = clientState?.cells ?? [];
|
|
4847
4913
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -4859,22 +4925,22 @@ function BeatTheGridGame({
|
|
|
4859
4925
|
onSubmit(JSON.stringify({ cells: newCells }));
|
|
4860
4926
|
}
|
|
4861
4927
|
if (!config) {
|
|
4862
|
-
return /* @__PURE__ */ (0,
|
|
4928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg", "data-testid": "game-screen-beat-the-grid", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }) });
|
|
4863
4929
|
}
|
|
4864
4930
|
const rows = config.rows;
|
|
4865
4931
|
const cols = config.cols;
|
|
4866
|
-
return /* @__PURE__ */ (0,
|
|
4867
|
-
/* @__PURE__ */ (0,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
4932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg", "data-testid": "game-screen-beat-the-grid", children: [
|
|
4933
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-head", children: [
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
4935
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-title", children: "Beat the Grid" }),
|
|
4936
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-sub", children: "Fill each cell with a player who fits" })
|
|
4871
4937
|
] }),
|
|
4872
|
-
/* @__PURE__ */ (0,
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
4938
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-ctx", children: [
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ss-w-btg-ctx-score", children: [
|
|
4874
4940
|
clientState?.totalScore ?? 0,
|
|
4875
4941
|
" pts"
|
|
4876
4942
|
] }),
|
|
4877
|
-
!isLocked2 && /* @__PURE__ */ (0,
|
|
4943
|
+
!isLocked2 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ss-w-btg-ctx-left", children: [
|
|
4878
4944
|
config.maxGuesses - filledCells.length,
|
|
4879
4945
|
" cell",
|
|
4880
4946
|
config.maxGuesses - filledCells.length !== 1 ? "s" : "",
|
|
@@ -4882,22 +4948,22 @@ function BeatTheGridGame({
|
|
|
4882
4948
|
] })
|
|
4883
4949
|
] })
|
|
4884
4950
|
] }),
|
|
4885
|
-
/* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4951
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gscroll", children: [
|
|
4952
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
4887
4953
|
"div",
|
|
4888
4954
|
{
|
|
4889
4955
|
className: "ss-w-btg-grid",
|
|
4890
4956
|
style: { gridTemplateColumns: `auto repeat(${cols.length}, 1fr)` },
|
|
4891
4957
|
role: "grid",
|
|
4892
4958
|
children: [
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
cols.map((col) => /* @__PURE__ */ (0,
|
|
4895
|
-
rows.map((rowLabel, rowIdx) => /* @__PURE__ */ (0,
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4959
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-gc ss-w-btg-gc--corner" }),
|
|
4960
|
+
cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-gc ss-w-btg-gc--colhdr", children: col }, col)),
|
|
4961
|
+
rows.map((rowLabel, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react32.default.Fragment, { children: [
|
|
4962
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-gc ss-w-btg-gc--rowhdr", children: rowLabel }),
|
|
4897
4963
|
cols.map((colLabel, colIdx) => {
|
|
4898
4964
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
4899
4965
|
const isActive = activeCell?.row === rowIdx && activeCell?.col === colIdx;
|
|
4900
|
-
return /* @__PURE__ */ (0,
|
|
4966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4901
4967
|
"button",
|
|
4902
4968
|
{
|
|
4903
4969
|
type: "button",
|
|
@@ -4910,13 +4976,13 @@ function BeatTheGridGame({
|
|
|
4910
4976
|
].filter(Boolean).join(" "),
|
|
4911
4977
|
disabled: isLocked2 || submitting,
|
|
4912
4978
|
onClick: () => handleCellClick(rowIdx, colIdx),
|
|
4913
|
-
children: filled ? /* @__PURE__ */ (0,
|
|
4914
|
-
/* @__PURE__ */ (0,
|
|
4915
|
-
/* @__PURE__ */ (0,
|
|
4979
|
+
children: filled ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-cell-nm", children: shortName(playerPool.find((p) => p.id === filled.playerId)?.name) }),
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ss-w-btg-cell-score", children: [
|
|
4916
4982
|
filled.rarityScore,
|
|
4917
|
-
filled.isCorrect && /* @__PURE__ */ (0,
|
|
4983
|
+
filled.isCorrect && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-cell-check", "aria-hidden": "true", children: " \u2713" })
|
|
4918
4984
|
] })
|
|
4919
|
-
] }) : /* @__PURE__ */ (0,
|
|
4985
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-btg-cell-empty", "aria-hidden": "true", children: "+" })
|
|
4920
4986
|
},
|
|
4921
4987
|
`cell-${rowIdx}-${colIdx}`
|
|
4922
4988
|
);
|
|
@@ -4925,10 +4991,10 @@ function BeatTheGridGame({
|
|
|
4925
4991
|
]
|
|
4926
4992
|
}
|
|
4927
4993
|
),
|
|
4928
|
-
isLocked2 && /* @__PURE__ */ (0,
|
|
4929
|
-
/* @__PURE__ */ (0,
|
|
4930
|
-
/* @__PURE__ */ (0,
|
|
4931
|
-
/* @__PURE__ */ (0,
|
|
4994
|
+
isLocked2 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-done", children: [
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-done-label", children: "\u{1F532} Grid complete" }),
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-btg-done-score", children: clientState?.totalScore ?? 0 }),
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-btg-done-sub", children: [
|
|
4932
4998
|
filledCells.filter((c) => c.isCorrect).length,
|
|
4933
4999
|
"/",
|
|
4934
5000
|
filledCells.length,
|
|
@@ -4936,7 +5002,7 @@ function BeatTheGridGame({
|
|
|
4936
5002
|
] })
|
|
4937
5003
|
] })
|
|
4938
5004
|
] }),
|
|
4939
|
-
activeCell !== null && /* @__PURE__ */ (0,
|
|
5005
|
+
activeCell !== null && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gpin", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4940
5006
|
SearchSheet,
|
|
4941
5007
|
{
|
|
4942
5008
|
row: activeCell.row,
|
|
@@ -4953,9 +5019,9 @@ function BeatTheGridGame({
|
|
|
4953
5019
|
}
|
|
4954
5020
|
|
|
4955
5021
|
// src/components/games/GuessTheXiGame.tsx
|
|
4956
|
-
var
|
|
4957
|
-
var
|
|
4958
|
-
var
|
|
5022
|
+
var import_react33 = require("react");
|
|
5023
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5024
|
+
var MAX_GUESSES2 = 3;
|
|
4959
5025
|
function parseClientState5(json) {
|
|
4960
5026
|
if (!json) return null;
|
|
4961
5027
|
try {
|
|
@@ -5021,8 +5087,8 @@ function GuessTheXiGame({
|
|
|
5021
5087
|
submitting,
|
|
5022
5088
|
onSubmit
|
|
5023
5089
|
}) {
|
|
5024
|
-
const [query, setQuery] = (0,
|
|
5025
|
-
const inputId = (0,
|
|
5090
|
+
const [query, setQuery] = (0, import_react33.useState)("");
|
|
5091
|
+
const inputId = (0, import_react33.useId)();
|
|
5026
5092
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
5027
5093
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
5028
5094
|
const solved = clientState?.status === "solved";
|
|
@@ -5046,31 +5112,31 @@ function GuessTheXiGame({
|
|
|
5046
5112
|
}
|
|
5047
5113
|
const wrongGuesses = (clientState?.guessHistory ?? []).filter((g) => !g.wasCorrect);
|
|
5048
5114
|
const revealCount = nameBySlot.size;
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
5050
|
-
!config && /* @__PURE__ */ (0,
|
|
5051
|
-
config && /* @__PURE__ */ (0,
|
|
5052
|
-
/* @__PURE__ */ (0,
|
|
5053
|
-
/* @__PURE__ */ (0,
|
|
5054
|
-
/* @__PURE__ */ (0,
|
|
5115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi", "data-testid": "game-screen-guess-the-xi", children: [
|
|
5116
|
+
!config && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
5117
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-head", children: [
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { children: [
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-title", children: [
|
|
5055
5121
|
"Guess the XI",
|
|
5056
|
-
formation && /* @__PURE__ */ (0,
|
|
5122
|
+
formation && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ss-w-gxi-form", "aria-label": `Formation ${formation}`, children: formation })
|
|
5057
5123
|
] }),
|
|
5058
|
-
/* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-sub", children: [
|
|
5059
5125
|
"Name the team \xB7 flags are each player's nationality \xB7 ",
|
|
5060
5126
|
config.poolLabel
|
|
5061
5127
|
] })
|
|
5062
5128
|
] }),
|
|
5063
|
-
clientState && !isOver && /* @__PURE__ */ (0,
|
|
5064
|
-
Math.max(0,
|
|
5129
|
+
clientState && !isOver && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ss-w-gxi-left", children: [
|
|
5130
|
+
Math.max(0, MAX_GUESSES2 - clientState.guessesUsed),
|
|
5065
5131
|
" left"
|
|
5066
5132
|
] })
|
|
5067
5133
|
] }),
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5069
|
-
rows.length > 0 && /* @__PURE__ */ (0,
|
|
5134
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gscroll", children: [
|
|
5135
|
+
rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gxi-pitch", children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gxi-prow", children: row.map((pos, c) => {
|
|
5070
5136
|
const posLabel = pos.slot ? posBySlot.get(pos.slot) ?? "" : "";
|
|
5071
5137
|
const name = pos.slot ? nameBySlot.get(pos.slot) : void 0;
|
|
5072
|
-
return /* @__PURE__ */ (0,
|
|
5073
|
-
/* @__PURE__ */ (0,
|
|
5138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-slot", children: [
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5074
5140
|
"div",
|
|
5075
5141
|
{
|
|
5076
5142
|
className: `ss-w-gxi-flag${name ? " ss-w-gxi-flag--revealed" : ""}`,
|
|
@@ -5079,25 +5145,25 @@ function GuessTheXiGame({
|
|
|
5079
5145
|
children: nationalityFlag(pos.nationality)
|
|
5080
5146
|
}
|
|
5081
5147
|
),
|
|
5082
|
-
posLabel && /* @__PURE__ */ (0,
|
|
5083
|
-
name && /* @__PURE__ */ (0,
|
|
5148
|
+
posLabel && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ss-w-gxi-pos", children: posLabel }),
|
|
5149
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ss-w-gxi-flag-lab", children: surname(name) })
|
|
5084
5150
|
] }, `${pos.slot}-${c}`);
|
|
5085
5151
|
}) }, r)) }),
|
|
5086
|
-
revealCount > 0 && !isOver && /* @__PURE__ */ (0,
|
|
5152
|
+
revealCount > 0 && !isOver && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-revnote", children: [
|
|
5087
5153
|
"\u{1F50E} ",
|
|
5088
5154
|
revealCount,
|
|
5089
5155
|
" player",
|
|
5090
5156
|
revealCount === 1 ? "" : "s",
|
|
5091
5157
|
" revealed \u2014 highlighted on the pitch"
|
|
5092
5158
|
] }),
|
|
5093
|
-
!isOver && wrongGuesses.length > 0 && /* @__PURE__ */ (0,
|
|
5159
|
+
!isOver && wrongGuesses.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gxi-wrong", children: wrongGuesses.map((g) => {
|
|
5094
5160
|
const team = config.teamPool.find((t) => t.teamId === g.teamId);
|
|
5095
|
-
return /* @__PURE__ */ (0,
|
|
5161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ss-w-gxi-wrong-pill", children: team?.teamName ?? `#${g.teamId}` }, g.teamId);
|
|
5096
5162
|
}) }),
|
|
5097
|
-
isOver && clientState && /* @__PURE__ */ (0,
|
|
5098
|
-
/* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5100
|
-
/* @__PURE__ */ (0,
|
|
5163
|
+
isOver && clientState && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `ss-w-gxi-banner ss-w-gxi-banner--${solved ? "solved" : "failed"}`, children: [
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gxi-banner-label", children: solved ? "\u2705 Solved!" : "\u{1F614} Out of guesses" }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gxi-banner-score", children: clientState.score }),
|
|
5166
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gxi-banner-sub", children: [
|
|
5101
5167
|
clientState.guessesUsed,
|
|
5102
5168
|
" guess",
|
|
5103
5169
|
clientState.guessesUsed === 1 ? "" : "es",
|
|
@@ -5105,8 +5171,8 @@ function GuessTheXiGame({
|
|
|
5105
5171
|
] })
|
|
5106
5172
|
] })
|
|
5107
5173
|
] }),
|
|
5108
|
-
!isOver && /* @__PURE__ */ (0,
|
|
5109
|
-
/* @__PURE__ */ (0,
|
|
5174
|
+
!isOver && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ss-w-gpin ss-w-gtta", children: [
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5110
5176
|
"input",
|
|
5111
5177
|
{
|
|
5112
5178
|
id: inputId,
|
|
@@ -5122,7 +5188,7 @@ function GuessTheXiGame({
|
|
|
5122
5188
|
"aria-autocomplete": "list"
|
|
5123
5189
|
}
|
|
5124
5190
|
),
|
|
5125
|
-
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
5191
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ss-w-gtta-drop", role: "listbox", children: filtered.map((t) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5126
5192
|
"div",
|
|
5127
5193
|
{
|
|
5128
5194
|
className: "ss-w-gtta-opt",
|
|
@@ -5143,8 +5209,8 @@ function GuessTheXiGame({
|
|
|
5143
5209
|
}
|
|
5144
5210
|
|
|
5145
5211
|
// src/components/games/DailyQuizGame.tsx
|
|
5146
|
-
var
|
|
5147
|
-
var
|
|
5212
|
+
var import_react34 = require("react");
|
|
5213
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5148
5214
|
function parseClientState6(json) {
|
|
5149
5215
|
if (!json) return null;
|
|
5150
5216
|
try {
|
|
@@ -5162,7 +5228,7 @@ function DailyQuizGame({
|
|
|
5162
5228
|
submitting,
|
|
5163
5229
|
onSubmit
|
|
5164
5230
|
}) {
|
|
5165
|
-
const [selections, setSelections] = (0,
|
|
5231
|
+
const [selections, setSelections] = (0, import_react34.useState)(/* @__PURE__ */ new Map());
|
|
5166
5232
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
5167
5233
|
const isRevealed = (clientState?.results.length ?? 0) > 0 || result?.alreadyPlayed === true;
|
|
5168
5234
|
const allAnswered = config != null && selections.size === config.questions.length;
|
|
@@ -5178,26 +5244,26 @@ function DailyQuizGame({
|
|
|
5178
5244
|
}));
|
|
5179
5245
|
onSubmit(JSON.stringify({ answers }));
|
|
5180
5246
|
}
|
|
5181
|
-
return /* @__PURE__ */ (0,
|
|
5182
|
-
!config && /* @__PURE__ */ (0,
|
|
5183
|
-
config && /* @__PURE__ */ (0,
|
|
5184
|
-
isRevealed && result?.score != null && /* @__PURE__ */ (0,
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5186
|
-
/* @__PURE__ */ (0,
|
|
5247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ss-w-dq", "data-testid": "game-screen-daily-quiz", children: [
|
|
5248
|
+
!config && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
5249
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
5250
|
+
isRevealed && result?.score != null && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ss-w-dq-score", children: [
|
|
5251
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-dq-score-val", children: result.score }),
|
|
5252
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-dq-score-label", children: "pts" })
|
|
5187
5253
|
] }),
|
|
5188
|
-
!isRevealed && /* @__PURE__ */ (0,
|
|
5254
|
+
!isRevealed && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ss-w-dq-prog", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5189
5255
|
"div",
|
|
5190
5256
|
{
|
|
5191
5257
|
className: "ss-w-dq-prog-fill",
|
|
5192
5258
|
style: { width: `${Math.round(selections.size / config.questions.length * 100)}%` }
|
|
5193
5259
|
}
|
|
5194
5260
|
) }),
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ss-w-dq-questions", children: config.questions.map((q) => {
|
|
5196
5262
|
const qResult = clientState ? findResult(clientState.results, q.index) : void 0;
|
|
5197
5263
|
const selectedIdx = selections.get(q.index);
|
|
5198
|
-
return /* @__PURE__ */ (0,
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ss-w-dq-q", children: [
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ss-w-dq-qstem", children: q.stem }),
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ss-w-dq-opts", children: q.options.map((opt, optIdx) => {
|
|
5201
5267
|
let optCls = "ss-w-dq-qopt";
|
|
5202
5268
|
if (qResult) {
|
|
5203
5269
|
if (optIdx === qResult.correctOptionIndex) {
|
|
@@ -5208,7 +5274,7 @@ function DailyQuizGame({
|
|
|
5208
5274
|
} else if (optIdx === selectedIdx) {
|
|
5209
5275
|
optCls += " ss-w-dq-qopt--selected";
|
|
5210
5276
|
}
|
|
5211
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5212
5278
|
"button",
|
|
5213
5279
|
{
|
|
5214
5280
|
type: "button",
|
|
@@ -5216,17 +5282,17 @@ function DailyQuizGame({
|
|
|
5216
5282
|
disabled: isRevealed || submitting,
|
|
5217
5283
|
onClick: () => handleSelect(q.index, optIdx),
|
|
5218
5284
|
children: [
|
|
5219
|
-
/* @__PURE__ */ (0,
|
|
5220
|
-
/* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-dq-qopt-letter", children: String.fromCharCode(65 + optIdx) }),
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-dq-qopt-text", children: opt })
|
|
5221
5287
|
]
|
|
5222
5288
|
},
|
|
5223
5289
|
optIdx
|
|
5224
5290
|
);
|
|
5225
5291
|
}) }),
|
|
5226
|
-
qResult?.revealText && /* @__PURE__ */ (0,
|
|
5292
|
+
qResult?.revealText && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: `ss-w-dq-qwhy ss-w-dq-qwhy--${qResult.isCorrect ? "correct" : "wrong"}`, children: qResult.revealText })
|
|
5227
5293
|
] }, q.index);
|
|
5228
5294
|
}) }),
|
|
5229
|
-
!isRevealed && /* @__PURE__ */ (0,
|
|
5295
|
+
!isRevealed && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5230
5296
|
"button",
|
|
5231
5297
|
{
|
|
5232
5298
|
type: "button",
|
|
@@ -5242,8 +5308,8 @@ function DailyQuizGame({
|
|
|
5242
5308
|
}
|
|
5243
5309
|
|
|
5244
5310
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
5245
|
-
var
|
|
5246
|
-
var
|
|
5311
|
+
var import_react35 = require("react");
|
|
5312
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5247
5313
|
function parseClientState7(json) {
|
|
5248
5314
|
if (!json) return null;
|
|
5249
5315
|
try {
|
|
@@ -5265,54 +5331,54 @@ function MatchdayPredictorGame({
|
|
|
5265
5331
|
submitting,
|
|
5266
5332
|
onSubmit
|
|
5267
5333
|
}) {
|
|
5268
|
-
const [homeScore, setHomeScore] = (0,
|
|
5269
|
-
const [awayScore, setAwayScore] = (0,
|
|
5270
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
5334
|
+
const [homeScore, setHomeScore] = (0, import_react35.useState)(0);
|
|
5335
|
+
const [awayScore, setAwayScore] = (0, import_react35.useState)(0);
|
|
5336
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react35.useState)(null);
|
|
5271
5337
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
5272
5338
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
5273
5339
|
if (alreadyPlayed && clientState) {
|
|
5274
5340
|
if (!clientState.graded) {
|
|
5275
|
-
return /* @__PURE__ */ (0,
|
|
5276
|
-
/* @__PURE__ */ (0,
|
|
5277
|
-
/* @__PURE__ */ (0,
|
|
5341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp", "data-testid": "game-screen-matchday-predictor", children: [
|
|
5342
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-live", children: [
|
|
5343
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-live-score", children: [
|
|
5278
5344
|
clientState.predictedHomeScore,
|
|
5279
5345
|
" \u2013 ",
|
|
5280
5346
|
clientState.predictedAwayScore
|
|
5281
5347
|
] }),
|
|
5282
|
-
/* @__PURE__ */ (0,
|
|
5348
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-live-label", children: "Locked in \u2014 awaiting result" })
|
|
5283
5349
|
] }),
|
|
5284
|
-
/* @__PURE__ */ (0,
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-fun", children: "For fun \u2014 not in the leaderboard" })
|
|
5285
5351
|
] });
|
|
5286
5352
|
}
|
|
5287
5353
|
const r = clientState.result;
|
|
5288
5354
|
const actualScore = `${r.homeScore} \u2013 ${r.awayScore}`;
|
|
5289
|
-
return /* @__PURE__ */ (0,
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5291
|
-
/* @__PURE__ */ (0,
|
|
5292
|
-
/* @__PURE__ */ (0,
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5294
|
-
/* @__PURE__ */ (0,
|
|
5295
|
-
/* @__PURE__ */ (0,
|
|
5296
|
-
/* @__PURE__ */ (0,
|
|
5355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp", "data-testid": "game-screen-matchday-predictor", children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-live", children: [
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-live-score", children: actualScore }),
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-live-label", children: "Full-time result" }),
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-live-outcome", children: [
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `ss-w-mp-live-row${clientState.exactScoreCorrect ? " ss-w-mp-live-row--correct" : ""}`, children: [
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-live-row-key", children: "Exact score" }),
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-live-row-val", children: clientState.exactScoreCorrect ? "\u2713" : "\u2717" })
|
|
5297
5363
|
] }),
|
|
5298
|
-
/* @__PURE__ */ (0,
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `ss-w-mp-live-row${clientState.outcomeCorrect ? " ss-w-mp-live-row--correct" : ""}`, children: [
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-live-row-key", children: "Result (W/D/L)" }),
|
|
5366
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-live-row-val", children: clientState.outcomeCorrect ? "\u2713" : "\u2717" })
|
|
5301
5367
|
] }),
|
|
5302
|
-
!clientState.firstScorerVoid && /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5368
|
+
!clientState.firstScorerVoid && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `ss-w-mp-live-row${clientState.firstScorerCorrect ? " ss-w-mp-live-row--correct" : ""}`, children: [
|
|
5369
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-live-row-key", children: "First scorer" }),
|
|
5370
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ss-w-mp-live-row-val", children: [
|
|
5305
5371
|
clientState.firstScorerCorrect ? "\u2713" : "\u2717",
|
|
5306
5372
|
r.firstScorerName ? ` ${r.firstScorerName}` : ""
|
|
5307
5373
|
] })
|
|
5308
5374
|
] })
|
|
5309
5375
|
] })
|
|
5310
5376
|
] }),
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5377
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-fun", children: "For fun \u2014 not in the leaderboard" })
|
|
5312
5378
|
] });
|
|
5313
5379
|
}
|
|
5314
5380
|
if (!config) {
|
|
5315
|
-
return /* @__PURE__ */ (0,
|
|
5381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp", "data-testid": "game-screen-matchday-predictor", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }) });
|
|
5316
5382
|
}
|
|
5317
5383
|
const locked = isLocked(config.kickoffUtc);
|
|
5318
5384
|
const disabled = locked || submitting;
|
|
@@ -5326,12 +5392,12 @@ function MatchdayPredictorGame({
|
|
|
5326
5392
|
})
|
|
5327
5393
|
);
|
|
5328
5394
|
}
|
|
5329
|
-
return /* @__PURE__ */ (0,
|
|
5330
|
-
/* @__PURE__ */ (0,
|
|
5331
|
-
/* @__PURE__ */ (0,
|
|
5332
|
-
/* @__PURE__ */ (0,
|
|
5333
|
-
/* @__PURE__ */ (0,
|
|
5334
|
-
/* @__PURE__ */ (0,
|
|
5395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp", "data-testid": "game-screen-matchday-predictor", children: [
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-pred-score", children: [
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-team", children: [
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-team-name", children: config.homeTeam.name }),
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-stepper", children: [
|
|
5400
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5335
5401
|
"button",
|
|
5336
5402
|
{
|
|
5337
5403
|
type: "button",
|
|
@@ -5342,8 +5408,8 @@ function MatchdayPredictorGame({
|
|
|
5342
5408
|
children: "\u2212"
|
|
5343
5409
|
}
|
|
5344
5410
|
),
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5411
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-stepper-val", children: homeScore }),
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5347
5413
|
"button",
|
|
5348
5414
|
{
|
|
5349
5415
|
type: "button",
|
|
@@ -5356,11 +5422,11 @@ function MatchdayPredictorGame({
|
|
|
5356
5422
|
)
|
|
5357
5423
|
] })
|
|
5358
5424
|
] }),
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5360
|
-
/* @__PURE__ */ (0,
|
|
5361
|
-
/* @__PURE__ */ (0,
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5363
|
-
/* @__PURE__ */ (0,
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-sep", children: "\u2013" }),
|
|
5426
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-team", children: [
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-team-name", children: config.awayTeam.name }),
|
|
5428
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-stepper", children: [
|
|
5429
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5364
5430
|
"button",
|
|
5365
5431
|
{
|
|
5366
5432
|
type: "button",
|
|
@@ -5371,8 +5437,8 @@ function MatchdayPredictorGame({
|
|
|
5371
5437
|
children: "\u2212"
|
|
5372
5438
|
}
|
|
5373
5439
|
),
|
|
5374
|
-
/* @__PURE__ */ (0,
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5440
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-mp-stepper-val", children: awayScore }),
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5376
5442
|
"button",
|
|
5377
5443
|
{
|
|
5378
5444
|
type: "button",
|
|
@@ -5386,9 +5452,9 @@ function MatchdayPredictorGame({
|
|
|
5386
5452
|
] })
|
|
5387
5453
|
] })
|
|
5388
5454
|
] }),
|
|
5389
|
-
config.scorerPool.length > 0 && /* @__PURE__ */ (0,
|
|
5390
|
-
/* @__PURE__ */ (0,
|
|
5391
|
-
/* @__PURE__ */ (0,
|
|
5455
|
+
config.scorerPool.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-mp-scorer", children: [
|
|
5456
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-scorer-label", children: "First scorer (optional)" }),
|
|
5457
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-scorer-list", children: config.scorerPool.map((p) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5392
5458
|
"button",
|
|
5393
5459
|
{
|
|
5394
5460
|
type: "button",
|
|
@@ -5400,8 +5466,8 @@ function MatchdayPredictorGame({
|
|
|
5400
5466
|
p.playerId
|
|
5401
5467
|
)) })
|
|
5402
5468
|
] }),
|
|
5403
|
-
locked && /* @__PURE__ */ (0,
|
|
5404
|
-
/* @__PURE__ */ (0,
|
|
5469
|
+
locked && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-live-label", children: "Submissions are now closed" }),
|
|
5470
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5405
5471
|
"button",
|
|
5406
5472
|
{
|
|
5407
5473
|
type: "button",
|
|
@@ -5412,13 +5478,13 @@ function MatchdayPredictorGame({
|
|
|
5412
5478
|
children: submitting ? "Saving\u2026" : "Save prediction"
|
|
5413
5479
|
}
|
|
5414
5480
|
),
|
|
5415
|
-
/* @__PURE__ */ (0,
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ss-w-mp-fun", children: "For fun \u2014 not in the leaderboard" })
|
|
5416
5482
|
] });
|
|
5417
5483
|
}
|
|
5418
5484
|
|
|
5419
5485
|
// src/components/games/StartingXiGame.tsx
|
|
5420
|
-
var
|
|
5421
|
-
var
|
|
5486
|
+
var import_react36 = require("react");
|
|
5487
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
5422
5488
|
function parseClientState8(json) {
|
|
5423
5489
|
if (!json) return null;
|
|
5424
5490
|
try {
|
|
@@ -5438,24 +5504,24 @@ function StartingXiGame({
|
|
|
5438
5504
|
submitting,
|
|
5439
5505
|
onSubmit
|
|
5440
5506
|
}) {
|
|
5441
|
-
const [picked, setPicked] = (0,
|
|
5507
|
+
const [picked, setPicked] = (0, import_react36.useState)([]);
|
|
5442
5508
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
5443
5509
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
5444
5510
|
if (alreadyPlayed) {
|
|
5445
5511
|
if (!clientState) {
|
|
5446
|
-
return /* @__PURE__ */ (0,
|
|
5512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi", "data-testid": "game-screen-starting-xi", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-status", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-status-label", children: "This game has been voided" }) }) });
|
|
5447
5513
|
}
|
|
5448
5514
|
if (clientState.status === "pending") {
|
|
5449
|
-
return /* @__PURE__ */ (0,
|
|
5515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi", "data-testid": "game-screen-starting-xi", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-status", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ss-w-sxi-status-label", children: [
|
|
5450
5516
|
"Prediction locked in (",
|
|
5451
5517
|
clientState.predictedCount,
|
|
5452
5518
|
" players) \u2014 awaiting result"
|
|
5453
5519
|
] }) }) });
|
|
5454
5520
|
}
|
|
5455
5521
|
if (clientState.status === "graded") {
|
|
5456
|
-
return /* @__PURE__ */ (0,
|
|
5457
|
-
/* @__PURE__ */ (0,
|
|
5458
|
-
/* @__PURE__ */ (0,
|
|
5522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi", "data-testid": "game-screen-starting-xi", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ss-w-sxi-status ss-w-sxi-status--graded", children: [
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-status-score", children: clientState.score }),
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ss-w-sxi-status-label", children: [
|
|
5459
5525
|
clientState.correctCount,
|
|
5460
5526
|
" correct starters"
|
|
5461
5527
|
] })
|
|
@@ -5463,7 +5529,7 @@ function StartingXiGame({
|
|
|
5463
5529
|
}
|
|
5464
5530
|
}
|
|
5465
5531
|
if (!config) {
|
|
5466
|
-
return /* @__PURE__ */ (0,
|
|
5532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi", "data-testid": "game-screen-starting-xi", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }) });
|
|
5467
5533
|
}
|
|
5468
5534
|
const formationRows = parseFormationRows(config.formation);
|
|
5469
5535
|
const pickedSet = new Set(picked);
|
|
@@ -5488,12 +5554,12 @@ function StartingXiGame({
|
|
|
5488
5554
|
slotIndex += count;
|
|
5489
5555
|
return { rowIdx, count, rowSlots };
|
|
5490
5556
|
});
|
|
5491
|
-
return /* @__PURE__ */ (0,
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ss-w-sxi", "data-testid": "game-screen-starting-xi", children: [
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-formation", children: config.formation }),
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-pitch", children: pitchRows.map(({ rowIdx, count, rowSlots }) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-pitch-row", children: Array.from({ length: count }).map((_, i) => {
|
|
5494
5560
|
const playerId = rowSlots[i];
|
|
5495
5561
|
const player = playerId != null ? config.squadSheet.find((p) => p.playerId === playerId) : void 0;
|
|
5496
|
-
return /* @__PURE__ */ (0,
|
|
5562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
5497
5563
|
"div",
|
|
5498
5564
|
{
|
|
5499
5565
|
className: `ss-w-sxi-pslot${player ? " ss-w-sxi-pslot--filled" : ""}`,
|
|
@@ -5507,16 +5573,16 @@ function StartingXiGame({
|
|
|
5507
5573
|
role: player ? "button" : void 0,
|
|
5508
5574
|
"aria-label": player ? `Remove ${player.playerName ?? ""}` : void 0,
|
|
5509
5575
|
children: [
|
|
5510
|
-
/* @__PURE__ */ (0,
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-pslot-num", children: player?.jerseyNumber ?? (rowIdx === 0 ? "GK" : "?") }),
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-pslot-name", children: player?.playerName ?? "" })
|
|
5512
5578
|
]
|
|
5513
5579
|
},
|
|
5514
5580
|
i
|
|
5515
5581
|
);
|
|
5516
5582
|
}) }, rowIdx)) }),
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5583
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ss-w-sxi-squad", children: config.squadSheet.map((p) => {
|
|
5518
5584
|
const isPicked = pickedSet.has(p.playerId);
|
|
5519
|
-
return /* @__PURE__ */ (0,
|
|
5585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
5520
5586
|
"div",
|
|
5521
5587
|
{
|
|
5522
5588
|
className: `ss-w-sxi-squad-row${isPicked ? " ss-w-sxi-squad-row--picked" : ""}`,
|
|
@@ -5528,14 +5594,14 @@ function StartingXiGame({
|
|
|
5528
5594
|
role: "button",
|
|
5529
5595
|
"aria-pressed": isPicked,
|
|
5530
5596
|
children: [
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5597
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ss-w-sxi-squad-name", children: p.playerName }),
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ss-w-sxi-squad-pos", children: p.positionName })
|
|
5533
5599
|
]
|
|
5534
5600
|
},
|
|
5535
5601
|
p.playerId
|
|
5536
5602
|
);
|
|
5537
5603
|
}) }),
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
5539
5605
|
"button",
|
|
5540
5606
|
{
|
|
5541
5607
|
type: "button",
|
|
@@ -5550,7 +5616,7 @@ function StartingXiGame({
|
|
|
5550
5616
|
}
|
|
5551
5617
|
|
|
5552
5618
|
// src/components/games/StatLadderGame.tsx
|
|
5553
|
-
var
|
|
5619
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
5554
5620
|
function parseClientState9(json) {
|
|
5555
5621
|
if (!json) return null;
|
|
5556
5622
|
try {
|
|
@@ -5568,12 +5634,12 @@ function StatLadderGame({
|
|
|
5568
5634
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
5569
5635
|
const revealed = clientState != null;
|
|
5570
5636
|
if (!config) {
|
|
5571
|
-
return /* @__PURE__ */ (0,
|
|
5637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl", "data-testid": "game-screen-stat-ladder", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }) });
|
|
5572
5638
|
}
|
|
5573
5639
|
const mysteryName = revealed ? clientState.revealedRank2.playerName : null;
|
|
5574
|
-
return /* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "ss-w-sl", "data-testid": "game-screen-stat-ladder", children: [
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl-title", children: config.statLabel }),
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl-ladder", children: config.ladder.map((rung) => {
|
|
5577
5643
|
const isMystery = rung.rank === 2;
|
|
5578
5644
|
let rowCls = "ss-w-sl-lrow";
|
|
5579
5645
|
if (isMystery) rowCls += " ss-w-sl-mystery";
|
|
@@ -5582,17 +5648,17 @@ function StatLadderGame({
|
|
|
5582
5648
|
rowCls += clientState.isCorrect ? " ss-w-sl-lrow--correct" : " ss-w-sl-lrow--wrong";
|
|
5583
5649
|
}
|
|
5584
5650
|
const displayName = isMystery ? revealed ? mysteryName : "?" : rung.playerName ?? "?";
|
|
5585
|
-
return /* @__PURE__ */ (0,
|
|
5586
|
-
/* @__PURE__ */ (0,
|
|
5651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: rowCls, children: [
|
|
5652
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "ss-w-sl-lrow-rank", children: [
|
|
5587
5653
|
"#",
|
|
5588
5654
|
rung.rank
|
|
5589
5655
|
] }),
|
|
5590
|
-
/* @__PURE__ */ (0,
|
|
5591
|
-
/* @__PURE__ */ (0,
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl-lrow-name", children: displayName }),
|
|
5657
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl-lrow-stat", children: rung.statValue })
|
|
5592
5658
|
] }, rung.rank);
|
|
5593
5659
|
}) }),
|
|
5594
|
-
revealed && /* @__PURE__ */ (0,
|
|
5595
|
-
!revealed && /* @__PURE__ */ (0,
|
|
5660
|
+
revealed && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: `ss-w-sl-reveal ss-w-sl-reveal--${clientState.isCorrect ? "correct" : "wrong"}`, children: clientState.isCorrect ? "Correct!" : `Wrong \u2014 it was ${clientState.revealedRank2.playerName}` }),
|
|
5661
|
+
!revealed && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-sl-picker", children: config.playerPool.map((p) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
5596
5662
|
"button",
|
|
5597
5663
|
{
|
|
5598
5664
|
type: "button",
|
|
@@ -5608,7 +5674,7 @@ function StatLadderGame({
|
|
|
5608
5674
|
}
|
|
5609
5675
|
|
|
5610
5676
|
// src/components/games/FanMotmGame.tsx
|
|
5611
|
-
var
|
|
5677
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
5612
5678
|
function parseClientState10(json) {
|
|
5613
5679
|
if (!json) return null;
|
|
5614
5680
|
try {
|
|
@@ -5626,19 +5692,19 @@ function FanMotmGame({
|
|
|
5626
5692
|
const clientState = parseClientState10(result?.clientStateJson);
|
|
5627
5693
|
const alreadyVoted = result?.alreadyPlayed === true;
|
|
5628
5694
|
if (!config) {
|
|
5629
|
-
return /* @__PURE__ */ (0,
|
|
5695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-motm", "data-testid": "game-screen-fan-motm", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }) });
|
|
5630
5696
|
}
|
|
5631
5697
|
const pickedId = clientState?.pickedPlayerId ?? null;
|
|
5632
5698
|
function handleVote(candidateId) {
|
|
5633
5699
|
if (alreadyVoted || submitting) return;
|
|
5634
5700
|
onSubmit(JSON.stringify({ pickedPlayerId: candidateId }));
|
|
5635
5701
|
}
|
|
5636
|
-
return /* @__PURE__ */ (0,
|
|
5637
|
-
/* @__PURE__ */ (0,
|
|
5638
|
-
/* @__PURE__ */ (0,
|
|
5702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ss-w-motm", "data-testid": "game-screen-fan-motm", children: [
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-motm-title", children: "Man of the Match \u2014 your vote" }),
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-motm-votes", children: config.candidates.map((c) => {
|
|
5639
5705
|
const isVoted = alreadyVoted && pickedId === c.playerId;
|
|
5640
5706
|
const rowCls = `ss-w-motm-vrow${isVoted ? " ss-w-motm-vrow--voted" : ""}${alreadyVoted ? " ss-w-motm-vrow--result" : ""}`;
|
|
5641
|
-
return /* @__PURE__ */ (0,
|
|
5707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
5642
5708
|
"button",
|
|
5643
5709
|
{
|
|
5644
5710
|
type: "button",
|
|
@@ -5647,19 +5713,19 @@ function FanMotmGame({
|
|
|
5647
5713
|
disabled: alreadyVoted || submitting,
|
|
5648
5714
|
onClick: () => handleVote(c.playerId),
|
|
5649
5715
|
children: [
|
|
5650
|
-
/* @__PURE__ */ (0,
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
5716
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-motm-vfill", style: { width: isVoted ? "100%" : "0%" } }),
|
|
5717
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ss-w-motm-vrow-name", children: c.playerName })
|
|
5652
5718
|
]
|
|
5653
5719
|
},
|
|
5654
5720
|
c.playerId
|
|
5655
5721
|
);
|
|
5656
5722
|
}) }),
|
|
5657
|
-
/* @__PURE__ */ (0,
|
|
5723
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-motm-fun", children: "For fun \u2014 unranked community vote" })
|
|
5658
5724
|
] });
|
|
5659
5725
|
}
|
|
5660
5726
|
|
|
5661
5727
|
// src/components/GameScreenHost.tsx
|
|
5662
|
-
var
|
|
5728
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
5663
5729
|
var FIXTURE_GAME_IDS = /* @__PURE__ */ new Set([
|
|
5664
5730
|
"matchday-predictor",
|
|
5665
5731
|
"starting-xi",
|
|
@@ -5682,8 +5748,8 @@ function GameScreenHost({
|
|
|
5682
5748
|
ui
|
|
5683
5749
|
}) {
|
|
5684
5750
|
const { gameId, fixtureId, gameDay = "" } = selected;
|
|
5685
|
-
const [configJson, setConfigJson] = (0,
|
|
5686
|
-
(0,
|
|
5751
|
+
const [configJson, setConfigJson] = (0, import_react37.useState)(null);
|
|
5752
|
+
(0, import_react37.useEffect)(() => {
|
|
5687
5753
|
setConfigJson(null);
|
|
5688
5754
|
if (!conversation) return;
|
|
5689
5755
|
let cancelled = false;
|
|
@@ -5705,12 +5771,12 @@ function GameScreenHost({
|
|
|
5705
5771
|
gameDay,
|
|
5706
5772
|
fixtureId: fixtureId || void 0
|
|
5707
5773
|
});
|
|
5708
|
-
(0,
|
|
5774
|
+
(0, import_react37.useEffect)(() => {
|
|
5709
5775
|
if (conversation) hydrate();
|
|
5710
5776
|
}, [conversation, gameId]);
|
|
5711
|
-
const hydrateRef = (0,
|
|
5777
|
+
const hydrateRef = (0, import_react37.useRef)(hydrate);
|
|
5712
5778
|
hydrateRef.current = hydrate;
|
|
5713
|
-
(0,
|
|
5779
|
+
(0, import_react37.useEffect)(() => {
|
|
5714
5780
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
5715
5781
|
if (rawStatus !== "pending") return;
|
|
5716
5782
|
const timerId = setInterval(() => {
|
|
@@ -5727,7 +5793,7 @@ function GameScreenHost({
|
|
|
5727
5793
|
function renderScreen() {
|
|
5728
5794
|
switch (gameId) {
|
|
5729
5795
|
case "mystery-tiger":
|
|
5730
|
-
return /* @__PURE__ */ (0,
|
|
5796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5731
5797
|
MysteryTigerGame,
|
|
5732
5798
|
{
|
|
5733
5799
|
...sharedProps,
|
|
@@ -5735,7 +5801,7 @@ function GameScreenHost({
|
|
|
5735
5801
|
}
|
|
5736
5802
|
);
|
|
5737
5803
|
case "higher-or-lower":
|
|
5738
|
-
return /* @__PURE__ */ (0,
|
|
5804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5739
5805
|
HigherOrLowerGame,
|
|
5740
5806
|
{
|
|
5741
5807
|
...sharedProps,
|
|
@@ -5743,7 +5809,7 @@ function GameScreenHost({
|
|
|
5743
5809
|
}
|
|
5744
5810
|
);
|
|
5745
5811
|
case "career-path":
|
|
5746
|
-
return /* @__PURE__ */ (0,
|
|
5812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5747
5813
|
CareerPathGame,
|
|
5748
5814
|
{
|
|
5749
5815
|
...sharedProps,
|
|
@@ -5752,7 +5818,7 @@ function GameScreenHost({
|
|
|
5752
5818
|
);
|
|
5753
5819
|
case "beat-the-grid": {
|
|
5754
5820
|
const btgConfig = safeParseConfig(configJson);
|
|
5755
|
-
return /* @__PURE__ */ (0,
|
|
5821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5756
5822
|
BeatTheGridGame,
|
|
5757
5823
|
{
|
|
5758
5824
|
...sharedProps,
|
|
@@ -5762,7 +5828,7 @@ function GameScreenHost({
|
|
|
5762
5828
|
);
|
|
5763
5829
|
}
|
|
5764
5830
|
case "guess-the-xi":
|
|
5765
|
-
return /* @__PURE__ */ (0,
|
|
5831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5766
5832
|
GuessTheXiGame,
|
|
5767
5833
|
{
|
|
5768
5834
|
...sharedProps,
|
|
@@ -5770,7 +5836,7 @@ function GameScreenHost({
|
|
|
5770
5836
|
}
|
|
5771
5837
|
);
|
|
5772
5838
|
case "daily-quiz":
|
|
5773
|
-
return /* @__PURE__ */ (0,
|
|
5839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5774
5840
|
DailyQuizGame,
|
|
5775
5841
|
{
|
|
5776
5842
|
...sharedProps,
|
|
@@ -5778,7 +5844,7 @@ function GameScreenHost({
|
|
|
5778
5844
|
}
|
|
5779
5845
|
);
|
|
5780
5846
|
case "matchday-predictor":
|
|
5781
|
-
return /* @__PURE__ */ (0,
|
|
5847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5782
5848
|
MatchdayPredictorGame,
|
|
5783
5849
|
{
|
|
5784
5850
|
...sharedProps,
|
|
@@ -5786,7 +5852,7 @@ function GameScreenHost({
|
|
|
5786
5852
|
}
|
|
5787
5853
|
);
|
|
5788
5854
|
case "starting-xi":
|
|
5789
|
-
return /* @__PURE__ */ (0,
|
|
5855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5790
5856
|
StartingXiGame,
|
|
5791
5857
|
{
|
|
5792
5858
|
...sharedProps,
|
|
@@ -5794,7 +5860,7 @@ function GameScreenHost({
|
|
|
5794
5860
|
}
|
|
5795
5861
|
);
|
|
5796
5862
|
case "stat-ladder":
|
|
5797
|
-
return /* @__PURE__ */ (0,
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5798
5864
|
StatLadderGame,
|
|
5799
5865
|
{
|
|
5800
5866
|
...sharedProps,
|
|
@@ -5802,7 +5868,7 @@ function GameScreenHost({
|
|
|
5802
5868
|
}
|
|
5803
5869
|
);
|
|
5804
5870
|
case "fan-motm":
|
|
5805
|
-
return /* @__PURE__ */ (0,
|
|
5871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5806
5872
|
FanMotmGame,
|
|
5807
5873
|
{
|
|
5808
5874
|
...sharedProps,
|
|
@@ -5810,12 +5876,12 @@ function GameScreenHost({
|
|
|
5810
5876
|
}
|
|
5811
5877
|
);
|
|
5812
5878
|
default:
|
|
5813
|
-
return /* @__PURE__ */ (0,
|
|
5879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-gscreen-body", "data-testid": `game-screen-${gameId}`, children: gameId });
|
|
5814
5880
|
}
|
|
5815
5881
|
}
|
|
5816
|
-
return /* @__PURE__ */ (0,
|
|
5817
|
-
/* @__PURE__ */ (0,
|
|
5818
|
-
/* @__PURE__ */ (0,
|
|
5882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ss-w-gscreen", children: [
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("button", { type: "button", className: "ss-w-gscreen-back", onClick: onBack, children: [
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ss-w-gscreen-back-arrow", "aria-hidden": "true", children: "\u2039" }),
|
|
5819
5885
|
ui.back
|
|
5820
5886
|
] }),
|
|
5821
5887
|
renderScreen()
|
|
@@ -5823,17 +5889,17 @@ function GameScreenHost({
|
|
|
5823
5889
|
}
|
|
5824
5890
|
|
|
5825
5891
|
// src/components/GamesPanel.tsx
|
|
5826
|
-
var
|
|
5892
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
5827
5893
|
function GamesPanel({
|
|
5828
5894
|
loggedIn,
|
|
5829
5895
|
games,
|
|
5830
5896
|
ui,
|
|
5831
5897
|
conversation
|
|
5832
5898
|
}) {
|
|
5833
|
-
const [selected, setSelected] = (0,
|
|
5834
|
-
if (!loggedIn) return /* @__PURE__ */ (0,
|
|
5899
|
+
const [selected, setSelected] = (0, import_react38.useState)(null);
|
|
5900
|
+
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(GamesLoginWall, { ui });
|
|
5835
5901
|
if (selected !== null) {
|
|
5836
|
-
return /* @__PURE__ */ (0,
|
|
5902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ss-w-gscreen-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
5837
5903
|
GameScreenHost,
|
|
5838
5904
|
{
|
|
5839
5905
|
selected,
|
|
@@ -5843,7 +5909,7 @@ function GamesPanel({
|
|
|
5843
5909
|
}
|
|
5844
5910
|
) });
|
|
5845
5911
|
}
|
|
5846
|
-
return /* @__PURE__ */ (0,
|
|
5912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ss-w-mon-list", "data-testid": "games-hub", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
5847
5913
|
GamesHub,
|
|
5848
5914
|
{
|
|
5849
5915
|
games,
|
|
@@ -5854,10 +5920,10 @@ function GamesPanel({
|
|
|
5854
5920
|
}
|
|
5855
5921
|
|
|
5856
5922
|
// src/components/Leaderboard.tsx
|
|
5857
|
-
var
|
|
5923
|
+
var import_react39 = require("react");
|
|
5858
5924
|
|
|
5859
5925
|
// src/components/LeaderboardRow.tsx
|
|
5860
|
-
var
|
|
5926
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
5861
5927
|
function formatPoints(n) {
|
|
5862
5928
|
return n.toLocaleString("en");
|
|
5863
5929
|
}
|
|
@@ -5866,14 +5932,14 @@ function LeaderboardWeeklyRow({
|
|
|
5866
5932
|
isMe
|
|
5867
5933
|
}) {
|
|
5868
5934
|
const rankClass = `ss-w-lb2-rank${row.rank <= 3 ? " ss-w-lb2-rank--top3" : ""}`;
|
|
5869
|
-
return /* @__PURE__ */ (0,
|
|
5870
|
-
/* @__PURE__ */ (0,
|
|
5935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `ss-w-lb2-row${isMe ? " ss-w-lb2-row--you" : ""}`, children: [
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: rankClass, children: [
|
|
5871
5937
|
"#",
|
|
5872
5938
|
row.rank
|
|
5873
5939
|
] }),
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
5875
|
-
/* @__PURE__ */ (0,
|
|
5876
|
-
row.currentStreak > 0 && /* @__PURE__ */ (0,
|
|
5940
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb2-handle", children: row.handle }),
|
|
5941
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb2-points", children: formatPoints(row.points) }),
|
|
5942
|
+
row.currentStreak > 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "ss-w-lb2-streak", children: [
|
|
5877
5943
|
"\u{1F525} ",
|
|
5878
5944
|
row.currentStreak
|
|
5879
5945
|
] })
|
|
@@ -5884,18 +5950,18 @@ function LeaderboardAllTimeRow({
|
|
|
5884
5950
|
isMe
|
|
5885
5951
|
}) {
|
|
5886
5952
|
const rankClass = `ss-w-lb2-rank${row.rank <= 3 ? " ss-w-lb2-rank--top3" : ""}`;
|
|
5887
|
-
return /* @__PURE__ */ (0,
|
|
5888
|
-
/* @__PURE__ */ (0,
|
|
5953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `ss-w-lb2-row${isMe ? " ss-w-lb2-row--you" : ""}`, children: [
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: rankClass, children: [
|
|
5889
5955
|
"#",
|
|
5890
5956
|
row.rank
|
|
5891
5957
|
] }),
|
|
5892
|
-
/* @__PURE__ */ (0,
|
|
5893
|
-
/* @__PURE__ */ (0,
|
|
5958
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb2-handle", children: row.handle }),
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb2-points", children: formatPoints(row.allTimePoints) })
|
|
5894
5960
|
] });
|
|
5895
5961
|
}
|
|
5896
5962
|
|
|
5897
5963
|
// src/components/LeaderboardEmpty.tsx
|
|
5898
|
-
var
|
|
5964
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
5899
5965
|
function LeaderboardEmpty({
|
|
5900
5966
|
segment,
|
|
5901
5967
|
lastWeek,
|
|
@@ -5904,48 +5970,48 @@ function LeaderboardEmpty({
|
|
|
5904
5970
|
ui
|
|
5905
5971
|
}) {
|
|
5906
5972
|
if (segment === "alltime") {
|
|
5907
|
-
return /* @__PURE__ */ (0,
|
|
5908
|
-
/* @__PURE__ */ (0,
|
|
5909
|
-
/* @__PURE__ */ (0,
|
|
5973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb-empty ss-w-lb-empty--alltime", children: [
|
|
5974
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lb-empty-icon", "aria-hidden": "true", children: "\u{1F4CA}" }),
|
|
5975
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ss-w-lb-empty-body", children: ui.leaderboardAllTimeEmpty })
|
|
5910
5976
|
] });
|
|
5911
5977
|
}
|
|
5912
5978
|
const fresh = lastWeek != null;
|
|
5913
5979
|
const title = fresh ? ui.leaderboardEmptyFreshTitle : ui.leaderboardEmptyColdTitle;
|
|
5914
5980
|
const body = fresh ? ui.leaderboardEmptyFreshBody : ui.leaderboardEmptyColdBody;
|
|
5915
|
-
return /* @__PURE__ */ (0,
|
|
5916
|
-
weeklyPrize && /* @__PURE__ */ (0,
|
|
5917
|
-
/* @__PURE__ */ (0,
|
|
5918
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb-empty", children: [
|
|
5982
|
+
weeklyPrize && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-prize", children: [
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-prize-icon", "aria-hidden": "true", children: "\u{1F3C6}" }),
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-prize-body", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-prize-text", children: weeklyPrize }) })
|
|
5919
5985
|
] }),
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
5921
|
-
/* @__PURE__ */ (0,
|
|
5922
|
-
/* @__PURE__ */ (0,
|
|
5923
|
-
/* @__PURE__ */ (0,
|
|
5924
|
-
onPlay && /* @__PURE__ */ (0,
|
|
5986
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb-empty-hero", children: [
|
|
5987
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lb-empty-icon", "aria-hidden": "true", children: fresh ? "\u{1F3C6}" : "\u{1F3AE}" }),
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h4", { className: "ss-w-lb-empty-title", children: title }),
|
|
5989
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ss-w-lb-empty-body", children: body }),
|
|
5990
|
+
onPlay && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: "ss-w-lb-empty-cta", onClick: onPlay, children: ui.leaderboardEmptyCta })
|
|
5925
5991
|
] }),
|
|
5926
|
-
fresh && lastWeek && /* @__PURE__ */ (0,
|
|
5927
|
-
/* @__PURE__ */ (0,
|
|
5928
|
-
/* @__PURE__ */ (0,
|
|
5929
|
-
/* @__PURE__ */ (0,
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
5992
|
+
fresh && lastWeek && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb-last", children: [
|
|
5993
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-lb-last-label", children: ui.leaderboardLastWeekLabel }),
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-lb-last-champ", "aria-hidden": "true", children: "\u{1F947}" }),
|
|
5995
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-lb-last-handle", children: lastWeek.handle }),
|
|
5996
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-lb-last-points", children: formatPoints(lastWeek.points) })
|
|
5931
5997
|
] })
|
|
5932
5998
|
] });
|
|
5933
5999
|
}
|
|
5934
6000
|
|
|
5935
6001
|
// src/components/Leaderboard.tsx
|
|
5936
|
-
var
|
|
6002
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
5937
6003
|
function Leaderboard({
|
|
5938
6004
|
data,
|
|
5939
6005
|
ui,
|
|
5940
6006
|
onPlay
|
|
5941
6007
|
}) {
|
|
5942
|
-
const [segment, setSegment] = (0,
|
|
6008
|
+
const [segment, setSegment] = (0, import_react39.useState)("weekly");
|
|
5943
6009
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
5944
6010
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
5945
6011
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
5946
|
-
return /* @__PURE__ */ (0,
|
|
5947
|
-
/* @__PURE__ */ (0,
|
|
5948
|
-
/* @__PURE__ */ (0,
|
|
6012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-lb2", children: [
|
|
6013
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-seg", children: [
|
|
6014
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
5949
6015
|
"button",
|
|
5950
6016
|
{
|
|
5951
6017
|
type: "button",
|
|
@@ -5955,7 +6021,7 @@ function Leaderboard({
|
|
|
5955
6021
|
children: ui.leaderboardThisWeek
|
|
5956
6022
|
}
|
|
5957
6023
|
),
|
|
5958
|
-
/* @__PURE__ */ (0,
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
5959
6025
|
"button",
|
|
5960
6026
|
{
|
|
5961
6027
|
type: "button",
|
|
@@ -5966,7 +6032,7 @@ function Leaderboard({
|
|
|
5966
6032
|
}
|
|
5967
6033
|
)
|
|
5968
6034
|
] }),
|
|
5969
|
-
isEmpty ? /* @__PURE__ */ (0,
|
|
6035
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
5970
6036
|
LeaderboardEmpty,
|
|
5971
6037
|
{
|
|
5972
6038
|
segment,
|
|
@@ -5975,15 +6041,15 @@ function Leaderboard({
|
|
|
5975
6041
|
onPlay,
|
|
5976
6042
|
ui
|
|
5977
6043
|
}
|
|
5978
|
-
) : /* @__PURE__ */ (0,
|
|
5979
|
-
/* @__PURE__ */ (0,
|
|
6044
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
6045
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-lb2-rows", children: segment === "weekly" ? data.weeklyTop.map((row) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
5980
6046
|
LeaderboardWeeklyRow,
|
|
5981
6047
|
{
|
|
5982
6048
|
row,
|
|
5983
6049
|
isMe: row.operatorUserId === data.myWeeklyRow?.operatorUserId
|
|
5984
6050
|
},
|
|
5985
6051
|
row.operatorUserId
|
|
5986
|
-
)) : data.allTimeTop.map((row) => /* @__PURE__ */ (0,
|
|
6052
|
+
)) : data.allTimeTop.map((row) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
5987
6053
|
LeaderboardAllTimeRow,
|
|
5988
6054
|
{
|
|
5989
6055
|
row,
|
|
@@ -5991,18 +6057,18 @@ function Leaderboard({
|
|
|
5991
6057
|
},
|
|
5992
6058
|
row.operatorUserId
|
|
5993
6059
|
)) }),
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
5995
|
-
myRow != null && (offBoard ? /* @__PURE__ */ (0,
|
|
5996
|
-
segment === "weekly" && data.myWeeklyRow && /* @__PURE__ */ (0,
|
|
5997
|
-
segment === "alltime" && data.myAllTimeRow && /* @__PURE__ */ (0,
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-kitline", children: "\u{1F3BD}" }),
|
|
6061
|
+
myRow != null && (offBoard ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-lbgap", children: ui.leaderboardOffBoard }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-lb2-rows", children: [
|
|
6062
|
+
segment === "weekly" && data.myWeeklyRow && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LeaderboardWeeklyRow, { row: data.myWeeklyRow, isMe: true }),
|
|
6063
|
+
segment === "alltime" && data.myAllTimeRow && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LeaderboardAllTimeRow, { row: data.myAllTimeRow, isMe: true })
|
|
5998
6064
|
] })),
|
|
5999
|
-
segment === "alltime" && data.myAllTimeRow && !offBoard && /* @__PURE__ */ (0,
|
|
6065
|
+
segment === "alltime" && data.myAllTimeRow && !offBoard && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-lb2-rows", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-lb2-row", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-lb2-handle", children: formatPoints(data.allTimeTop.reduce((s, r) => s + r.allTimePoints, 0)) }) }) })
|
|
6000
6066
|
] })
|
|
6001
6067
|
] });
|
|
6002
6068
|
}
|
|
6003
6069
|
|
|
6004
6070
|
// src/components/LeaderboardPanel.tsx
|
|
6005
|
-
var
|
|
6071
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6006
6072
|
var EMPTY_PAYLOAD = {
|
|
6007
6073
|
week: "",
|
|
6008
6074
|
weeklyTop: [],
|
|
@@ -6013,17 +6079,17 @@ var EMPTY_PAYLOAD = {
|
|
|
6013
6079
|
lastWeek: null
|
|
6014
6080
|
};
|
|
6015
6081
|
function LeaderboardPanel({ loggedIn, data, loading, onPlay, ui }) {
|
|
6016
|
-
if (!loggedIn) return /* @__PURE__ */ (0,
|
|
6017
|
-
if (data === null && loading) return /* @__PURE__ */ (0,
|
|
6018
|
-
return /* @__PURE__ */ (0,
|
|
6082
|
+
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(GamesLoginWall, { ui });
|
|
6083
|
+
if (data === null && loading) return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-mon-list" });
|
|
6084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-mon-list", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Leaderboard, { data: data ?? EMPTY_PAYLOAD, ui, onPlay }) });
|
|
6019
6085
|
}
|
|
6020
6086
|
|
|
6021
6087
|
// src/components/ChatPanel.tsx
|
|
6022
|
-
var
|
|
6088
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
6023
6089
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
6024
6090
|
function useIsModal() {
|
|
6025
|
-
const [modal, setModal] = (0,
|
|
6026
|
-
(0,
|
|
6091
|
+
const [modal, setModal] = (0, import_react40.useState)(false);
|
|
6092
|
+
(0, import_react40.useEffect)(() => {
|
|
6027
6093
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
6028
6094
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
6029
6095
|
const sync = () => setModal(mql.matches);
|
|
@@ -6036,7 +6102,7 @@ function useIsModal() {
|
|
|
6036
6102
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, loggedIn, conversation }) {
|
|
6037
6103
|
const { state, close, stop, send, reset } = controller;
|
|
6038
6104
|
const isModal = useIsModal();
|
|
6039
|
-
(0,
|
|
6105
|
+
(0, import_react40.useEffect)(() => {
|
|
6040
6106
|
const onKey = (e) => {
|
|
6041
6107
|
if (e.key === "Escape") close();
|
|
6042
6108
|
};
|
|
@@ -6047,11 +6113,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
6047
6113
|
monitor?.setActiveTab("chat");
|
|
6048
6114
|
send(text);
|
|
6049
6115
|
};
|
|
6050
|
-
(0,
|
|
6116
|
+
(0, import_react40.useEffect)(() => {
|
|
6051
6117
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
6052
6118
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
6053
|
-
return /* @__PURE__ */ (0,
|
|
6054
|
-
/* @__PURE__ */ (0,
|
|
6119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6055
6121
|
ChatHeader,
|
|
6056
6122
|
{
|
|
6057
6123
|
onClose: close,
|
|
@@ -6064,7 +6130,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
6064
6130
|
moreOptionsLabel: ui.moreOptions
|
|
6065
6131
|
}
|
|
6066
6132
|
),
|
|
6067
|
-
monitor && /* @__PURE__ */ (0,
|
|
6133
|
+
monitor && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6068
6134
|
TabBar,
|
|
6069
6135
|
{
|
|
6070
6136
|
monitor,
|
|
@@ -6076,18 +6142,18 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
6076
6142
|
gamesEnabled: gamesResult?.enabled ?? false
|
|
6077
6143
|
}
|
|
6078
6144
|
),
|
|
6079
|
-
/* @__PURE__ */ (0,
|
|
6145
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6080
6146
|
"div",
|
|
6081
6147
|
{
|
|
6082
6148
|
style: !monitor || monitor.activeTab === "chat" ? { display: "contents" } : { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" },
|
|
6083
|
-
children: /* @__PURE__ */ (0,
|
|
6149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MessageList, { controller, ui, slip, onDashboardTap, monitor })
|
|
6084
6150
|
}
|
|
6085
6151
|
),
|
|
6086
|
-
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0,
|
|
6087
|
-
monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0,
|
|
6088
|
-
monitor && monitor.activeTab === "odds" && /* @__PURE__ */ (0,
|
|
6089
|
-
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0,
|
|
6090
|
-
monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ (0,
|
|
6152
|
+
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TodayPanel, { discovery, ui, monitor }),
|
|
6153
|
+
monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MatchesPanel, { monitor, ui, slip }),
|
|
6154
|
+
monitor && monitor.activeTab === "odds" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(OddsPanel, { monitor, ui, slip }),
|
|
6155
|
+
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(GamesPanel, { loggedIn: !!loggedIn, games: gamesResult.games, ui, conversation }),
|
|
6156
|
+
monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
6091
6157
|
LeaderboardPanel,
|
|
6092
6158
|
{
|
|
6093
6159
|
loggedIn: !!loggedIn,
|
|
@@ -6097,7 +6163,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
6097
6163
|
ui
|
|
6098
6164
|
}
|
|
6099
6165
|
),
|
|
6100
|
-
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "leaderboard") && /* @__PURE__ */ (0,
|
|
6166
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "leaderboard") && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChatInput, { placeholder: ui.placeholder, streaming: state.isStreaming, onSend: handleSend, onStop: stop, stopLabel: ui.stopResponse, sendLabel: ui.sendMessage })
|
|
6101
6167
|
] });
|
|
6102
6168
|
}
|
|
6103
6169
|
|
|
@@ -7104,6 +7170,22 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7104
7170
|
.ss-w-gt-title { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--ss-w-ink); line-height: 1; }
|
|
7105
7171
|
.ss-w-gt-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
7106
7172
|
.ss-w-gt-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
7173
|
+
/* Hero card \u2014 portrait + the masked profile the fan is hunting on. On reveal the silhouette
|
|
7174
|
+
becomes the real photo (or initials) and the profile rows drop away. Fully token-driven. */
|
|
7175
|
+
.ss-w-gt-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 12px; }
|
|
7176
|
+
.ss-w-gt-card--reveal { grid-template-columns: 1fr; justify-items: center; }
|
|
7177
|
+
.ss-w-gt-sil { width: 96px; height: 118px; border-radius: 11px; overflow: hidden; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); display: grid; place-items: center; }
|
|
7178
|
+
.ss-w-gt-sil svg, .ss-w-gt-sil img { display: block; width: 100%; height: 100%; }
|
|
7179
|
+
.ss-w-gt-sil img { object-fit: cover; }
|
|
7180
|
+
.ss-w-gt-attrs { display: flex; flex-direction: column; justify-content: center; }
|
|
7181
|
+
.ss-w-gt-attr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 2px; }
|
|
7182
|
+
.ss-w-gt-attr + .ss-w-gt-attr { border-top: 1px solid var(--ss-w-line); }
|
|
7183
|
+
.ss-w-gt-attr-k { color: var(--ss-w-faint); font-size: 12px; font-weight: 600; }
|
|
7184
|
+
.ss-w-gt-attr-v { color: var(--ss-w-faint); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
|
|
7185
|
+
/* Progress dots \u2014 one per guess allowance; used guesses filled with the accent. */
|
|
7186
|
+
.ss-w-gt-dots { display: flex; gap: 7px; justify-content: center; }
|
|
7187
|
+
.ss-w-gt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ss-w-wrong); }
|
|
7188
|
+
.ss-w-gt-dot--on { background: var(--ss-w-accent); }
|
|
7107
7189
|
/* Guess rows \u2014 one labelled block per guess */
|
|
7108
7190
|
.ss-w-gtrows { display: flex; flex-direction: column; gap: 8px; }
|
|
7109
7191
|
/* First-load legend (empty state) */
|
|
@@ -7141,13 +7223,19 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7141
7223
|
/* Pair: player A | Higher/Lower | player B */
|
|
7142
7224
|
.ss-w-hlpair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
|
|
7143
7225
|
.ss-w-hlpc { background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; text-align: center; min-width: 0; }
|
|
7144
|
-
|
|
7226
|
+
/* Player photo (was a 42px ball emoji): fixed 60px circle on both cards so they stay identical
|
|
7227
|
+
regardless of name length. Falls back to initials when no photo URL is present. */
|
|
7228
|
+
.ss-w-hlpc-av { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); display: grid; place-items: center; flex: none; }
|
|
7229
|
+
.ss-w-hlpc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
7230
|
+
.ss-w-av-initials { font-size: 18px; font-weight: 800; color: var(--ss-w-faint); text-transform: uppercase; letter-spacing: .02em; }
|
|
7145
7231
|
.ss-w-hlpc-name { font-size: 12.5px; font-weight: 700; color: var(--ss-w-ink); line-height: 1.15; }
|
|
7146
7232
|
.ss-w-hlpc-stat { font-size: 8.5px; color: var(--ss-w-faint); text-transform: uppercase; letter-spacing: .04em; }
|
|
7147
7233
|
.ss-w-hlpc-val { font-size: 30px; font-weight: 800; color: var(--ss-w-accent); font-variant-numeric: tabular-nums; line-height: 1; }
|
|
7148
7234
|
.ss-w-hlpc-val--hidden { color: var(--ss-w-faint); }
|
|
7149
|
-
/* Higher / Lower \u2014 middle column
|
|
7150
|
-
|
|
7235
|
+
/* Higher / Lower \u2014 middle column. The pair grid stretches this column to the cards' height, so
|
|
7236
|
+
space-between pins Higher to the top and Lower to the bottom, with "or" centered between the
|
|
7237
|
+
two players. */
|
|
7238
|
+
.ss-w-hlbtns { display: flex; flex-direction: column; gap: 6px; justify-content: space-between; }
|
|
7151
7239
|
.ss-w-hl-or { text-align: center; font-size: 11px; font-weight: 700; color: var(--ss-w-faint); }
|
|
7152
7240
|
.ss-w-hlbtn { font: inherit; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; border-radius: 9px; padding: 10px 12px; cursor: pointer; border: 1px solid var(--ss-w-line); white-space: nowrap; transition: border-color .1s, background .1s; }
|
|
7153
7241
|
/* Both options are neutral until picked \u2014 an amber default read as "already selected". */
|
|
@@ -7431,7 +7519,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7431
7519
|
`;
|
|
7432
7520
|
|
|
7433
7521
|
// src/StatsWidget.tsx
|
|
7434
|
-
var
|
|
7522
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
7435
7523
|
function buildClient(props) {
|
|
7436
7524
|
try {
|
|
7437
7525
|
if ("client" in props && props.client) {
|
|
@@ -7456,23 +7544,23 @@ function injectStyles(root) {
|
|
|
7456
7544
|
function StatsWidget(props) {
|
|
7457
7545
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
7458
7546
|
const cfg = props.config;
|
|
7459
|
-
const built = (0,
|
|
7460
|
-
const logger = (0,
|
|
7547
|
+
const built = (0, import_react41.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
7548
|
+
const logger = (0, import_react41.useMemo)(
|
|
7461
7549
|
() => built ? built.client.createEventLogger({
|
|
7462
7550
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
7463
7551
|
anonymousUserId: cfg?.userContext?.anonymousUserId
|
|
7464
7552
|
}) : null,
|
|
7465
7553
|
[built?.client]
|
|
7466
7554
|
);
|
|
7467
|
-
const ui = (0,
|
|
7468
|
-
const rootRef = (0,
|
|
7469
|
-
const introDoneRef = (0,
|
|
7470
|
-
const markIntroDone = (0,
|
|
7555
|
+
const ui = (0, import_react41.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
7556
|
+
const rootRef = (0, import_react41.useRef)(null);
|
|
7557
|
+
const introDoneRef = (0, import_react41.useRef)(false);
|
|
7558
|
+
const markIntroDone = (0, import_react41.useCallback)(() => {
|
|
7471
7559
|
introDoneRef.current = true;
|
|
7472
7560
|
}, []);
|
|
7473
7561
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
|
|
7474
7562
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey);
|
|
7475
|
-
const [hasToday, setHasToday] = (0,
|
|
7563
|
+
const [hasToday, setHasToday] = (0, import_react41.useState)(false);
|
|
7476
7564
|
const monitor = useLiveMonitor({
|
|
7477
7565
|
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins) : Promise.resolve(null),
|
|
7478
7566
|
getMarketOdds: (matchId, dev) => built ? built.conversation.getMarketOdds(matchId, dev) : Promise.resolve(null),
|
|
@@ -7480,15 +7568,15 @@ function StatsWidget(props) {
|
|
|
7480
7568
|
isOpen: controller.state.isOpen,
|
|
7481
7569
|
hasToday
|
|
7482
7570
|
});
|
|
7483
|
-
const getSchedule = (0,
|
|
7571
|
+
const getSchedule = (0, import_react41.useCallback)(
|
|
7484
7572
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes) : Promise.resolve(null),
|
|
7485
7573
|
[built]
|
|
7486
7574
|
);
|
|
7487
|
-
const getStates = (0,
|
|
7575
|
+
const getStates = (0, import_react41.useCallback)(
|
|
7488
7576
|
(matchIds) => built ? built.conversation.getStates(matchIds) : Promise.resolve(null),
|
|
7489
7577
|
[built]
|
|
7490
7578
|
);
|
|
7491
|
-
const pinnedMatchIds = (0,
|
|
7579
|
+
const pinnedMatchIds = (0, import_react41.useMemo)(
|
|
7492
7580
|
() => monitor.pins.filter((p) => p.kind === "match").map((p) => p.matchId),
|
|
7493
7581
|
[monitor.pins]
|
|
7494
7582
|
);
|
|
@@ -7500,19 +7588,19 @@ function StatsWidget(props) {
|
|
|
7500
7588
|
pinnedMatchIds
|
|
7501
7589
|
});
|
|
7502
7590
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
7503
|
-
(0,
|
|
7591
|
+
(0, import_react41.useEffect)(() => {
|
|
7504
7592
|
setHasToday(todayHasContent);
|
|
7505
7593
|
}, [todayHasContent]);
|
|
7506
7594
|
const gamesResult = useGames(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7507
7595
|
const leaderboardResult = useLeaderboard(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7508
7596
|
const markTodayActivity = monitor.markTodayActivity;
|
|
7509
|
-
const prevLiveCountRef = (0,
|
|
7510
|
-
(0,
|
|
7597
|
+
const prevLiveCountRef = (0, import_react41.useRef)(0);
|
|
7598
|
+
(0, import_react41.useEffect)(() => {
|
|
7511
7599
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
7512
7600
|
prevLiveCountRef.current = discovery.liveCount;
|
|
7513
7601
|
if (rose) markTodayActivity();
|
|
7514
7602
|
}, [discovery.liveCount, markTodayActivity]);
|
|
7515
|
-
const slip = (0,
|
|
7603
|
+
const slip = (0, import_react41.useMemo)(
|
|
7516
7604
|
() => {
|
|
7517
7605
|
const handler = props.config?.onAddToSlip;
|
|
7518
7606
|
return {
|
|
@@ -7535,18 +7623,18 @@ function StatsWidget(props) {
|
|
|
7535
7623
|
},
|
|
7536
7624
|
[props.config?.onAddToSlip, controller.state.conversationId, built, monitor.markInSlip]
|
|
7537
7625
|
);
|
|
7538
|
-
const onDashboardTap = (0,
|
|
7626
|
+
const onDashboardTap = (0, import_react41.useMemo)(
|
|
7539
7627
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
7540
7628
|
[built, logger]
|
|
7541
7629
|
);
|
|
7542
7630
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
7543
7631
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
7544
7632
|
const conversationId = controller.state.conversationId ?? void 0;
|
|
7545
|
-
(0,
|
|
7633
|
+
(0, import_react41.useEffect)(() => {
|
|
7546
7634
|
if (!logger) return;
|
|
7547
7635
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
7548
7636
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
7549
|
-
(0,
|
|
7637
|
+
(0, import_react41.useEffect)(() => {
|
|
7550
7638
|
if (!logger) return;
|
|
7551
7639
|
const onHide = () => {
|
|
7552
7640
|
logger.flushOnHide();
|
|
@@ -7563,14 +7651,14 @@ function StatsWidget(props) {
|
|
|
7563
7651
|
logger.dispose();
|
|
7564
7652
|
};
|
|
7565
7653
|
}, [logger]);
|
|
7566
|
-
(0,
|
|
7654
|
+
(0, import_react41.useEffect)(() => {
|
|
7567
7655
|
if (!built || !ui.injectStyles) return;
|
|
7568
7656
|
const node = rootRef.current?.getRootNode();
|
|
7569
7657
|
if (node) injectStyles(node);
|
|
7570
7658
|
}, [built, ui.injectStyles]);
|
|
7571
7659
|
if (!built) return null;
|
|
7572
7660
|
const attrs = themeAttrs(ui);
|
|
7573
|
-
return /* @__PURE__ */ (0,
|
|
7661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7574
7662
|
ChatPanel,
|
|
7575
7663
|
{
|
|
7576
7664
|
controller,
|
|
@@ -7584,7 +7672,7 @@ function StatsWidget(props) {
|
|
|
7584
7672
|
loggedIn: !!operatorUserId,
|
|
7585
7673
|
conversation: built?.conversation ?? null
|
|
7586
7674
|
}
|
|
7587
|
-
) : /* @__PURE__ */ (0,
|
|
7675
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7588
7676
|
ChatFab,
|
|
7589
7677
|
{
|
|
7590
7678
|
label: ui.launcherLabel,
|