@sensiblestats/widget-react 0.50.2 → 0.52.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 +17 -0
- package/dist/index.cjs +392 -138
- 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 +368 -114
- package/dist/index.js.map +1 -1
- package/dist/styles.css +29 -20
- package/package.json +2 -2
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_react40 = require("react");
|
|
40
40
|
var import_widget_sdk5 = require("@sensiblestats/widget-sdk");
|
|
41
41
|
|
|
42
42
|
// src/kickoff.ts
|
|
@@ -138,6 +138,13 @@ var STRINGS = {
|
|
|
138
138
|
leaderboardOffBoard: "Outside top 50",
|
|
139
139
|
leaderboardThisWeek: "This week",
|
|
140
140
|
leaderboardAllTime: "All time",
|
|
141
|
+
leaderboardEmptyFreshTitle: "New week, blank slate",
|
|
142
|
+
leaderboardEmptyFreshBody: "No scores yet. The first fan to play a game takes #1.",
|
|
143
|
+
leaderboardEmptyColdTitle: "Be the first up",
|
|
144
|
+
leaderboardEmptyColdBody: "Nobody's on the board yet. Play a game and you're #1.",
|
|
145
|
+
leaderboardEmptyCta: "Play today's games",
|
|
146
|
+
leaderboardLastWeekLabel: "Last week",
|
|
147
|
+
leaderboardAllTimeEmpty: "The all-time board fills as fans play \u2014 nothing here yet.",
|
|
141
148
|
gamePlay: "Play",
|
|
142
149
|
gameResume: "Resume",
|
|
143
150
|
gameLocked: "Locked",
|
|
@@ -228,6 +235,13 @@ var STRINGS = {
|
|
|
228
235
|
leaderboardOffBoard: "\u0130lk 50 d\u0131\u015F\u0131nda",
|
|
229
236
|
leaderboardThisWeek: "Bu hafta",
|
|
230
237
|
leaderboardAllTime: "T\xFCm zamanlar",
|
|
238
|
+
leaderboardEmptyFreshTitle: "Yeni hafta, temiz sayfa",
|
|
239
|
+
leaderboardEmptyFreshBody: "Hen\xFCz skor yok. Oynayan ilk taraftar 1. s\u0131raya ge\xE7er.",
|
|
240
|
+
leaderboardEmptyColdTitle: "\u0130lk sen ol",
|
|
241
|
+
leaderboardEmptyColdBody: "Panoda hen\xFCz kimse yok. Bir oyun oyna, 1. s\u0131ra senin.",
|
|
242
|
+
leaderboardEmptyCta: "Bug\xFCn\xFCn oyunlar\u0131n\u0131 oyna",
|
|
243
|
+
leaderboardLastWeekLabel: "Ge\xE7en hafta",
|
|
244
|
+
leaderboardAllTimeEmpty: "T\xFCm zamanlar panosu taraftarlar oynad\u0131k\xE7a dolar \u2014 hen\xFCz bir \u015Fey yok.",
|
|
231
245
|
gamePlay: "Oyna",
|
|
232
246
|
gameResume: "Devam et",
|
|
233
247
|
gameLocked: "Kilitli",
|
|
@@ -337,6 +351,13 @@ function normalizeUi(cfg) {
|
|
|
337
351
|
leaderboardOffBoard: strings.leaderboardOffBoard,
|
|
338
352
|
leaderboardThisWeek: strings.leaderboardThisWeek,
|
|
339
353
|
leaderboardAllTime: strings.leaderboardAllTime,
|
|
354
|
+
leaderboardEmptyFreshTitle: strings.leaderboardEmptyFreshTitle,
|
|
355
|
+
leaderboardEmptyFreshBody: strings.leaderboardEmptyFreshBody,
|
|
356
|
+
leaderboardEmptyColdTitle: strings.leaderboardEmptyColdTitle,
|
|
357
|
+
leaderboardEmptyColdBody: strings.leaderboardEmptyColdBody,
|
|
358
|
+
leaderboardEmptyCta: strings.leaderboardEmptyCta,
|
|
359
|
+
leaderboardLastWeekLabel: strings.leaderboardLastWeekLabel,
|
|
360
|
+
leaderboardAllTimeEmpty: strings.leaderboardAllTimeEmpty,
|
|
340
361
|
gamePlay: strings.gamePlay,
|
|
341
362
|
gameResume: strings.gameResume,
|
|
342
363
|
gameLocked: strings.gameLocked,
|
|
@@ -1908,7 +1929,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
1908
1929
|
}
|
|
1909
1930
|
|
|
1910
1931
|
// src/components/ChatPanel.tsx
|
|
1911
|
-
var
|
|
1932
|
+
var import_react39 = require("react");
|
|
1912
1933
|
|
|
1913
1934
|
// src/components/ChatHeader.tsx
|
|
1914
1935
|
var import_react11 = require("react");
|
|
@@ -4011,7 +4032,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
4011
4032
|
}
|
|
4012
4033
|
|
|
4013
4034
|
// src/components/GamesPanel.tsx
|
|
4014
|
-
var
|
|
4035
|
+
var import_react37 = require("react");
|
|
4015
4036
|
|
|
4016
4037
|
// src/components/GamesLoginWall.tsx
|
|
4017
4038
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -4024,14 +4045,36 @@ var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
|
4024
4045
|
var GAME_ICONS = {
|
|
4025
4046
|
"mystery-tiger": "\u{1F42F}",
|
|
4026
4047
|
"daily-quiz": "\u{1F9E0}",
|
|
4027
|
-
"career-path": "\
|
|
4028
|
-
"beat-the-grid": "\u{
|
|
4029
|
-
"guess-xi": "\u{1F4CB}",
|
|
4030
|
-
"
|
|
4048
|
+
"career-path": "\u{1F9ED}",
|
|
4049
|
+
"beat-the-grid": "\u{1F532}",
|
|
4050
|
+
"guess-the-xi": "\u{1F4CB}",
|
|
4051
|
+
"higher-or-lower": "\u{1F4C8}",
|
|
4052
|
+
"matchday-predictor": "\u{1F3AF}",
|
|
4053
|
+
"starting-xi": "\u{1F455}",
|
|
4054
|
+
"stat-ladder": "\u{1FA9C}",
|
|
4055
|
+
"fan-motm": "\u2B50"
|
|
4056
|
+
};
|
|
4057
|
+
var GAME_TITLES = {
|
|
4058
|
+
"mystery-tiger": "Mystery Tiger",
|
|
4059
|
+
"daily-quiz": "Daily Quiz",
|
|
4060
|
+
"career-path": "Career Path",
|
|
4061
|
+
"beat-the-grid": "Beat the Grid",
|
|
4062
|
+
"guess-the-xi": "Guess the XI",
|
|
4063
|
+
"higher-or-lower": "Higher or Lower",
|
|
4064
|
+
"matchday-predictor": "Matchday Predictor",
|
|
4065
|
+
"starting-xi": "Starting XI",
|
|
4066
|
+
"stat-ladder": "Stat Ladder",
|
|
4067
|
+
"fan-motm": "Fan MOTM"
|
|
4031
4068
|
};
|
|
4032
4069
|
function gameIcon(game) {
|
|
4033
4070
|
return GAME_ICONS[game.gameId] ?? (game.kind === "fixture" ? "\u{1F4C5}" : "\u{1F3AE}");
|
|
4034
4071
|
}
|
|
4072
|
+
function prettifyGameId(gameId) {
|
|
4073
|
+
return gameId.split("-").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
4074
|
+
}
|
|
4075
|
+
function gameTitle(game) {
|
|
4076
|
+
return game.title ?? GAME_TITLES[game.gameId] ?? prettifyGameId(game.gameId);
|
|
4077
|
+
}
|
|
4035
4078
|
function formatCountdown(lockAtUtc) {
|
|
4036
4079
|
const diff = new Date(lockAtUtc).getTime() - Date.now();
|
|
4037
4080
|
if (diff <= 0) return null;
|
|
@@ -4072,7 +4115,7 @@ function GameTile({
|
|
|
4072
4115
|
const statusClass = `ss-w-tile-status ss-w-tile-status--${game.status}`;
|
|
4073
4116
|
const inner = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4074
4117
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-icon", children: gameIcon(game) }),
|
|
4075
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-title", children: game
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-title", children: gameTitle(game) }),
|
|
4076
4119
|
countdown !== null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: statusClass, "data-testid": "tile-countdown", children: countdown }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: statusClass, children: statusLabel }),
|
|
4077
4120
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: `ss-w-tile-chip ss-w-tile-chip--${game.ranked ? "skill" : "fun"}`, children: game.ranked ? "Skill" : "For fun" })
|
|
4078
4121
|
] });
|
|
@@ -4123,7 +4166,7 @@ function GamesHub({
|
|
|
4123
4166
|
}
|
|
4124
4167
|
|
|
4125
4168
|
// src/components/GameScreenHost.tsx
|
|
4126
|
-
var
|
|
4169
|
+
var import_react36 = require("react");
|
|
4127
4170
|
|
|
4128
4171
|
// src/useGamePlay.ts
|
|
4129
4172
|
var import_react28 = require("react");
|
|
@@ -4783,6 +4826,90 @@ function BeatTheGridGame({
|
|
|
4783
4826
|
] });
|
|
4784
4827
|
}
|
|
4785
4828
|
|
|
4829
|
+
// src/components/games/GuessTheXiGame.tsx
|
|
4830
|
+
var import_react32 = require("react");
|
|
4831
|
+
|
|
4832
|
+
// src/components/games/nationFlags.ts
|
|
4833
|
+
var FLAGS = {
|
|
4834
|
+
england: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}",
|
|
4835
|
+
scotland: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0073}\u{E0063}\u{E0074}\u{E007F}",
|
|
4836
|
+
wales: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0077}\u{E006C}\u{E0073}\u{E007F}",
|
|
4837
|
+
"northern ireland": "\u{1F1EC}\u{1F1E7}",
|
|
4838
|
+
"republic of ireland": "\u{1F1EE}\u{1F1EA}",
|
|
4839
|
+
ireland: "\u{1F1EE}\u{1F1EA}",
|
|
4840
|
+
"united kingdom": "\u{1F1EC}\u{1F1E7}",
|
|
4841
|
+
france: "\u{1F1EB}\u{1F1F7}",
|
|
4842
|
+
spain: "\u{1F1EA}\u{1F1F8}",
|
|
4843
|
+
portugal: "\u{1F1F5}\u{1F1F9}",
|
|
4844
|
+
germany: "\u{1F1E9}\u{1F1EA}",
|
|
4845
|
+
italy: "\u{1F1EE}\u{1F1F9}",
|
|
4846
|
+
netherlands: "\u{1F1F3}\u{1F1F1}",
|
|
4847
|
+
belgium: "\u{1F1E7}\u{1F1EA}",
|
|
4848
|
+
switzerland: "\u{1F1E8}\u{1F1ED}",
|
|
4849
|
+
austria: "\u{1F1E6}\u{1F1F9}",
|
|
4850
|
+
denmark: "\u{1F1E9}\u{1F1F0}",
|
|
4851
|
+
sweden: "\u{1F1F8}\u{1F1EA}",
|
|
4852
|
+
norway: "\u{1F1F3}\u{1F1F4}",
|
|
4853
|
+
finland: "\u{1F1EB}\u{1F1EE}",
|
|
4854
|
+
iceland: "\u{1F1EE}\u{1F1F8}",
|
|
4855
|
+
poland: "\u{1F1F5}\u{1F1F1}",
|
|
4856
|
+
czechia: "\u{1F1E8}\u{1F1FF}",
|
|
4857
|
+
"czech republic": "\u{1F1E8}\u{1F1FF}",
|
|
4858
|
+
croatia: "\u{1F1ED}\u{1F1F7}",
|
|
4859
|
+
serbia: "\u{1F1F7}\u{1F1F8}",
|
|
4860
|
+
"bosnia and herzegovina": "\u{1F1E7}\u{1F1E6}",
|
|
4861
|
+
greece: "\u{1F1EC}\u{1F1F7}",
|
|
4862
|
+
romania: "\u{1F1F7}\u{1F1F4}",
|
|
4863
|
+
ukraine: "\u{1F1FA}\u{1F1E6}",
|
|
4864
|
+
russia: "\u{1F1F7}\u{1F1FA}",
|
|
4865
|
+
hungary: "\u{1F1ED}\u{1F1FA}",
|
|
4866
|
+
slovakia: "\u{1F1F8}\u{1F1F0}",
|
|
4867
|
+
slovenia: "\u{1F1F8}\u{1F1EE}",
|
|
4868
|
+
turkey: "\u{1F1F9}\u{1F1F7}",
|
|
4869
|
+
t\u00FCrkiye: "\u{1F1F9}\u{1F1F7}",
|
|
4870
|
+
albania: "\u{1F1E6}\u{1F1F1}",
|
|
4871
|
+
"north macedonia": "\u{1F1F2}\u{1F1F0}",
|
|
4872
|
+
brazil: "\u{1F1E7}\u{1F1F7}",
|
|
4873
|
+
argentina: "\u{1F1E6}\u{1F1F7}",
|
|
4874
|
+
uruguay: "\u{1F1FA}\u{1F1FE}",
|
|
4875
|
+
colombia: "\u{1F1E8}\u{1F1F4}",
|
|
4876
|
+
chile: "\u{1F1E8}\u{1F1F1}",
|
|
4877
|
+
peru: "\u{1F1F5}\u{1F1EA}",
|
|
4878
|
+
ecuador: "\u{1F1EA}\u{1F1E8}",
|
|
4879
|
+
paraguay: "\u{1F1F5}\u{1F1FE}",
|
|
4880
|
+
mexico: "\u{1F1F2}\u{1F1FD}",
|
|
4881
|
+
"united states": "\u{1F1FA}\u{1F1F8}",
|
|
4882
|
+
usa: "\u{1F1FA}\u{1F1F8}",
|
|
4883
|
+
canada: "\u{1F1E8}\u{1F1E6}",
|
|
4884
|
+
jamaica: "\u{1F1EF}\u{1F1F2}",
|
|
4885
|
+
nigeria: "\u{1F1F3}\u{1F1EC}",
|
|
4886
|
+
ghana: "\u{1F1EC}\u{1F1ED}",
|
|
4887
|
+
senegal: "\u{1F1F8}\u{1F1F3}",
|
|
4888
|
+
ivorycoast: "\u{1F1E8}\u{1F1EE}",
|
|
4889
|
+
"cote d'ivoire": "\u{1F1E8}\u{1F1EE}",
|
|
4890
|
+
"ivory coast": "\u{1F1E8}\u{1F1EE}",
|
|
4891
|
+
cameroon: "\u{1F1E8}\u{1F1F2}",
|
|
4892
|
+
egypt: "\u{1F1EA}\u{1F1EC}",
|
|
4893
|
+
morocco: "\u{1F1F2}\u{1F1E6}",
|
|
4894
|
+
algeria: "\u{1F1E9}\u{1F1FF}",
|
|
4895
|
+
tunisia: "\u{1F1F9}\u{1F1F3}",
|
|
4896
|
+
mali: "\u{1F1F2}\u{1F1F1}",
|
|
4897
|
+
"south africa": "\u{1F1FF}\u{1F1E6}",
|
|
4898
|
+
"dr congo": "\u{1F1E8}\u{1F1E9}",
|
|
4899
|
+
japan: "\u{1F1EF}\u{1F1F5}",
|
|
4900
|
+
"south korea": "\u{1F1F0}\u{1F1F7}",
|
|
4901
|
+
korea: "\u{1F1F0}\u{1F1F7}",
|
|
4902
|
+
australia: "\u{1F1E6}\u{1F1FA}",
|
|
4903
|
+
"saudi arabia": "\u{1F1F8}\u{1F1E6}",
|
|
4904
|
+
iran: "\u{1F1EE}\u{1F1F7}",
|
|
4905
|
+
"new zealand": "\u{1F1F3}\u{1F1FF}"
|
|
4906
|
+
};
|
|
4907
|
+
function nationalityFlag(nationality) {
|
|
4908
|
+
if (!nationality) return "\u{1F3F3}\uFE0F";
|
|
4909
|
+
const key = nationality.trim().toLowerCase();
|
|
4910
|
+
return FLAGS[key] ?? nationality.slice(0, 3).toUpperCase();
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4786
4913
|
// src/components/games/GuessTheXiGame.tsx
|
|
4787
4914
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4788
4915
|
function parseClientState5(json) {
|
|
@@ -4793,6 +4920,16 @@ function parseClientState5(json) {
|
|
|
4793
4920
|
return null;
|
|
4794
4921
|
}
|
|
4795
4922
|
}
|
|
4923
|
+
function toRows(positions) {
|
|
4924
|
+
const byRow = /* @__PURE__ */ new Map();
|
|
4925
|
+
positions.forEach((p, i) => {
|
|
4926
|
+
const rowKey = Number(p.slot?.split(":")[0]) || i + 1;
|
|
4927
|
+
const bucket = byRow.get(rowKey) ?? [];
|
|
4928
|
+
bucket.push(p);
|
|
4929
|
+
byRow.set(rowKey, bucket);
|
|
4930
|
+
});
|
|
4931
|
+
return [...byRow.keys()].sort((a, b) => a - b).map((k) => byRow.get(k));
|
|
4932
|
+
}
|
|
4796
4933
|
function RevealCard({ reveal }) {
|
|
4797
4934
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-reveal", "data-reveal-type": reveal.type ?? "", children: [
|
|
4798
4935
|
reveal.slot && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-gxi-reveal-slot", children: reveal.slot }),
|
|
@@ -4805,51 +4942,90 @@ function GuessTheXiGame({
|
|
|
4805
4942
|
submitting,
|
|
4806
4943
|
onSubmit
|
|
4807
4944
|
}) {
|
|
4945
|
+
const [query, setQuery] = (0, import_react32.useState)("");
|
|
4946
|
+
const inputId = (0, import_react32.useId)();
|
|
4808
4947
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
4809
4948
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
4810
4949
|
const solved = clientState?.status === "solved";
|
|
4950
|
+
const guessedTeamIds = new Set(clientState?.guessHistory.map((g) => g.teamId) ?? []);
|
|
4951
|
+
const rows = config ? toRows(config.positions) : [];
|
|
4952
|
+
const filtered = config && !isOver ? config.teamPool.filter(
|
|
4953
|
+
(t) => !guessedTeamIds.has(t.teamId) && t.teamName.toLowerCase().includes(query.toLowerCase())
|
|
4954
|
+
) : [];
|
|
4811
4955
|
function handlePick(teamId) {
|
|
4812
4956
|
if (!config || isOver || submitting) return;
|
|
4813
4957
|
const prevGuesses = clientState?.guessHistory.map((g) => ({ teamId: g.teamId })) ?? [];
|
|
4814
4958
|
const newGuesses = [...prevGuesses, { teamId }];
|
|
4959
|
+
setQuery("");
|
|
4815
4960
|
onSubmit(JSON.stringify({ guesses: newGuesses }));
|
|
4816
4961
|
}
|
|
4962
|
+
const wrongGuesses = (clientState?.guessHistory ?? []).filter((g) => !g.wasCorrect);
|
|
4817
4963
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi", "data-testid": "game-screen-guess-the-xi", children: [
|
|
4818
4964
|
!config && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
4819
4965
|
config && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
4820
4966
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-head", children: [
|
|
4821
4967
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
4822
4968
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-title", children: "Guess the XI" }),
|
|
4823
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-sub", children: [
|
|
4970
|
+
"Which team? \xB7 ",
|
|
4971
|
+
config.poolLabel
|
|
4972
|
+
] })
|
|
4824
4973
|
] }),
|
|
4825
4974
|
clientState && !isOver && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ss-w-gxi-left", children: [
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
"/6"
|
|
4975
|
+
Math.max(0, 6 - clientState.guessesUsed),
|
|
4976
|
+
" left"
|
|
4829
4977
|
] })
|
|
4830
4978
|
] }),
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4979
|
+
rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-pitch", children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-prow", children: row.map((pos, c) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4980
|
+
"div",
|
|
4981
|
+
{
|
|
4982
|
+
className: "ss-w-gxi-flag",
|
|
4983
|
+
title: pos.nationality,
|
|
4984
|
+
"aria-label": pos.nationality,
|
|
4985
|
+
children: nationalityFlag(pos.nationality)
|
|
4986
|
+
},
|
|
4987
|
+
`${pos.slot}-${c}`
|
|
4988
|
+
)) }, r)) }),
|
|
4835
4989
|
clientState && clientState.earnedReveals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-reveals", children: clientState.earnedReveals.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RevealCard, { reveal: r }, i)) }),
|
|
4836
|
-
!isOver ? /* @__PURE__ */ (0, import_jsx_runtime59.
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
"
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4990
|
+
!isOver ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
4991
|
+
wrongGuesses.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-wrong", children: wrongGuesses.map((g) => {
|
|
4992
|
+
const team = config.teamPool.find((t) => t.teamId === g.teamId);
|
|
4993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-gxi-wrong-pill", children: team?.teamName ?? `#${g.teamId}` }, g.teamId);
|
|
4994
|
+
}) }),
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gtta", children: [
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4997
|
+
"input",
|
|
4998
|
+
{
|
|
4999
|
+
id: inputId,
|
|
5000
|
+
type: "text",
|
|
5001
|
+
role: "textbox",
|
|
5002
|
+
className: "ss-w-gtta-i",
|
|
5003
|
+
placeholder: "Name the team\u2026",
|
|
5004
|
+
value: query,
|
|
5005
|
+
disabled: submitting || isOver,
|
|
5006
|
+
onChange: (e) => setQuery(e.target.value),
|
|
5007
|
+
autoComplete: "off",
|
|
5008
|
+
"aria-label": "Name the team",
|
|
5009
|
+
"aria-autocomplete": "list"
|
|
5010
|
+
}
|
|
5011
|
+
),
|
|
5012
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gtta-drop", role: "listbox", children: filtered.map((t) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5013
|
+
"div",
|
|
5014
|
+
{
|
|
5015
|
+
className: "ss-w-gtta-opt",
|
|
5016
|
+
role: "option",
|
|
5017
|
+
"aria-selected": false,
|
|
5018
|
+
onClick: () => handlePick(t.teamId),
|
|
5019
|
+
onKeyDown: (e) => {
|
|
5020
|
+
if (e.key === "Enter") handlePick(t.teamId);
|
|
5021
|
+
},
|
|
5022
|
+
tabIndex: 0,
|
|
5023
|
+
children: t.teamName
|
|
5024
|
+
},
|
|
5025
|
+
t.teamId
|
|
5026
|
+
)) })
|
|
5027
|
+
] })
|
|
5028
|
+
] }) : clientState && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `ss-w-gxi-banner ss-w-gxi-banner--${solved ? "solved" : "failed"}`, children: [
|
|
4853
5029
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-banner-label", children: solved ? "\u2705 Solved!" : "\u{1F614} Out of guesses" }),
|
|
4854
5030
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-banner-score", children: clientState.score }),
|
|
4855
5031
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-banner-sub", children: [
|
|
@@ -4864,7 +5040,7 @@ function GuessTheXiGame({
|
|
|
4864
5040
|
}
|
|
4865
5041
|
|
|
4866
5042
|
// src/components/games/DailyQuizGame.tsx
|
|
4867
|
-
var
|
|
5043
|
+
var import_react33 = require("react");
|
|
4868
5044
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4869
5045
|
function parseClientState6(json) {
|
|
4870
5046
|
if (!json) return null;
|
|
@@ -4883,7 +5059,7 @@ function DailyQuizGame({
|
|
|
4883
5059
|
submitting,
|
|
4884
5060
|
onSubmit
|
|
4885
5061
|
}) {
|
|
4886
|
-
const [selections, setSelections] = (0,
|
|
5062
|
+
const [selections, setSelections] = (0, import_react33.useState)(/* @__PURE__ */ new Map());
|
|
4887
5063
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
4888
5064
|
const isRevealed = (clientState?.results.length ?? 0) > 0 || result?.alreadyPlayed === true;
|
|
4889
5065
|
const allAnswered = config != null && selections.size === config.questions.length;
|
|
@@ -4963,7 +5139,7 @@ function DailyQuizGame({
|
|
|
4963
5139
|
}
|
|
4964
5140
|
|
|
4965
5141
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
4966
|
-
var
|
|
5142
|
+
var import_react34 = require("react");
|
|
4967
5143
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4968
5144
|
function parseClientState7(json) {
|
|
4969
5145
|
if (!json) return null;
|
|
@@ -4986,9 +5162,9 @@ function MatchdayPredictorGame({
|
|
|
4986
5162
|
submitting,
|
|
4987
5163
|
onSubmit
|
|
4988
5164
|
}) {
|
|
4989
|
-
const [homeScore, setHomeScore] = (0,
|
|
4990
|
-
const [awayScore, setAwayScore] = (0,
|
|
4991
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
5165
|
+
const [homeScore, setHomeScore] = (0, import_react34.useState)(0);
|
|
5166
|
+
const [awayScore, setAwayScore] = (0, import_react34.useState)(0);
|
|
5167
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react34.useState)(null);
|
|
4992
5168
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
4993
5169
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
4994
5170
|
if (alreadyPlayed && clientState) {
|
|
@@ -5138,7 +5314,7 @@ function MatchdayPredictorGame({
|
|
|
5138
5314
|
}
|
|
5139
5315
|
|
|
5140
5316
|
// src/components/games/StartingXiGame.tsx
|
|
5141
|
-
var
|
|
5317
|
+
var import_react35 = require("react");
|
|
5142
5318
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5143
5319
|
function parseClientState8(json) {
|
|
5144
5320
|
if (!json) return null;
|
|
@@ -5159,7 +5335,7 @@ function StartingXiGame({
|
|
|
5159
5335
|
submitting,
|
|
5160
5336
|
onSubmit
|
|
5161
5337
|
}) {
|
|
5162
|
-
const [picked, setPicked] = (0,
|
|
5338
|
+
const [picked, setPicked] = (0, import_react35.useState)([]);
|
|
5163
5339
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
5164
5340
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
5165
5341
|
if (alreadyPlayed) {
|
|
@@ -5403,8 +5579,8 @@ function GameScreenHost({
|
|
|
5403
5579
|
ui
|
|
5404
5580
|
}) {
|
|
5405
5581
|
const { gameId, fixtureId, gameDay = "" } = selected;
|
|
5406
|
-
const [configJson, setConfigJson] = (0,
|
|
5407
|
-
(0,
|
|
5582
|
+
const [configJson, setConfigJson] = (0, import_react36.useState)(null);
|
|
5583
|
+
(0, import_react36.useEffect)(() => {
|
|
5408
5584
|
setConfigJson(null);
|
|
5409
5585
|
if (!conversation) return;
|
|
5410
5586
|
let cancelled = false;
|
|
@@ -5426,12 +5602,12 @@ function GameScreenHost({
|
|
|
5426
5602
|
gameDay,
|
|
5427
5603
|
fixtureId: fixtureId || void 0
|
|
5428
5604
|
});
|
|
5429
|
-
(0,
|
|
5605
|
+
(0, import_react36.useEffect)(() => {
|
|
5430
5606
|
if (conversation) hydrate();
|
|
5431
5607
|
}, [conversation, gameId]);
|
|
5432
|
-
const hydrateRef = (0,
|
|
5608
|
+
const hydrateRef = (0, import_react36.useRef)(hydrate);
|
|
5433
5609
|
hydrateRef.current = hydrate;
|
|
5434
|
-
(0,
|
|
5610
|
+
(0, import_react36.useEffect)(() => {
|
|
5435
5611
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
5436
5612
|
if (rawStatus !== "pending") return;
|
|
5437
5613
|
const timerId = setInterval(() => {
|
|
@@ -5549,7 +5725,7 @@ function GamesPanel({
|
|
|
5549
5725
|
ui,
|
|
5550
5726
|
conversation
|
|
5551
5727
|
}) {
|
|
5552
|
-
const [selected, setSelected] = (0,
|
|
5728
|
+
const [selected, setSelected] = (0, import_react37.useState)(null);
|
|
5553
5729
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GamesLoginWall, { ui });
|
|
5554
5730
|
if (selected !== null) {
|
|
5555
5731
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-mon-list", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -5573,7 +5749,7 @@ function GamesPanel({
|
|
|
5573
5749
|
}
|
|
5574
5750
|
|
|
5575
5751
|
// src/components/Leaderboard.tsx
|
|
5576
|
-
var
|
|
5752
|
+
var import_react38 = require("react");
|
|
5577
5753
|
|
|
5578
5754
|
// src/components/LeaderboardRow.tsx
|
|
5579
5755
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
@@ -5613,18 +5789,58 @@ function LeaderboardAllTimeRow({
|
|
|
5613
5789
|
] });
|
|
5614
5790
|
}
|
|
5615
5791
|
|
|
5616
|
-
// src/components/
|
|
5792
|
+
// src/components/LeaderboardEmpty.tsx
|
|
5617
5793
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
5794
|
+
function LeaderboardEmpty({
|
|
5795
|
+
segment,
|
|
5796
|
+
lastWeek,
|
|
5797
|
+
weeklyPrize,
|
|
5798
|
+
onPlay,
|
|
5799
|
+
ui
|
|
5800
|
+
}) {
|
|
5801
|
+
if (segment === "alltime") {
|
|
5802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ss-w-lb-empty ss-w-lb-empty--alltime", children: [
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ss-w-lb-empty-icon", "aria-hidden": "true", children: "\u{1F4CA}" }),
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "ss-w-lb-empty-body", children: ui.leaderboardAllTimeEmpty })
|
|
5805
|
+
] });
|
|
5806
|
+
}
|
|
5807
|
+
const fresh = lastWeek != null;
|
|
5808
|
+
const title = fresh ? ui.leaderboardEmptyFreshTitle : ui.leaderboardEmptyColdTitle;
|
|
5809
|
+
const body = fresh ? ui.leaderboardEmptyFreshBody : ui.leaderboardEmptyColdBody;
|
|
5810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ss-w-lb-empty", children: [
|
|
5811
|
+
weeklyPrize && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ss-w-prize", children: [
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-prize-icon", "aria-hidden": "true", children: "\u{1F3C6}" }),
|
|
5813
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ss-w-prize-body", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-prize-text", children: weeklyPrize }) })
|
|
5814
|
+
] }),
|
|
5815
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ss-w-lb-empty-hero", children: [
|
|
5816
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ss-w-lb-empty-icon", "aria-hidden": "true", children: fresh ? "\u{1F3C6}" : "\u{1F3AE}" }),
|
|
5817
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "ss-w-lb-empty-title", children: title }),
|
|
5818
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "ss-w-lb-empty-body", children: body }),
|
|
5819
|
+
onPlay && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: "ss-w-lb-empty-cta", onClick: onPlay, children: ui.leaderboardEmptyCta })
|
|
5820
|
+
] }),
|
|
5821
|
+
fresh && lastWeek && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ss-w-lb-last", children: [
|
|
5822
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb-last-label", children: ui.leaderboardLastWeekLabel }),
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb-last-champ", "aria-hidden": "true", children: "\u{1F947}" }),
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb-last-handle", children: lastWeek.handle }),
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ss-w-lb-last-points", children: formatPoints(lastWeek.points) })
|
|
5826
|
+
] })
|
|
5827
|
+
] });
|
|
5828
|
+
}
|
|
5829
|
+
|
|
5830
|
+
// src/components/Leaderboard.tsx
|
|
5831
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
5618
5832
|
function Leaderboard({
|
|
5619
5833
|
data,
|
|
5620
|
-
ui
|
|
5834
|
+
ui,
|
|
5835
|
+
onPlay
|
|
5621
5836
|
}) {
|
|
5622
|
-
const [segment, setSegment] = (0,
|
|
5837
|
+
const [segment, setSegment] = (0, import_react38.useState)("weekly");
|
|
5623
5838
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
5624
5839
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5840
|
+
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
5841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb2", children: [
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-seg", children: [
|
|
5843
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5628
5844
|
"button",
|
|
5629
5845
|
{
|
|
5630
5846
|
type: "button",
|
|
@@ -5634,7 +5850,7 @@ function Leaderboard({
|
|
|
5634
5850
|
children: ui.leaderboardThisWeek
|
|
5635
5851
|
}
|
|
5636
5852
|
),
|
|
5637
|
-
/* @__PURE__ */ (0,
|
|
5853
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5638
5854
|
"button",
|
|
5639
5855
|
{
|
|
5640
5856
|
type: "button",
|
|
@@ -5645,44 +5861,64 @@ function Leaderboard({
|
|
|
5645
5861
|
}
|
|
5646
5862
|
)
|
|
5647
5863
|
] }),
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
{
|
|
5651
|
-
row,
|
|
5652
|
-
isMe: row.operatorUserId === data.myWeeklyRow?.operatorUserId
|
|
5653
|
-
},
|
|
5654
|
-
row.operatorUserId
|
|
5655
|
-
)) : data.allTimeTop.map((row) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
5656
|
-
LeaderboardAllTimeRow,
|
|
5864
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5865
|
+
LeaderboardEmpty,
|
|
5657
5866
|
{
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
segment === "weekly"
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5867
|
+
segment,
|
|
5868
|
+
lastWeek: data.lastWeek,
|
|
5869
|
+
weeklyPrize: data.weeklyPrize,
|
|
5870
|
+
onPlay,
|
|
5871
|
+
ui
|
|
5872
|
+
}
|
|
5873
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lb2-rows", children: segment === "weekly" ? data.weeklyTop.map((row) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5875
|
+
LeaderboardWeeklyRow,
|
|
5876
|
+
{
|
|
5877
|
+
row,
|
|
5878
|
+
isMe: row.operatorUserId === data.myWeeklyRow?.operatorUserId
|
|
5879
|
+
},
|
|
5880
|
+
row.operatorUserId
|
|
5881
|
+
)) : data.allTimeTop.map((row) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
5882
|
+
LeaderboardAllTimeRow,
|
|
5883
|
+
{
|
|
5884
|
+
row,
|
|
5885
|
+
isMe: row.operatorUserId === data.myAllTimeRow?.operatorUserId
|
|
5886
|
+
},
|
|
5887
|
+
row.operatorUserId
|
|
5888
|
+
)) }),
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-kitline", children: "\u{1F3BD}" }),
|
|
5890
|
+
myRow != null && (offBoard ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lbgap", children: ui.leaderboardOffBoard }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-lb2-rows", children: [
|
|
5891
|
+
segment === "weekly" && data.myWeeklyRow && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LeaderboardWeeklyRow, { row: data.myWeeklyRow, isMe: true }),
|
|
5892
|
+
segment === "alltime" && data.myAllTimeRow && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LeaderboardAllTimeRow, { row: data.myAllTimeRow, isMe: true })
|
|
5893
|
+
] })),
|
|
5894
|
+
segment === "alltime" && data.myAllTimeRow && !offBoard && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lb2-rows", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ss-w-lb2-row", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-lb2-handle", children: formatPoints(data.allTimeTop.reduce((s, r) => s + r.allTimePoints, 0)) }) }) })
|
|
5895
|
+
] })
|
|
5669
5896
|
] });
|
|
5670
5897
|
}
|
|
5671
5898
|
|
|
5672
5899
|
// src/components/LeaderboardPanel.tsx
|
|
5673
|
-
var
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5900
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
5901
|
+
var EMPTY_PAYLOAD = {
|
|
5902
|
+
week: "",
|
|
5903
|
+
weeklyTop: [],
|
|
5904
|
+
myWeeklyRow: null,
|
|
5905
|
+
allTimeTop: [],
|
|
5906
|
+
myAllTimeRow: null,
|
|
5907
|
+
weeklyPrize: null,
|
|
5908
|
+
lastWeek: null
|
|
5909
|
+
};
|
|
5910
|
+
function LeaderboardPanel({ loggedIn, data, loading, onPlay, ui }) {
|
|
5911
|
+
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(GamesLoginWall, { ui });
|
|
5912
|
+
if (data === null && loading) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-mon-list" });
|
|
5913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ss-w-mon-list", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Leaderboard, { data: data ?? EMPTY_PAYLOAD, ui, onPlay }) });
|
|
5678
5914
|
}
|
|
5679
5915
|
|
|
5680
5916
|
// src/components/ChatPanel.tsx
|
|
5681
|
-
var
|
|
5917
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5682
5918
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
5683
5919
|
function useIsModal() {
|
|
5684
|
-
const [modal, setModal] = (0,
|
|
5685
|
-
(0,
|
|
5920
|
+
const [modal, setModal] = (0, import_react39.useState)(false);
|
|
5921
|
+
(0, import_react39.useEffect)(() => {
|
|
5686
5922
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
5687
5923
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
5688
5924
|
const sync = () => setModal(mql.matches);
|
|
@@ -5695,7 +5931,7 @@ function useIsModal() {
|
|
|
5695
5931
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, loggedIn, conversation }) {
|
|
5696
5932
|
const { state, close, stop, send, reset } = controller;
|
|
5697
5933
|
const isModal = useIsModal();
|
|
5698
|
-
(0,
|
|
5934
|
+
(0, import_react39.useEffect)(() => {
|
|
5699
5935
|
const onKey = (e) => {
|
|
5700
5936
|
if (e.key === "Escape") close();
|
|
5701
5937
|
};
|
|
@@ -5706,11 +5942,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
5706
5942
|
monitor?.setActiveTab("chat");
|
|
5707
5943
|
send(text);
|
|
5708
5944
|
};
|
|
5709
|
-
(0,
|
|
5945
|
+
(0, import_react39.useEffect)(() => {
|
|
5710
5946
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
5711
5947
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
5712
|
-
return /* @__PURE__ */ (0,
|
|
5713
|
-
/* @__PURE__ */ (0,
|
|
5948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5714
5950
|
ChatHeader,
|
|
5715
5951
|
{
|
|
5716
5952
|
onClose: close,
|
|
@@ -5723,7 +5959,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
5723
5959
|
moreOptionsLabel: ui.moreOptions
|
|
5724
5960
|
}
|
|
5725
5961
|
),
|
|
5726
|
-
monitor && /* @__PURE__ */ (0,
|
|
5962
|
+
monitor && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5727
5963
|
TabBar,
|
|
5728
5964
|
{
|
|
5729
5965
|
monitor,
|
|
@@ -5735,19 +5971,28 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
5735
5971
|
gamesEnabled: gamesResult?.enabled ?? false
|
|
5736
5972
|
}
|
|
5737
5973
|
),
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5974
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5739
5975
|
"div",
|
|
5740
5976
|
{
|
|
5741
5977
|
style: !monitor || monitor.activeTab === "chat" ? { display: "contents" } : { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" },
|
|
5742
|
-
children: /* @__PURE__ */ (0,
|
|
5978
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(MessageList, { controller, ui, slip, onDashboardTap, monitor })
|
|
5743
5979
|
}
|
|
5744
5980
|
),
|
|
5745
|
-
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0,
|
|
5746
|
-
monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0,
|
|
5747
|
-
monitor && monitor.activeTab === "odds" && /* @__PURE__ */ (0,
|
|
5748
|
-
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0,
|
|
5749
|
-
monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ (0,
|
|
5750
|
-
|
|
5981
|
+
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TodayPanel, { discovery, ui, monitor }),
|
|
5982
|
+
monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(MatchesPanel, { monitor, ui, slip }),
|
|
5983
|
+
monitor && monitor.activeTab === "odds" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(OddsPanel, { monitor, ui, slip }),
|
|
5984
|
+
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(GamesPanel, { loggedIn: !!loggedIn, games: gamesResult.games, ui, conversation }),
|
|
5985
|
+
monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5986
|
+
LeaderboardPanel,
|
|
5987
|
+
{
|
|
5988
|
+
loggedIn: !!loggedIn,
|
|
5989
|
+
data: leaderboardResult.data,
|
|
5990
|
+
loading: leaderboardResult.loading,
|
|
5991
|
+
onPlay: () => monitor.setActiveTab("games"),
|
|
5992
|
+
ui
|
|
5993
|
+
}
|
|
5994
|
+
),
|
|
5995
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "leaderboard") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatInput, { placeholder: ui.placeholder, streaming: state.isStreaming, onSend: handleSend, onStop: stop, stopLabel: ui.stopResponse, sendLabel: ui.sendMessage })
|
|
5751
5996
|
] });
|
|
5752
5997
|
}
|
|
5753
5998
|
|
|
@@ -6701,6 +6946,20 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6701
6946
|
/* Off-board treatment: dashed pill indicating rank is outside top N */
|
|
6702
6947
|
.ss-w-lbgap { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; font-size: 11.5px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 10px; }
|
|
6703
6948
|
|
|
6949
|
+
/* ---- Leaderboard empty / weekly-reset default state ---- */
|
|
6950
|
+
.ss-w-lb-empty { display: flex; flex-direction: column; gap: 12px; flex: 1; }
|
|
6951
|
+
.ss-w-lb-empty-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 20px 16px; border: 1px dashed color-mix(in srgb, var(--ss-w-cta) 30%, var(--ss-w-line)); border-radius: 14px; background: color-mix(in srgb, var(--ss-w-cta) 6%, var(--ss-w-panel)); }
|
|
6952
|
+
.ss-w-lb-empty--alltime { align-items: center; justify-content: center; text-align: center; padding: 24px 16px; }
|
|
6953
|
+
.ss-w-lb-empty-icon { font-size: 30px; line-height: 1; }
|
|
6954
|
+
.ss-w-lb-empty-title { margin: 2px 0 0; font-size: 16px; font-weight: 800; color: var(--ss-w-ink); }
|
|
6955
|
+
.ss-w-lb-empty-body { margin: 0; max-width: 30ch; font-size: 12.5px; line-height: 1.4; color: var(--ss-w-faint); }
|
|
6956
|
+
.ss-w-lb-empty-cta { margin-top: 6px; border: none; border-radius: 10px; padding: 9px 18px; font: inherit; font-size: 13px; font-weight: 700; color: var(--ss-w-cta-ink); background: var(--ss-w-cta); cursor: pointer; }
|
|
6957
|
+
.ss-w-lb-empty-cta:hover { filter: brightness(1.04); }
|
|
6958
|
+
.ss-w-lb-last { display: flex; align-items: center; gap: 7px; padding-top: 10px; border-top: 1px solid var(--ss-w-line); font-size: 11px; }
|
|
6959
|
+
.ss-w-lb-last-label { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--ss-w-faint); }
|
|
6960
|
+
.ss-w-lb-last-handle { flex: 1; min-width: 0; font-weight: 600; color: var(--ss-w-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
6961
|
+
.ss-w-lb-last-points { flex: none; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--ss-w-ink); }
|
|
6962
|
+
|
|
6704
6963
|
/* ---- Mystery Tiger game screen (D3) ---- */
|
|
6705
6964
|
.ss-w-gt { display: flex; flex-direction: column; gap: 10px; }
|
|
6706
6965
|
/* Typeahead wrapper: relative so the dropdown can position under it */
|
|
@@ -6760,9 +7019,9 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6760
7019
|
.ss-w-hlbtns { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
|
|
6761
7020
|
.ss-w-hl-or { text-align: center; font-size: 11px; font-weight: 700; color: var(--ss-w-faint); }
|
|
6762
7021
|
.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; }
|
|
6763
|
-
|
|
6764
|
-
.ss-w-hlbtn--dn { background: var(--ss-w-panel); color: var(--ss-w-ink); }
|
|
6765
|
-
.ss-w-hlbtn:hover:not(:disabled) { border-color: var(--ss-w-accent); }
|
|
7022
|
+
/* Both options are neutral until picked \u2014 an amber default read as "already selected". */
|
|
7023
|
+
.ss-w-hlbtn--up, .ss-w-hlbtn--dn { background: var(--ss-w-panel); color: var(--ss-w-ink); }
|
|
7024
|
+
.ss-w-hlbtn:hover:not(:disabled) { border-color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 10%, var(--ss-w-panel)); color: var(--ss-w-accent); }
|
|
6766
7025
|
.ss-w-hlbtn:disabled { opacity: .5; cursor: not-allowed; }
|
|
6767
7026
|
/* Run-over terminal panel */
|
|
6768
7027
|
.ss-w-hl-over { background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 5px; }
|
|
@@ -6789,18 +7048,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6789
7048
|
.ss-w-cpath-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
6790
7049
|
.ss-w-cpath-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; }
|
|
6791
7050
|
/* Career sequence \u2014 horizontal crests with arrows */
|
|
6792
|
-
.ss-w-cpath-seq { display: flex; flex-wrap:
|
|
6793
|
-
.ss-w-cpath-arrow { align-self: center; color: var(--ss-w-faint); font-size: 13px; padding-top: 10px; }
|
|
7051
|
+
.ss-w-cpath-seq { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 4px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 13px 11px; overflow-x: auto; overscroll-behavior-x: contain; }
|
|
7052
|
+
.ss-w-cpath-arrow { align-self: center; flex: none; color: var(--ss-w-faint); font-size: 13px; padding-top: 10px; }
|
|
6794
7053
|
/* Single club \u2014 small vertical card */
|
|
6795
|
-
.ss-w-cpath-club { display: flex; flex-direction: column; align-items: center; gap: 3px; width:
|
|
7054
|
+
.ss-w-cpath-club { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; flex: none; }
|
|
6796
7055
|
.ss-w-cpath-crest { width: 34px; height: 34px; object-fit: contain; flex: none; border-radius: 8px; }
|
|
6797
7056
|
.ss-w-cpath-crest--fallback { background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); display: grid; place-items: center; font-size: 9px; font-weight: 800; letter-spacing: .02em; color: var(--ss-w-faint); }
|
|
6798
|
-
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.
|
|
7057
|
+
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.15; max-width: 56px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
6799
7058
|
.ss-w-cpath-spell-yr { font-size: 8px; color: var(--ss-w-faint); font-weight: 500; white-space: nowrap; }
|
|
6800
7059
|
.ss-w-cpath-loan-badge { font-size: 7.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ss-w-accent) 15%, var(--ss-w-panel)); color: var(--ss-w-accent); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|
|
6801
7060
|
.ss-w-cpath-club--loan .ss-w-cpath-crest { border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); }
|
|
6802
7061
|
/* Hidden clubs chip */
|
|
6803
|
-
.ss-w-cpath-hidden { align-self: center; font-size: 9px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
7062
|
+
.ss-w-cpath-hidden { align-self: center; flex: none; white-space: nowrap; font-size: 9px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
6804
7063
|
/* Hint line */
|
|
6805
7064
|
.ss-w-cpath-hint { font-size: 11.5px; color: var(--ss-w-faint); text-align: center; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ss-w-accent) 8%, var(--ss-w-panel)); border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|
|
6806
7065
|
/* Terminal outcome */
|
|
@@ -6864,23 +7123,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6864
7123
|
.ss-w-gxi-title { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--ss-w-ink); line-height: 1; }
|
|
6865
7124
|
.ss-w-gxi-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
6866
7125
|
.ss-w-gxi-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; }
|
|
6867
|
-
/*
|
|
6868
|
-
.ss-w-gxi-pitch { display: flex; flex-
|
|
6869
|
-
.ss-w-gxi-
|
|
6870
|
-
.ss-w-gxi-
|
|
6871
|
-
|
|
7126
|
+
/* Pitch: a flag per slot laid out in formation rows on a green field */
|
|
7127
|
+
.ss-w-gxi-pitch { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 16px 10px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ss-w-correct) 22%, var(--ss-w-line)); background: linear-gradient(180deg, color-mix(in srgb, var(--ss-w-correct) 10%, var(--ss-w-panel)), color-mix(in srgb, var(--ss-w-correct) 4%, var(--ss-w-panel))); }
|
|
7128
|
+
.ss-w-gxi-prow { display: flex; justify-content: space-around; align-items: center; gap: 8px; }
|
|
7129
|
+
.ss-w-gxi-flag { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 19px; line-height: 1; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); box-shadow: 0 1px 3px rgba(0,0,0,.14); overflow: hidden; }
|
|
7130
|
+
/* Wrong-guess trail */
|
|
7131
|
+
.ss-w-gxi-wrong { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
7132
|
+
.ss-w-gxi-wrong-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ss-w-wrong) 10%, var(--ss-w-panel)); border: 1px solid var(--ss-w-line); color: var(--ss-w-faint); text-decoration: line-through; }
|
|
6872
7133
|
/* Earned reveals */
|
|
6873
7134
|
.ss-w-gxi-reveals { display: flex; flex-direction: column; gap: 4px; }
|
|
6874
7135
|
.ss-w-gxi-reveal { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: color-mix(in srgb, var(--ss-w-cta) 8%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-cta) 22%, var(--ss-w-line)); border-radius: 8px; }
|
|
6875
7136
|
.ss-w-gxi-reveal-slot { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-cta-ink, #1b1300); background: var(--ss-w-cta); border-radius: 6px; padding: 1px 6px; flex: none; }
|
|
6876
7137
|
.ss-w-gxi-reveal-val { font-size: 12.5px; font-weight: 600; color: var(--ss-w-ink); }
|
|
6877
|
-
/* Team pool: responsive flex grid of buttons */
|
|
6878
|
-
.ss-w-gxi-pool { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
6879
|
-
.ss-w-gxi-team-btn { font: inherit; font-size: 12.5px; font-weight: 650; border-radius: 10px; padding: 9px 14px; cursor: pointer; border: 1.5px solid var(--ss-w-line); background: var(--ss-w-panel); color: var(--ss-w-ink); transition: background .1s, border-color .1s; }
|
|
6880
|
-
.ss-w-gxi-team-btn:hover:not(:disabled) { background: var(--ss-w-bubble); border-color: var(--ss-w-accent); }
|
|
6881
|
-
.ss-w-gxi-team-btn:disabled { opacity: .5; cursor: not-allowed; }
|
|
6882
|
-
.ss-w-gxi-team-btn--correct { background: color-mix(in srgb, var(--ss-w-correct) 14%, var(--ss-w-panel)); border-color: color-mix(in srgb, var(--ss-w-correct) 35%, var(--ss-w-line)); color: var(--ss-w-correct); }
|
|
6883
|
-
.ss-w-gxi-team-btn--wrong { background: color-mix(in srgb, var(--ss-w-wrong) 8%, var(--ss-w-panel)); text-decoration: line-through; opacity: .65; }
|
|
6884
7138
|
/* Terminal outcome banner */
|
|
6885
7139
|
.ss-w-gxi-banner { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 16px 12px; border-radius: 14px; text-align: center; }
|
|
6886
7140
|
.ss-w-gxi-banner--solved { background: color-mix(in srgb, var(--ss-w-correct) 12%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-correct) 28%, var(--ss-w-line)); }
|
|
@@ -7032,7 +7286,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
7032
7286
|
`;
|
|
7033
7287
|
|
|
7034
7288
|
// src/StatsWidget.tsx
|
|
7035
|
-
var
|
|
7289
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7036
7290
|
function buildClient(props) {
|
|
7037
7291
|
try {
|
|
7038
7292
|
if ("client" in props && props.client) {
|
|
@@ -7057,23 +7311,23 @@ function injectStyles(root) {
|
|
|
7057
7311
|
function StatsWidget(props) {
|
|
7058
7312
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
7059
7313
|
const cfg = props.config;
|
|
7060
|
-
const built = (0,
|
|
7061
|
-
const logger = (0,
|
|
7314
|
+
const built = (0, import_react40.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
7315
|
+
const logger = (0, import_react40.useMemo)(
|
|
7062
7316
|
() => built ? built.client.createEventLogger({
|
|
7063
7317
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
7064
7318
|
anonymousUserId: cfg?.userContext?.anonymousUserId
|
|
7065
7319
|
}) : null,
|
|
7066
7320
|
[built?.client]
|
|
7067
7321
|
);
|
|
7068
|
-
const ui = (0,
|
|
7069
|
-
const rootRef = (0,
|
|
7070
|
-
const introDoneRef = (0,
|
|
7071
|
-
const markIntroDone = (0,
|
|
7322
|
+
const ui = (0, import_react40.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
7323
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
7324
|
+
const introDoneRef = (0, import_react40.useRef)(false);
|
|
7325
|
+
const markIntroDone = (0, import_react40.useCallback)(() => {
|
|
7072
7326
|
introDoneRef.current = true;
|
|
7073
7327
|
}, []);
|
|
7074
7328
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
|
|
7075
7329
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey);
|
|
7076
|
-
const [hasToday, setHasToday] = (0,
|
|
7330
|
+
const [hasToday, setHasToday] = (0, import_react40.useState)(false);
|
|
7077
7331
|
const monitor = useLiveMonitor({
|
|
7078
7332
|
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins) : Promise.resolve(null),
|
|
7079
7333
|
getMarketOdds: (matchId, dev) => built ? built.conversation.getMarketOdds(matchId, dev) : Promise.resolve(null),
|
|
@@ -7081,15 +7335,15 @@ function StatsWidget(props) {
|
|
|
7081
7335
|
isOpen: controller.state.isOpen,
|
|
7082
7336
|
hasToday
|
|
7083
7337
|
});
|
|
7084
|
-
const getSchedule = (0,
|
|
7338
|
+
const getSchedule = (0, import_react40.useCallback)(
|
|
7085
7339
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes) : Promise.resolve(null),
|
|
7086
7340
|
[built]
|
|
7087
7341
|
);
|
|
7088
|
-
const getStates = (0,
|
|
7342
|
+
const getStates = (0, import_react40.useCallback)(
|
|
7089
7343
|
(matchIds) => built ? built.conversation.getStates(matchIds) : Promise.resolve(null),
|
|
7090
7344
|
[built]
|
|
7091
7345
|
);
|
|
7092
|
-
const pinnedMatchIds = (0,
|
|
7346
|
+
const pinnedMatchIds = (0, import_react40.useMemo)(
|
|
7093
7347
|
() => monitor.pins.filter((p) => p.kind === "match").map((p) => p.matchId),
|
|
7094
7348
|
[monitor.pins]
|
|
7095
7349
|
);
|
|
@@ -7101,19 +7355,19 @@ function StatsWidget(props) {
|
|
|
7101
7355
|
pinnedMatchIds
|
|
7102
7356
|
});
|
|
7103
7357
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
7104
|
-
(0,
|
|
7358
|
+
(0, import_react40.useEffect)(() => {
|
|
7105
7359
|
setHasToday(todayHasContent);
|
|
7106
7360
|
}, [todayHasContent]);
|
|
7107
7361
|
const gamesResult = useGames(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7108
7362
|
const leaderboardResult = useLeaderboard(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7109
7363
|
const markTodayActivity = monitor.markTodayActivity;
|
|
7110
|
-
const prevLiveCountRef = (0,
|
|
7111
|
-
(0,
|
|
7364
|
+
const prevLiveCountRef = (0, import_react40.useRef)(0);
|
|
7365
|
+
(0, import_react40.useEffect)(() => {
|
|
7112
7366
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
7113
7367
|
prevLiveCountRef.current = discovery.liveCount;
|
|
7114
7368
|
if (rose) markTodayActivity();
|
|
7115
7369
|
}, [discovery.liveCount, markTodayActivity]);
|
|
7116
|
-
const slip = (0,
|
|
7370
|
+
const slip = (0, import_react40.useMemo)(
|
|
7117
7371
|
() => {
|
|
7118
7372
|
const handler = props.config?.onAddToSlip;
|
|
7119
7373
|
return {
|
|
@@ -7136,18 +7390,18 @@ function StatsWidget(props) {
|
|
|
7136
7390
|
},
|
|
7137
7391
|
[props.config?.onAddToSlip, controller.state.conversationId, built, monitor.markInSlip]
|
|
7138
7392
|
);
|
|
7139
|
-
const onDashboardTap = (0,
|
|
7393
|
+
const onDashboardTap = (0, import_react40.useMemo)(
|
|
7140
7394
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
7141
7395
|
[built, logger]
|
|
7142
7396
|
);
|
|
7143
7397
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
7144
7398
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
7145
7399
|
const conversationId = controller.state.conversationId ?? void 0;
|
|
7146
|
-
(0,
|
|
7400
|
+
(0, import_react40.useEffect)(() => {
|
|
7147
7401
|
if (!logger) return;
|
|
7148
7402
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
7149
7403
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
7150
|
-
(0,
|
|
7404
|
+
(0, import_react40.useEffect)(() => {
|
|
7151
7405
|
if (!logger) return;
|
|
7152
7406
|
const onHide = () => {
|
|
7153
7407
|
logger.flushOnHide();
|
|
@@ -7164,14 +7418,14 @@ function StatsWidget(props) {
|
|
|
7164
7418
|
logger.dispose();
|
|
7165
7419
|
};
|
|
7166
7420
|
}, [logger]);
|
|
7167
|
-
(0,
|
|
7421
|
+
(0, import_react40.useEffect)(() => {
|
|
7168
7422
|
if (!built || !ui.injectStyles) return;
|
|
7169
7423
|
const node = rootRef.current?.getRootNode();
|
|
7170
7424
|
if (node) injectStyles(node);
|
|
7171
7425
|
}, [built, ui.injectStyles]);
|
|
7172
7426
|
if (!built) return null;
|
|
7173
7427
|
const attrs = themeAttrs(ui);
|
|
7174
|
-
return /* @__PURE__ */ (0,
|
|
7428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime72.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_runtime72.jsx)(
|
|
7175
7429
|
ChatPanel,
|
|
7176
7430
|
{
|
|
7177
7431
|
controller,
|
|
@@ -7185,7 +7439,7 @@ function StatsWidget(props) {
|
|
|
7185
7439
|
loggedIn: !!operatorUserId,
|
|
7186
7440
|
conversation: built?.conversation ?? null
|
|
7187
7441
|
}
|
|
7188
|
-
) : /* @__PURE__ */ (0,
|
|
7442
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7189
7443
|
ChatFab,
|
|
7190
7444
|
{
|
|
7191
7445
|
label: ui.launcherLabel,
|