@sensiblestats/widget-react 0.47.0 → 0.47.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.47.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Hide a Today-tab competition group whose every match has been hoisted into the live band, instead of rendering an empty header with a count of 0.
8
+
9
+ ## 0.47.1
10
+
11
+ ### Patch Changes
12
+
13
+ - A match whose live reading has gone stale now leaves the live band as well as losing its clock,
14
+ with the band and the competition group deciding from one shared predicate so it can never fall
15
+ between them.
16
+
3
17
  ## 0.47.0
4
18
 
5
19
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1575,6 +1575,9 @@ function displayMinute(state, nowMs) {
1575
1575
  const advanced = base + Math.floor(age / 6e4);
1576
1576
  return `${advanced}'`;
1577
1577
  }
1578
+ function isTreatedLive(state, pollStale, nowMs) {
1579
+ return state?.phase === "live" && !pollStale && !isReadingStale(state, nowMs);
1580
+ }
1578
1581
 
1579
1582
  // src/useMatchDiscovery.ts
1580
1583
  var POLL_MS = 6e4;
@@ -3797,8 +3800,11 @@ function FixtureRow({ match, state, stale, nowMs, ui, monitor }) {
3797
3800
  // src/components/CompetitionGroup.tsx
3798
3801
  var import_jsx_runtime50 = require("react/jsx-runtime");
3799
3802
  function CompetitionGroup({ group, open, onToggle, states, stale, nowMs, ui, monitor, disambiguate = false }) {
3800
- const own = group.matches.filter((m) => states[m.matchId]?.phase !== "live" || stale);
3803
+ const own = group.matches.filter((m) => !isTreatedLive(states[m.matchId], stale, nowMs));
3801
3804
  const hasLive = own.length !== group.matches.length;
3805
+ if (own.length === 0) {
3806
+ return null;
3807
+ }
3802
3808
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "ss-w-grp", children: [
3803
3809
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("button", { type: "button", className: "ss-w-grp-head", "aria-expanded": open, onClick: onToggle, children: [
3804
3810
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "ss-w-grp-chev", children: open ? "\u25BE" : "\u25B8" }),
@@ -3821,7 +3827,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, nowMs, ui, mon
3821
3827
  var import_jsx_runtime51 = require("react/jsx-runtime");
3822
3828
  function TodayPanel({ discovery, ui, monitor }) {
3823
3829
  const { groups, states, nowMs, stale, expanded, toggleGroup } = discovery;
3824
- const liveRows = stale ? [] : groups.flatMap((group) => group.matches.filter((m) => states[m.matchId]?.phase === "live").map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3830
+ const liveRows = stale ? [] : groups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states[m.matchId], stale, nowMs)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3825
3831
  const nameCounts = groups.reduce((acc, g) => {
3826
3832
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
3827
3833
  return acc;