@sensiblestats/widget-react 0.48.8 → 0.48.9

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,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.48.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Hide the Today tab once every match of the day has finished. Tab visibility now reads the same filtered fixture list the panel renders, so the tab can no longer open onto a blank panel.
8
+
3
9
  ## 0.48.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1652,6 +1652,17 @@ function useMatchDiscovery(opts) {
1652
1652
  return { groups, states, liveCount, stale, expanded, toggleGroup, _tick: tick };
1653
1653
  }
1654
1654
 
1655
+ // src/liveClock.ts
1656
+ function isTreatedLive(state, pollStale) {
1657
+ return state?.phase === "live" && !pollStale;
1658
+ }
1659
+ function isFinished(state) {
1660
+ return state?.phase === "fullTime";
1661
+ }
1662
+ function visibleGroupsOf(groups, states) {
1663
+ return groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
1664
+ }
1665
+
1655
1666
  // src/eventLogContext.ts
1656
1667
  var import_react5 = require("react");
1657
1668
  var EventLogContext = (0, import_react5.createContext)(null);
@@ -3760,14 +3771,6 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3760
3771
  ] });
3761
3772
  }
3762
3773
 
3763
- // src/liveClock.ts
3764
- function isTreatedLive(state, pollStale) {
3765
- return state?.phase === "live" && !pollStale;
3766
- }
3767
- function isFinished(state) {
3768
- return state?.phase === "fullTime";
3769
- }
3770
-
3771
3774
  // src/components/CompetitionGroup.tsx
3772
3775
  var import_jsx_runtime50 = require("react/jsx-runtime");
3773
3776
  function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, disambiguate = false }) {
@@ -3798,7 +3801,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3798
3801
  var import_jsx_runtime51 = require("react/jsx-runtime");
3799
3802
  function TodayPanel({ discovery, ui, monitor }) {
3800
3803
  const { groups, states, stale, expanded, toggleGroup } = discovery;
3801
- const visibleGroups = groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
3804
+ const visibleGroups = visibleGroupsOf(groups, states);
3802
3805
  const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states[m.matchId], stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3803
3806
  const nameCounts = visibleGroups.reduce((acc, g) => {
3804
3807
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
@@ -3894,7 +3897,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery })
3894
3897
  matchCount: monitor.pins.filter((p) => p.kind === "match").length,
3895
3898
  oddsCount: monitor.pins.filter((p) => p.kind !== "match").length,
3896
3899
  todayCount: discovery?.liveCount ?? 0,
3897
- hasToday: (discovery?.groups.length ?? 0) > 0
3900
+ hasToday: discovery ? visibleGroupsOf(discovery.groups, discovery.states).length > 0 : false
3898
3901
  }
3899
3902
  ),
3900
3903
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
@@ -4851,7 +4854,7 @@ function StatsWidget(props) {
4851
4854
  isOpen: controller.state.isOpen,
4852
4855
  pinnedMatchIds
4853
4856
  });
4854
- const todayHasContent = discovery.groups.length > 0;
4857
+ const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
4855
4858
  (0, import_react26.useEffect)(() => {
4856
4859
  setHasToday(todayHasContent);
4857
4860
  }, [todayHasContent]);