@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 +14 -0
- package/dist/index.cjs +20 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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);
|
|
@@ -2650,17 +2661,19 @@ function InjuriesCard({ card, ui }) {
|
|
|
2650
2661
|
const limit = expanded ? void 0 : SHOWN;
|
|
2651
2662
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
2652
2663
|
const showLess = ui?.showLess ?? "Show less";
|
|
2664
|
+
const homeCol = data.oursIsHome ? { name: data.oursName, crest: data.oursCrestUrl, rows: data.ours } : { name: data.theirsName, crest: data.theirsCrestUrl, rows: data.theirs };
|
|
2665
|
+
const awayCol = data.oursIsHome ? { name: data.theirsName, crest: data.theirsCrestUrl, rows: data.theirs } : { name: data.oursName, crest: data.oursCrestUrl, rows: data.ours };
|
|
2653
2666
|
return /* @__PURE__ */ jsxs17("div", { className: "ss-w-fandash-card ss-w-fandash-injuries", children: [
|
|
2654
2667
|
card.title ? /* @__PURE__ */ jsx21("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
|
|
2655
2668
|
/* @__PURE__ */ jsxs17("div", { className: "ss-w-fandash-injuries-cols", children: [
|
|
2656
2669
|
/* @__PURE__ */ jsxs17("div", { className: "ss-w-fandash-injuries-col", children: [
|
|
2657
|
-
/* @__PURE__ */ jsx21(ColHead, { name:
|
|
2658
|
-
/* @__PURE__ */ jsx21(InjuryList, { rows:
|
|
2670
|
+
/* @__PURE__ */ jsx21(ColHead, { name: homeCol.name, crestUrl: homeCol.crest }),
|
|
2671
|
+
/* @__PURE__ */ jsx21(InjuryList, { rows: homeCol.rows, emptyLabel: data.emptyLabel, limit })
|
|
2659
2672
|
] }),
|
|
2660
2673
|
/* @__PURE__ */ jsx21("div", { className: "ss-w-fandash-injuries-divider" }),
|
|
2661
2674
|
/* @__PURE__ */ jsxs17("div", { className: "ss-w-fandash-injuries-col", children: [
|
|
2662
|
-
/* @__PURE__ */ jsx21(ColHead, { name:
|
|
2663
|
-
/* @__PURE__ */ jsx21(InjuryList, { rows:
|
|
2675
|
+
/* @__PURE__ */ jsx21(ColHead, { name: awayCol.name, crestUrl: awayCol.crest }),
|
|
2676
|
+
/* @__PURE__ */ jsx21(InjuryList, { rows: awayCol.rows, emptyLabel: data.emptyLabel, limit })
|
|
2664
2677
|
] })
|
|
2665
2678
|
] }),
|
|
2666
2679
|
hidden > 0 ? /* @__PURE__ */ jsx21(
|
|
@@ -3721,14 +3734,6 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
3721
3734
|
] });
|
|
3722
3735
|
}
|
|
3723
3736
|
|
|
3724
|
-
// src/liveClock.ts
|
|
3725
|
-
function isTreatedLive(state, pollStale) {
|
|
3726
|
-
return state?.phase === "live" && !pollStale;
|
|
3727
|
-
}
|
|
3728
|
-
function isFinished(state) {
|
|
3729
|
-
return state?.phase === "fullTime";
|
|
3730
|
-
}
|
|
3731
|
-
|
|
3732
3737
|
// src/components/CompetitionGroup.tsx
|
|
3733
3738
|
import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
3734
3739
|
function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, disambiguate = false }) {
|
|
@@ -3759,7 +3764,7 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
|
|
|
3759
3764
|
import { Fragment as Fragment7, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
3760
3765
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
3761
3766
|
const { groups, states, stale, expanded, toggleGroup } = discovery;
|
|
3762
|
-
const visibleGroups = groups
|
|
3767
|
+
const visibleGroups = visibleGroupsOf(groups, states);
|
|
3763
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);
|
|
3764
3769
|
const nameCounts = visibleGroups.reduce((acc, g) => {
|
|
3765
3770
|
acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
|
|
@@ -3855,7 +3860,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery })
|
|
|
3855
3860
|
matchCount: monitor.pins.filter((p) => p.kind === "match").length,
|
|
3856
3861
|
oddsCount: monitor.pins.filter((p) => p.kind !== "match").length,
|
|
3857
3862
|
todayCount: discovery?.liveCount ?? 0,
|
|
3858
|
-
hasToday: (discovery
|
|
3863
|
+
hasToday: discovery ? visibleGroupsOf(discovery.groups, discovery.states).length > 0 : false
|
|
3859
3864
|
}
|
|
3860
3865
|
),
|
|
3861
3866
|
/* @__PURE__ */ jsx52(
|
|
@@ -4812,7 +4817,7 @@ function StatsWidget(props) {
|
|
|
4812
4817
|
isOpen: controller.state.isOpen,
|
|
4813
4818
|
pinnedMatchIds
|
|
4814
4819
|
});
|
|
4815
|
-
const todayHasContent = discovery.groups.length > 0;
|
|
4820
|
+
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
4816
4821
|
useEffect12(() => {
|
|
4817
4822
|
setHasToday(todayHasContent);
|
|
4818
4823
|
}, [todayHasContent]);
|