@sensiblestats/widget-react 0.114.1 → 0.116.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 +146 -36
- 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 +201 -91
- package/dist/index.js.map +1 -1
- package/dist/styles.css +19 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.116.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- NBA Following tab: keep showing pre-tip player props while the game is still scheduled, until the server drops them or the game goes live.
|
|
8
|
+
|
|
9
|
+
## 0.115.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Live NBA props show each player's stats so far: value on every stat chip, minutes on the row, a live bar beside the last five games, and the stats clock in the header.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @sensiblestats/widget-sdk@0.81.0
|
|
19
|
+
|
|
3
20
|
## 0.114.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -454,6 +454,15 @@ var STRINGS = {
|
|
|
454
454
|
propsLast5: "Last 5 games",
|
|
455
455
|
propsLadderOnly: "Ladder only",
|
|
456
456
|
propsMarkets: (n) => `${n} markets`,
|
|
457
|
+
propsLast5Live: "Last 5 games + live",
|
|
458
|
+
propsLiveBar: "Live",
|
|
459
|
+
propsMinutes: (t) => `${t} min`,
|
|
460
|
+
propsLineChip: (l) => `line ${l}`,
|
|
461
|
+
propsShooting: (made, att) => `FG ${made}/${att}`,
|
|
462
|
+
propsFouls: (n) => `${n} PF`,
|
|
463
|
+
propsStatsLive: (t) => `Stats ${t} UTC \xB7 live`,
|
|
464
|
+
propsStatsAt: (t) => `Stats ${t} UTC`,
|
|
465
|
+
propsStatsAgo: (t, m) => `Stats ${t} UTC \xB7 ${m} min ago`,
|
|
457
466
|
propsStatShort: (stat) => NBA_STAT_SHORT_EN[stat] ?? stat,
|
|
458
467
|
matchupPace: "Pace",
|
|
459
468
|
matchupOffRating: "Offensive rating",
|
|
@@ -1135,6 +1144,15 @@ var STRINGS = {
|
|
|
1135
1144
|
propsLast5: "Son 5 ma\xE7",
|
|
1136
1145
|
propsLadderOnly: "Sadece alternatif",
|
|
1137
1146
|
propsMarkets: (n) => `${n} market`,
|
|
1147
|
+
propsLast5Live: "Son 5 ma\xE7 + canl\u0131",
|
|
1148
|
+
propsLiveBar: "Canl\u0131",
|
|
1149
|
+
propsMinutes: (t) => `${t} dk`,
|
|
1150
|
+
propsLineChip: (l) => `baraj ${l}`,
|
|
1151
|
+
propsShooting: (made, att) => `\u0130B ${made}/${att}`,
|
|
1152
|
+
propsFouls: (n) => `${n} faul`,
|
|
1153
|
+
propsStatsLive: (t) => `\u0130statistik ${t} UTC \xB7 canl\u0131`,
|
|
1154
|
+
propsStatsAt: (t) => `\u0130statistik ${t} UTC`,
|
|
1155
|
+
propsStatsAgo: (t, m) => `\u0130statistik ${t} UTC \xB7 ${m} dk \xF6nce`,
|
|
1138
1156
|
propsStatShort: (stat) => NBA_STAT_SHORT_TR[stat] ?? stat,
|
|
1139
1157
|
matchupPace: "Tempo",
|
|
1140
1158
|
matchupOffRating: "H\xFCcum reytingi",
|
|
@@ -1479,7 +1497,7 @@ function parseOddsFormat(value) {
|
|
|
1479
1497
|
}
|
|
1480
1498
|
|
|
1481
1499
|
// src/version.generated.ts
|
|
1482
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1500
|
+
var WIDGET_REACT_VERSION = "0.116.0";
|
|
1483
1501
|
|
|
1484
1502
|
// src/config.ts
|
|
1485
1503
|
function normalizeUi(cfg) {
|
|
@@ -4212,6 +4230,7 @@ function useTabs(initial = "chat") {
|
|
|
4212
4230
|
|
|
4213
4231
|
// src/useLiveMonitor.ts
|
|
4214
4232
|
var PROPS_FRESH_MS = 6e4;
|
|
4233
|
+
var PROPS_LIVE_FRESH_MS = 1e4;
|
|
4215
4234
|
var MARKET_FRESH_MS = 45e3;
|
|
4216
4235
|
var MARKET_FETCH_TIMEOUT_MS = 15e3;
|
|
4217
4236
|
var DEFAULT_FOOTBALL_MARKET = "FULLTIME_RESULT";
|
|
@@ -4321,7 +4340,7 @@ function useLiveMonitor(opts) {
|
|
|
4321
4340
|
if (!fn) return;
|
|
4322
4341
|
const key = monitorMatchKey(sport, matchId);
|
|
4323
4342
|
const cur = playerPropsRef.current[key];
|
|
4324
|
-
if (cur?.loading || cur && Date.now() - cur.fetchedAt < PROPS_FRESH_MS) return;
|
|
4343
|
+
if (cur?.loading || cur && Date.now() - cur.fetchedAt < (cur.bundle?.live ? PROPS_LIVE_FRESH_MS : PROPS_FRESH_MS)) return;
|
|
4325
4344
|
const put = (entry) => {
|
|
4326
4345
|
playerPropsRef.current = { ...playerPropsRef.current, [key]: entry };
|
|
4327
4346
|
setPlayerProps((prev) => ({ ...prev, [key]: entry }));
|
|
@@ -10194,6 +10213,8 @@ var import_react60 = require("react");
|
|
|
10194
10213
|
// src/components/PropsPieces.tsx
|
|
10195
10214
|
var import_react59 = require("react");
|
|
10196
10215
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10216
|
+
var livePlayer = (bundle, p) => bundle.live === true || !p.live ? p : { ...p, live: null };
|
|
10217
|
+
var mmss = (seconds) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
10197
10218
|
var MAX_TIMER_MS = 2147483647;
|
|
10198
10219
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
10199
10220
|
function preKickoff(match) {
|
|
@@ -10214,7 +10235,8 @@ function usePreKickoff(match) {
|
|
|
10214
10235
|
}
|
|
10215
10236
|
function usePropsOpen(match, monitor, descriptor) {
|
|
10216
10237
|
const sport = descriptor.sport === "americanfootball" ? "americanfootball" : void 0;
|
|
10217
|
-
const
|
|
10238
|
+
const beforeKickoff = usePreKickoff(match);
|
|
10239
|
+
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
10218
10240
|
const live = descriptor.sport === "basketball" && match.phase === "live";
|
|
10219
10241
|
const open = pre || live;
|
|
10220
10242
|
(0, import_react59.useEffect)(() => {
|
|
@@ -10262,51 +10284,68 @@ function PriceCell({ hitsText, children }) {
|
|
|
10262
10284
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-rung-hits", children: hitsText })
|
|
10263
10285
|
] });
|
|
10264
10286
|
}
|
|
10265
|
-
function PropBars({ bars, line, title, wide, ui }) {
|
|
10287
|
+
function PropBars({ bars, line, title, wide, ui, note }) {
|
|
10266
10288
|
const values = bars.map((b) => b.value);
|
|
10267
10289
|
const top = Math.max(...values, line ?? 0, 1) * 1.1;
|
|
10268
10290
|
const pct = (v) => `${v / top * 100}%`;
|
|
10291
|
+
const hasLive = bars.some((b) => b.live);
|
|
10292
|
+
const columns = { "--ss-bars": bars.length };
|
|
10293
|
+
const barClass = (b, v) => b.live ? "ss-w-props-bar ss-w-props-bar--live" : wide && line != null && v < line ? "ss-w-props-bar ss-w-props-bar--under" : "ss-w-props-bar";
|
|
10269
10294
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-l5", children: [
|
|
10270
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
10271
|
-
|
|
10272
|
-
|
|
10295
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-l5-head", children: [
|
|
10296
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-cap", children: title }),
|
|
10297
|
+
note
|
|
10298
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-cap", children: title }),
|
|
10299
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: `${wide ? "ss-w-props-bars ss-w-props-bars--wide" : "ss-w-props-bars"}${hasLive ? " ss-w-props-bars--live" : ""}`, style: hasLive ? columns : void 0, children: [
|
|
10300
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
10273
10301
|
"span",
|
|
10274
10302
|
{
|
|
10275
|
-
className:
|
|
10276
|
-
style: { height: pct(
|
|
10277
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-val", children:
|
|
10303
|
+
className: barClass(b, b.value),
|
|
10304
|
+
style: { height: pct(b.value) },
|
|
10305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-val", children: b.value })
|
|
10278
10306
|
},
|
|
10279
10307
|
i
|
|
10280
10308
|
)),
|
|
10281
10309
|
line != null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-ref", style: { bottom: pct(line) }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-ref-lab", children: ui.nba.lineText(String(line)) }) })
|
|
10282
10310
|
] }),
|
|
10283
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps", children: bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { children: [
|
|
10311
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `${wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps"}${hasLive ? " ss-w-props-opps--live" : ""}`, style: hasLive ? columns : void 0, children: bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { children: [
|
|
10284
10312
|
b.away && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("i", { className: "ss-w-props-at", children: "@" }),
|
|
10285
|
-
b.label
|
|
10313
|
+
b.live ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: b.label }) : b.label
|
|
10286
10314
|
] }, i)) })
|
|
10287
10315
|
] });
|
|
10288
10316
|
}
|
|
10289
|
-
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10317
|
+
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
10318
|
+
const player = livePlayer(bundle, given);
|
|
10290
10319
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10291
10320
|
const [picked, setPicked] = (0, import_react59.useState)(null);
|
|
10292
10321
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10293
10322
|
const sample = active?.games?.length ?? 0;
|
|
10294
10323
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
10295
10324
|
const bars = active ? descriptor.bars(active, player) : [];
|
|
10296
|
-
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length) : descriptor.barsTitle;
|
|
10325
|
+
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length, bars.some((b) => b.live)) : descriptor.barsTitle;
|
|
10297
10326
|
const priceProps = { bundle, descriptor, ui, slip };
|
|
10327
|
+
const liveValue = (s) => player.live ? descriptor.live?.(s, player) ?? null : null;
|
|
10328
|
+
const liveChips = stats.some((s) => liveValue(s) !== null);
|
|
10298
10329
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-panel", children: [
|
|
10299
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-chips", children: stats.map((s) =>
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10330
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: liveChips ? "ss-w-props-chips ss-w-props-chips--live" : "ss-w-props-chips", children: stats.map((s) => {
|
|
10331
|
+
const now = liveValue(s);
|
|
10332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10333
|
+
"button",
|
|
10334
|
+
{
|
|
10335
|
+
type: "button",
|
|
10336
|
+
className: "ss-w-props-chip",
|
|
10337
|
+
"aria-pressed": s === active,
|
|
10338
|
+
"aria-label": now !== null ? [`${now} ${descriptor.statLabel(s.stat)}`, s.line != null ? ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) : null].filter(Boolean).join(", ") : void 0,
|
|
10339
|
+
onClick: () => setPicked(s.stat),
|
|
10340
|
+
children: [
|
|
10341
|
+
now !== null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: now }),
|
|
10342
|
+
descriptor.statLabel(s.stat),
|
|
10343
|
+
now !== null && s.line != null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("i", { children: ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) })
|
|
10344
|
+
]
|
|
10345
|
+
},
|
|
10346
|
+
s.stat
|
|
10347
|
+
);
|
|
10348
|
+
}) }),
|
|
10310
10349
|
active && hasMainLine(active) && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: descriptor.sport === "americanfootball" ? "ss-w-props-ou ss-w-props-ou--nfl" : "ss-w-props-ou", children: [
|
|
10311
10350
|
active.over && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PriceCell, { hitsText: hitsOf(active.over, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPrice, { price: active.over, label: ui.nba.over(ui.nba.lineText(String(active.over.line ?? active.line))), stat: active, ...priceProps }) }),
|
|
10312
10351
|
active.under && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PriceCell, { hitsText: hitsOf(active.under, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPrice, { price: active.under, label: ui.nba.under(ui.nba.lineText(String(active.under.line ?? active.line))), stat: active, ...priceProps }) })
|
|
@@ -10323,15 +10362,17 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10323
10362
|
}
|
|
10324
10363
|
) }, p.matchOddsId)) })
|
|
10325
10364
|
] }),
|
|
10326
|
-
active && bars.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui })
|
|
10365
|
+
active && bars.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui, note: player.live ? descriptor.liveNote?.(player, ui) : null })
|
|
10327
10366
|
] });
|
|
10328
10367
|
}
|
|
10329
10368
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10330
10369
|
const [openId, setOpenId] = (0, import_react59.useState)(null);
|
|
10331
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-list", children: players.map((
|
|
10370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
10371
|
+
const p = livePlayer(bundle, given);
|
|
10332
10372
|
const isOpen = openId === p.playerId;
|
|
10333
10373
|
const main = descriptor.mainStat(p);
|
|
10334
|
-
const
|
|
10374
|
+
const now = main && p.live ? descriptor.live?.(main, p) ?? null : null;
|
|
10375
|
+
const meta = [p.position, p.live ? ui.nba.propsMinutes(mmss(p.live.secondsPlayed)) : null, ui.nba.propsMarkets(p.stats.length)].filter(Boolean).join(" \xB7 ");
|
|
10335
10376
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ss-w-props-item", children: [
|
|
10336
10377
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10337
10378
|
"button",
|
|
@@ -10346,14 +10387,17 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
10346
10387
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-name", children: p.name }),
|
|
10347
10388
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-meta", children: meta })
|
|
10348
10389
|
] }),
|
|
10349
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10390
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: now !== null ? "ss-w-props-main ss-w-props-main--live" : "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10350
10391
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-stat", children: descriptor.statShort(main.stat) }),
|
|
10351
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
10392
|
+
now !== null ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ss-w-props-nowline", children: [
|
|
10393
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-now", children: now }),
|
|
10394
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-line", children: `\xB7 ${ui.nba.lineText(String(main.line))}` })
|
|
10395
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-line", children: ui.nba.lineText(String(main.line)) })
|
|
10352
10396
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ss-w-props-stat", children: ui.nba.propsLadderOnly }) })
|
|
10353
10397
|
]
|
|
10354
10398
|
}
|
|
10355
10399
|
),
|
|
10356
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPlayerPanel, { player:
|
|
10400
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PropPlayerPanel, { player: given, bundle, descriptor, ui, slip })
|
|
10357
10401
|
] }, p.playerId);
|
|
10358
10402
|
}) });
|
|
10359
10403
|
}
|
|
@@ -10367,21 +10411,65 @@ var GAME_VALUE = {
|
|
|
10367
10411
|
assists: (g) => g.ast,
|
|
10368
10412
|
threes: (g) => g.fg3m
|
|
10369
10413
|
};
|
|
10370
|
-
var
|
|
10414
|
+
var LIVE_VALUE = {
|
|
10415
|
+
points: (l) => l.pts,
|
|
10416
|
+
rebounds: (l) => l.reb,
|
|
10417
|
+
assists: (l) => l.ast,
|
|
10418
|
+
threes: (l) => l.fg3m
|
|
10419
|
+
};
|
|
10420
|
+
var BOX_QUIET_MS = 12e4;
|
|
10421
|
+
var foulTrouble = (pf, period) => period != null && pf >= (period <= 2 ? 3 : 4);
|
|
10422
|
+
var nbaDescriptor = (ui, match) => ({
|
|
10371
10423
|
sport: "basketball",
|
|
10372
10424
|
stats: STAT_ORDER,
|
|
10373
10425
|
statLabel: ui.nba.stat,
|
|
10374
10426
|
statShort: ui.nba.propsStatShort,
|
|
10375
10427
|
mainStat: (p) => p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine),
|
|
10376
|
-
bars: (stat, player) =>
|
|
10377
|
-
|
|
10428
|
+
bars: (stat, player) => {
|
|
10429
|
+
const past = [...player.last5].reverse().map((g) => ({ label: g.opponent, value: (GAME_VALUE[stat.stat] ?? (() => 0))(g) }));
|
|
10430
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10431
|
+
return player.live && now ? [...past, { label: ui.nba.propsLiveBar, value: now(player.live), live: true }] : past;
|
|
10432
|
+
},
|
|
10433
|
+
live: (stat, player) => {
|
|
10434
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10435
|
+
return player.live && now ? now(player.live) : null;
|
|
10436
|
+
},
|
|
10437
|
+
liveNote: (player) => {
|
|
10438
|
+
const l = player.live;
|
|
10439
|
+
if (!l) return null;
|
|
10440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "ss-w-props-l5-note", children: [
|
|
10441
|
+
ui.nba.propsShooting(l.fgm, l.fga),
|
|
10442
|
+
" \xB7 ",
|
|
10443
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: foulTrouble(l.pf, match.basketball?.period) ? "ss-w-props-pf--warn" : void 0, children: ui.nba.propsFouls(l.pf) })
|
|
10444
|
+
] });
|
|
10445
|
+
},
|
|
10446
|
+
barsTitle: (_n, hasLive) => hasLive ? ui.nba.propsLast5Live : ui.nba.propsLast5,
|
|
10378
10447
|
showHits: false,
|
|
10379
10448
|
rungLabel: (line, ui2) => `${ui2.nba.lineText(String(line))}+`,
|
|
10380
10449
|
tenGameBars: false
|
|
10381
10450
|
});
|
|
10451
|
+
function StatsClock({ bundle, match, ui }) {
|
|
10452
|
+
const [tick, setTick] = (0, import_react60.useState)(0);
|
|
10453
|
+
const at = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
10454
|
+
const time = clock2(bundle.boxAsOfUtc);
|
|
10455
|
+
const valid = !Number.isNaN(at) && time !== "";
|
|
10456
|
+
const onBreak = atBreak(match);
|
|
10457
|
+
(0, import_react60.useEffect)(() => {
|
|
10458
|
+
if (!valid || onBreak) return;
|
|
10459
|
+
const age2 = Date.now() - at;
|
|
10460
|
+
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
10461
|
+
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
10462
|
+
return () => clearTimeout(id);
|
|
10463
|
+
}, [valid, onBreak, at, tick]);
|
|
10464
|
+
if (!valid) return null;
|
|
10465
|
+
if (onBreak) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAt(time) });
|
|
10466
|
+
const age = Date.now() - at;
|
|
10467
|
+
if (age >= BOX_QUIET_MS) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAgo(time, Math.floor(age / 6e4)) });
|
|
10468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
10469
|
+
}
|
|
10382
10470
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10383
10471
|
const [side, setSide] = (0, import_react60.useState)("home");
|
|
10384
|
-
const descriptor = nbaDescriptor(ui);
|
|
10472
|
+
const descriptor = nbaDescriptor(ui, match);
|
|
10385
10473
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10386
10474
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10387
10475
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
@@ -10392,7 +10480,10 @@ function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
|
10392
10480
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10393
10481
|
];
|
|
10394
10482
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10395
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.
|
|
10483
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "ss-w-props-headrow", children: [
|
|
10484
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10485
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(StatsClock, { bundle, match, ui })
|
|
10486
|
+
] }),
|
|
10396
10487
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("button", { type: "button", className: "ss-w-props-side", "aria-pressed": shown2 === s.side, onClick: () => setSide(s.side), children: `${s.abbreviation} \xB7 ${bySide(s.side).length}` }, s.side)) }),
|
|
10397
10488
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PropRoster, { bundle, players: bySide(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10398
10489
|
] });
|
|
@@ -17956,6 +18047,25 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17956
18047
|
.ss-w-props-ref { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ss-w-ink); }
|
|
17957
18048
|
.ss-w-props-ref-lab { position: absolute; right: 0; top: -7px; width: 28px; text-align: right; line-height: 13px; border-radius: 3px; background: var(--ss-w-bubble); font-size: 9.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
17958
18049
|
.ss-w-props-opps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-right: 32px; text-align: center; font-size: 10px; color: var(--ss-w-faint); }
|
|
18050
|
+
/* Live stats on NBA props (u620): box clock, stat chips with a value, a hatched live bar. */
|
|
18051
|
+
.ss-w-props-headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
|
|
18052
|
+
.ss-w-props-asof { font-size: 10.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; text-align: right; }
|
|
18053
|
+
.ss-w-props-asof--live, .ss-w-props-pf--warn { color: var(--ss-w-warn); }
|
|
18054
|
+
.ss-w-props-main--live { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; gap: 2px; max-width: none; }
|
|
18055
|
+
.ss-w-props-nowline { display: flex; align-items: baseline; gap: 4px; }
|
|
18056
|
+
.ss-w-props-now { font-size: 12.5px; font-weight: 800; color: var(--ss-w-ink); }
|
|
18057
|
+
.ss-w-props-main--live .ss-w-props-line { font-weight: 600; color: var(--ss-w-faint); }
|
|
18058
|
+
.ss-w-props-chips--live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
|
|
18059
|
+
.ss-w-props-chips--live .ss-w-props-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 44px; padding: 6px 4px; border-radius: 10px; font-size: 11px; white-space: normal; text-align: center; }
|
|
18060
|
+
.ss-w-props-chips--live .ss-w-props-chip b { font-size: 15px; font-weight: 800; color: var(--ss-w-ink); font-variant-numeric: tabular-nums; }
|
|
18061
|
+
.ss-w-props-chips--live .ss-w-props-chip i { font-style: normal; font-size: 10px; font-weight: 500; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
18062
|
+
.ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] b, .ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] i { color: #fff; }
|
|
18063
|
+
.ss-w-props-l5-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 8px; row-gap: 2px; min-width: 0; }
|
|
18064
|
+
.ss-w-props-l5-note { font-size: 11px; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
18065
|
+
.ss-w-props-bars--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18066
|
+
.ss-w-props-opps--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18067
|
+
.ss-w-props-opps b { font-weight: 700; color: var(--ss-w-ink); }
|
|
18068
|
+
.ss-w-props-bar--live { background: repeating-linear-gradient(135deg, var(--ss-w-ink) 0 3px, var(--ss-w-faint) 3px 6px); }
|
|
17959
18069
|
/* NFL props (u605): three tabs, ten-game bars coloured by the line, and the fact and scorer grids. */
|
|
17960
18070
|
.ss-w-props-trends { margin-bottom: 8px; }
|
|
17961
18071
|
.ss-w-props-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|