@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/dist/index.js CHANGED
@@ -1615,6 +1615,17 @@ function useMatchDiscovery(opts) {
1615
1615
  return { groups, states, liveCount, stale, expanded, toggleGroup, _tick: tick };
1616
1616
  }
1617
1617
 
1618
+ // src/liveClock.ts
1619
+ function isTreatedLive(state, pollStale) {
1620
+ return state?.phase === "live" && !pollStale;
1621
+ }
1622
+ function isFinished(state) {
1623
+ return state?.phase === "fullTime";
1624
+ }
1625
+ function visibleGroupsOf(groups, states) {
1626
+ return groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
1627
+ }
1628
+
1618
1629
  // src/eventLogContext.ts
1619
1630
  import { createContext, useContext } from "react";
1620
1631
  var EventLogContext = createContext(null);
@@ -3723,14 +3734,6 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3723
3734
  ] });
3724
3735
  }
3725
3736
 
3726
- // src/liveClock.ts
3727
- function isTreatedLive(state, pollStale) {
3728
- return state?.phase === "live" && !pollStale;
3729
- }
3730
- function isFinished(state) {
3731
- return state?.phase === "fullTime";
3732
- }
3733
-
3734
3737
  // src/components/CompetitionGroup.tsx
3735
3738
  import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
3736
3739
  function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, disambiguate = false }) {
@@ -3761,7 +3764,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3761
3764
  import { Fragment as Fragment7, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
3762
3765
  function TodayPanel({ discovery, ui, monitor }) {
3763
3766
  const { groups, states, stale, expanded, toggleGroup } = discovery;
3764
- const visibleGroups = groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
3767
+ const visibleGroups = visibleGroupsOf(groups, states);
3765
3768
  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);
3766
3769
  const nameCounts = visibleGroups.reduce((acc, g) => {
3767
3770
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
@@ -3857,7 +3860,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery })
3857
3860
  matchCount: monitor.pins.filter((p) => p.kind === "match").length,
3858
3861
  oddsCount: monitor.pins.filter((p) => p.kind !== "match").length,
3859
3862
  todayCount: discovery?.liveCount ?? 0,
3860
- hasToday: (discovery?.groups.length ?? 0) > 0
3863
+ hasToday: discovery ? visibleGroupsOf(discovery.groups, discovery.states).length > 0 : false
3861
3864
  }
3862
3865
  ),
3863
3866
  /* @__PURE__ */ jsx52(
@@ -4814,7 +4817,7 @@ function StatsWidget(props) {
4814
4817
  isOpen: controller.state.isOpen,
4815
4818
  pinnedMatchIds
4816
4819
  });
4817
- const todayHasContent = discovery.groups.length > 0;
4820
+ const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
4818
4821
  useEffect12(() => {
4819
4822
  setHasToday(todayHasContent);
4820
4823
  }, [todayHasContent]);