@sensiblestats/widget-react 0.48.8 → 0.48.10

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,17 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.48.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Drop the home/away percentage split from the live match card's momentum block — it was a share of the whole match's accumulated pressure, which reads as a verdict on the match beside a wave showing minute-by-minute swing. Follow-up question chips now left-align their text, so a question long enough to wrap no longer sets its second line ragged on both sides.
8
+
9
+ ## 0.48.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+
3
15
  ## 0.48.8
4
16
 
5
17
  ### 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);
@@ -3648,11 +3659,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip }) {
3648
3659
  }) }),
3649
3660
  match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc)) }),
3650
3661
  match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ss-w-mon-mom", children: [
3651
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ss-w-mon-stat-row", children: [
3652
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--home", children: typeof match.momentumHomePct === "number" ? `${match.momentumHomePct}%` : "" }),
3653
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
3654
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--away", children: typeof match.momentumHomePct === "number" ? `${100 - match.momentumHomePct}%` : "" })
3655
- ] }),
3662
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
3656
3663
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MomentumWave, { points: match.momentum, clubIsHome: true })
3657
3664
  ] }),
3658
3665
  match.phase === "fullTime" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "ss-w-mon-grace", children: ui.graceNote })
@@ -3760,14 +3767,6 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3760
3767
  ] });
3761
3768
  }
3762
3769
 
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
3770
  // src/components/CompetitionGroup.tsx
3772
3771
  var import_jsx_runtime50 = require("react/jsx-runtime");
3773
3772
  function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, disambiguate = false }) {
@@ -3798,7 +3797,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3798
3797
  var import_jsx_runtime51 = require("react/jsx-runtime");
3799
3798
  function TodayPanel({ discovery, ui, monitor }) {
3800
3799
  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);
3800
+ const visibleGroups = visibleGroupsOf(groups, states);
3802
3801
  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
3802
  const nameCounts = visibleGroups.reduce((acc, g) => {
3804
3803
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
@@ -3894,7 +3893,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery })
3894
3893
  matchCount: monitor.pins.filter((p) => p.kind === "match").length,
3895
3894
  oddsCount: monitor.pins.filter((p) => p.kind !== "match").length,
3896
3895
  todayCount: discovery?.liveCount ?? 0,
3897
- hasToday: (discovery?.groups.length ?? 0) > 0
3896
+ hasToday: discovery ? visibleGroupsOf(discovery.groups, discovery.states).length > 0 : false
3898
3897
  }
3899
3898
  ),
3900
3899
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
@@ -4230,7 +4229,9 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
4230
4229
 
4231
4230
  /* action buttons */
4232
4231
  .ss-w-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
4233
- .ss-w-abtn { font-size: 12px; font-weight: 560; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid var(--ss-w-accent); border-radius: 16px; padding: 6px 12px; cursor: pointer; }
4232
+ /* text-align is explicit because a <button> defaults to center, and a follow-up question long
4233
+ enough to wrap then sets its second line ragged on both sides. */
4234
+ .ss-w-abtn { font-size: 12px; font-weight: 560; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid var(--ss-w-accent); border-radius: 16px; padding: 6px 12px; cursor: pointer; text-align: left; }
4234
4235
  .ss-w-abtn:disabled { opacity: .5; cursor: default; }
4235
4236
  .ss-w-abtn-shimmer { width: 140px; height: 30px; border-radius: 16px; background: linear-gradient(90deg, var(--ss-w-bubble), var(--ss-w-line), var(--ss-w-bubble)); background-size: 200% 100%; animation: ss-w-shimmer 1.2s infinite; }
4236
4237
  @keyframes ss-w-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@@ -4642,7 +4643,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
4642
4643
  background: var(--ss-w-panel); border: 1.5px solid var(--ss-w-ink);
4643
4644
  pointer-events: none;
4644
4645
  }
4645
- .ss-w-mon-mom { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); }
4646
+ .ss-w-mon-mom { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); text-align: center; }
4646
4647
  .ss-w-mon-mom .ss-w-fandash-live-mom { margin-top: 6px; padding-top: 0; border-top: none; }
4647
4648
 
4648
4649
  .ss-w-fandash-live-legend { display: flex; gap: 14px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--ss-w-line); font-size: 11px; color: var(--ss-w-faint); }
@@ -4851,7 +4852,7 @@ function StatsWidget(props) {
4851
4852
  isOpen: controller.state.isOpen,
4852
4853
  pinnedMatchIds
4853
4854
  });
4854
- const todayHasContent = discovery.groups.length > 0;
4855
+ const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
4855
4856
  (0, import_react26.useEffect)(() => {
4856
4857
  setHasToday(todayHasContent);
4857
4858
  }, [todayHasContent]);