@sensiblestats/widget-react 0.48.7 → 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,19 @@
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
+
9
+ ## 0.48.8
10
+
11
+ ### Patch Changes
12
+
13
+ - 324f7eb: Injuries card: order columns by home/away (home left, away right).
14
+ - Updated dependencies [324f7eb]
15
+ - @sensiblestats/widget-sdk@0.35.2
16
+
3
17
  ## 0.48.7
4
18
 
5
19
  ### 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);
@@ -2687,17 +2698,19 @@ function InjuriesCard({ card, ui }) {
2687
2698
  const limit = expanded ? void 0 : SHOWN;
2688
2699
  const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
2689
2700
  const showLess = ui?.showLess ?? "Show less";
2701
+ const homeCol = data.oursIsHome ? { name: data.oursName, crest: data.oursCrestUrl, rows: data.ours } : { name: data.theirsName, crest: data.theirsCrestUrl, rows: data.theirs };
2702
+ const awayCol = data.oursIsHome ? { name: data.theirsName, crest: data.theirsCrestUrl, rows: data.theirs } : { name: data.oursName, crest: data.oursCrestUrl, rows: data.ours };
2690
2703
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-injuries", children: [
2691
2704
  card.title ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
2692
2705
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-fandash-injuries-cols", children: [
2693
2706
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-fandash-injuries-col", children: [
2694
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ColHead, { name: data.oursName, crestUrl: data.oursCrestUrl }),
2695
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InjuryList, { rows: data.ours, emptyLabel: data.emptyLabel, limit })
2707
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ColHead, { name: homeCol.name, crestUrl: homeCol.crest }),
2708
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InjuryList, { rows: homeCol.rows, emptyLabel: data.emptyLabel, limit })
2696
2709
  ] }),
2697
2710
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "ss-w-fandash-injuries-divider" }),
2698
2711
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-fandash-injuries-col", children: [
2699
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ColHead, { name: data.theirsName, crestUrl: data.theirsCrestUrl }),
2700
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InjuryList, { rows: data.theirs, emptyLabel: data.emptyLabel, limit })
2712
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ColHead, { name: awayCol.name, crestUrl: awayCol.crest }),
2713
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InjuryList, { rows: awayCol.rows, emptyLabel: data.emptyLabel, limit })
2701
2714
  ] })
2702
2715
  ] }),
2703
2716
  hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -3758,14 +3771,6 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3758
3771
  ] });
3759
3772
  }
3760
3773
 
3761
- // src/liveClock.ts
3762
- function isTreatedLive(state, pollStale) {
3763
- return state?.phase === "live" && !pollStale;
3764
- }
3765
- function isFinished(state) {
3766
- return state?.phase === "fullTime";
3767
- }
3768
-
3769
3774
  // src/components/CompetitionGroup.tsx
3770
3775
  var import_jsx_runtime50 = require("react/jsx-runtime");
3771
3776
  function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, disambiguate = false }) {
@@ -3796,7 +3801,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3796
3801
  var import_jsx_runtime51 = require("react/jsx-runtime");
3797
3802
  function TodayPanel({ discovery, ui, monitor }) {
3798
3803
  const { groups, states, stale, expanded, toggleGroup } = discovery;
3799
- 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);
3800
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);
3801
3806
  const nameCounts = visibleGroups.reduce((acc, g) => {
3802
3807
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
@@ -3892,7 +3897,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery })
3892
3897
  matchCount: monitor.pins.filter((p) => p.kind === "match").length,
3893
3898
  oddsCount: monitor.pins.filter((p) => p.kind !== "match").length,
3894
3899
  todayCount: discovery?.liveCount ?? 0,
3895
- hasToday: (discovery?.groups.length ?? 0) > 0
3900
+ hasToday: discovery ? visibleGroupsOf(discovery.groups, discovery.states).length > 0 : false
3896
3901
  }
3897
3902
  ),
3898
3903
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
@@ -4849,7 +4854,7 @@ function StatsWidget(props) {
4849
4854
  isOpen: controller.state.isOpen,
4850
4855
  pinnedMatchIds
4851
4856
  });
4852
- const todayHasContent = discovery.groups.length > 0;
4857
+ const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
4853
4858
  (0, import_react26.useEffect)(() => {
4854
4859
  setHasToday(todayHasContent);
4855
4860
  }, [todayHasContent]);