@sensiblestats/widget-react 0.48.1 → 0.48.3

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
@@ -92,7 +92,6 @@ var STRINGS = {
92
92
  tabToday: "Today",
93
93
  sectionLive: "Live",
94
94
  halfTime: "HT",
95
- fullTime: "FT",
96
95
  staleStates: "Live scores can't be updated \u2014 showing the last known state."
97
96
  },
98
97
  tr: {
@@ -171,7 +170,6 @@ var STRINGS = {
171
170
  tabToday: "Bug\xFCn",
172
171
  sectionLive: "Canl\u0131",
173
172
  halfTime: "\u0130Y",
174
- fullTime: "MS",
175
173
  staleStates: "Canl\u0131 skorlar g\xFCncellenemiyor \u2014 son bilinen durum g\xF6steriliyor."
176
174
  }
177
175
  };
@@ -251,7 +249,6 @@ function normalizeUi(cfg) {
251
249
  tabToday: strings.tabToday,
252
250
  sectionLive: strings.sectionLive,
253
251
  halfTime: strings.halfTime,
254
- fullTime: strings.fullTime,
255
252
  staleStates: strings.staleStates,
256
253
  pinLabel: strings.pinLabel,
257
254
  unpinLabel: strings.unpinLabel,
@@ -1498,14 +1495,15 @@ function writeSchedule(operatorId, localDate, payload, nowMs) {
1498
1495
  }
1499
1496
 
1500
1497
  // src/dueSet.ts
1501
- var WINDOW_MS = 3.5 * 36e5;
1498
+ var TERMINAL_PHASES = /* @__PURE__ */ new Set(["fullTime", "postponed"]);
1502
1499
  function dueMatchIds(groups, states, nowMs) {
1503
1500
  const due = /* @__PURE__ */ new Set();
1504
1501
  for (const group of groups) {
1505
1502
  for (const match of group.matches) {
1506
- const sinceKickoff = nowMs - match.kickoffUnix * 1e3;
1507
- if (sinceKickoff >= 0 && sinceKickoff <= WINDOW_MS) due.add(match.matchId);
1508
- if (states[match.matchId]?.phase === "live") due.add(match.matchId);
1503
+ if (nowMs - match.kickoffUnix * 1e3 < 0) continue;
1504
+ const phase = states[match.matchId]?.phase;
1505
+ if (phase !== void 0 && TERMINAL_PHASES.has(phase)) continue;
1506
+ due.add(match.matchId);
1509
1507
  }
1510
1508
  }
1511
1509
  return [...due];
@@ -3708,10 +3706,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3708
3706
  const isLive = state?.phase === "live" && !stale;
3709
3707
  const hasScore = (state?.phase === "live" || state?.phase === "fullTime") && typeof state.homeScore === "number" && typeof state.awayScore === "number";
3710
3708
  const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
3711
- const isFinished = state?.phase === "fullTime";
3712
- const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : isFinished ? ui.fullTime : kickoffLabel(match.kickoffUnix);
3713
- const pin = { kind: "match", matchId: match.matchId };
3714
- const showPin = !isFinished || monitor.isPinned(pinKey(pin));
3709
+ const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
3715
3710
  return /* @__PURE__ */ jsxs44("div", { className: isLive || state?.isHalfTime ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
3716
3711
  /* @__PURE__ */ jsx49("span", { className: isLive || state?.isHalfTime ? "ss-w-drow-when ss-w-drow-when--live" : "ss-w-drow-when", children: when }),
3717
3712
  /* @__PURE__ */ jsxs44("span", { className: "ss-w-drow-fx", children: [
@@ -3719,7 +3714,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3719
3714
  /* @__PURE__ */ jsx49("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: hasScore ? `${state.homeScore}\u2013${state.awayScore}` : "\u2013" }),
3720
3715
  /* @__PURE__ */ jsx49(Side, { name: match.awayTeamName, crest: match.awayTeamImagePath })
3721
3716
  ] }),
3722
- showPin ? /* @__PURE__ */ jsx49(PinToggle, { ui, monitor, pin }) : null
3717
+ /* @__PURE__ */ jsx49(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId } })
3723
3718
  ] });
3724
3719
  }
3725
3720
 
@@ -3727,6 +3722,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3727
3722
  function isTreatedLive(state, pollStale) {
3728
3723
  return state?.phase === "live" && !pollStale;
3729
3724
  }
3725
+ function isFinished(state) {
3726
+ return state?.phase === "fullTime";
3727
+ }
3730
3728
 
3731
3729
  // src/components/CompetitionGroup.tsx
3732
3730
  import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -3758,8 +3756,9 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3758
3756
  import { Fragment as Fragment7, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
3759
3757
  function TodayPanel({ discovery, ui, monitor }) {
3760
3758
  const { groups, states, stale, expanded, toggleGroup } = discovery;
3761
- const liveRows = stale ? [] : groups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states[m.matchId], stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3762
- const nameCounts = groups.reduce((acc, g) => {
3759
+ const visibleGroups = groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
3760
+ 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);
3761
+ const nameCounts = visibleGroups.reduce((acc, g) => {
3763
3762
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
3764
3763
  return acc;
3765
3764
  }, {});
@@ -3782,7 +3781,7 @@ function TodayPanel({ discovery, ui, monitor }) {
3782
3781
  match.matchId
3783
3782
  )) })
3784
3783
  ] }),
3785
- groups.map((group) => /* @__PURE__ */ jsx51(
3784
+ visibleGroups.map((group) => /* @__PURE__ */ jsx51(
3786
3785
  CompetitionGroup,
3787
3786
  {
3788
3787
  group,