@sensiblestats/widget-react 0.95.0 → 0.96.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 +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1099,7 +1099,7 @@ function isEnglishLocale(locale) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
1101
1101
|
// src/version.generated.ts
|
|
1102
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1102
|
+
var WIDGET_REACT_VERSION = "0.96.0";
|
|
1103
1103
|
|
|
1104
1104
|
// src/config.ts
|
|
1105
1105
|
function normalizeUi(cfg) {
|
|
@@ -7544,18 +7544,20 @@ function Roster({ bundle, players, side, ui, slip }) {
|
|
|
7544
7544
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
7545
7545
|
const [side, setSide] = useState34("home");
|
|
7546
7546
|
const [, setTick] = useState34(0);
|
|
7547
|
-
const
|
|
7547
|
+
const pre = preTip(match);
|
|
7548
|
+
const live = match.phase === "live";
|
|
7549
|
+
const open = pre || live;
|
|
7548
7550
|
useEffect25(() => {
|
|
7549
7551
|
if (open) monitor.loadPlayerProps?.(match.matchId);
|
|
7550
7552
|
}, [match.matchId, match.asOfUtc, open]);
|
|
7551
7553
|
useEffect25(() => {
|
|
7552
|
-
if (!
|
|
7554
|
+
if (!pre || !match.kickoffUtc) return;
|
|
7553
7555
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
7554
7556
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
7555
7557
|
return () => clearTimeout(id);
|
|
7556
|
-
}, [
|
|
7558
|
+
}, [pre, match.kickoffUtc]);
|
|
7557
7559
|
const bundle = monitor.playerProps?.[match.matchId]?.bundle;
|
|
7558
|
-
if (!open || !bundle || bundle.players.length === 0) return null;
|
|
7560
|
+
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
7559
7561
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
7560
7562
|
const other = side === "home" ? "away" : "home";
|
|
7561
7563
|
const shown = bySide(side).length > 0 ? side : other;
|
|
@@ -7596,6 +7598,12 @@ function Side({ abbreviation, nickname, teamName, away }) {
|
|
|
7596
7598
|
] })
|
|
7597
7599
|
] });
|
|
7598
7600
|
}
|
|
7601
|
+
function lastScored(scores) {
|
|
7602
|
+
for (let i = scores.length - 1; i >= 0; i--) {
|
|
7603
|
+
if (typeof scores[i] === "number") return i + 1;
|
|
7604
|
+
}
|
|
7605
|
+
return 0;
|
|
7606
|
+
}
|
|
7599
7607
|
function cell(value) {
|
|
7600
7608
|
return typeof value === "number" ? String(value) : /* @__PURE__ */ jsx57("span", { className: "ss-w-nbamon-dash", children: "\u2013" });
|
|
7601
7609
|
}
|
|
@@ -7624,8 +7632,9 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
7624
7632
|
const inPlay = live && !atBreak(match);
|
|
7625
7633
|
const scored = live || match.phase === "fullTime";
|
|
7626
7634
|
const kickoff = match.phase === "preMatch" && match.kickoffUtc ? ui.bettingKickoff(match.kickoffUtc) : void 0;
|
|
7627
|
-
const periods = Math.max(REGULATION_PERIODS, b.homePeriods
|
|
7635
|
+
const periods = Math.max(REGULATION_PERIODS, b.period, lastScored(b.homePeriods), lastScored(b.awayPeriods));
|
|
7628
7636
|
const columns = Array.from({ length: periods }, (_, i) => i);
|
|
7637
|
+
const played = (i) => !live || i < b.period;
|
|
7629
7638
|
const timeouts = [
|
|
7630
7639
|
{ key: "away", value: b.awayTimeoutsLeft },
|
|
7631
7640
|
{ key: "home", value: b.homeTimeoutsLeft }
|
|
@@ -7672,7 +7681,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
7672
7681
|
{ abbreviation: b.homeAbbreviation, scores: b.homePeriods, total: match.homeScore }
|
|
7673
7682
|
].map((row) => /* @__PURE__ */ jsxs52("tr", { children: [
|
|
7674
7683
|
/* @__PURE__ */ jsx57("th", { scope: "row", children: row.abbreviation }),
|
|
7675
|
-
columns.map((i) => /* @__PURE__ */ jsx57("td", { className: inPlay && i === b.period - 1 ? "ss-w-nbamon-cur" : void 0, children: cell(row.scores[i]) }, i)),
|
|
7684
|
+
columns.map((i) => /* @__PURE__ */ jsx57("td", { className: inPlay && i === b.period - 1 ? "ss-w-nbamon-cur" : void 0, children: cell(played(i) ? row.scores[i] : null) }, i)),
|
|
7676
7685
|
/* @__PURE__ */ jsx57("td", { className: "ss-w-nbamon-total", children: row.total ?? 0 })
|
|
7677
7686
|
] }, row.abbreviation)) })
|
|
7678
7687
|
] }),
|