@sensiblestats/widget-react 0.37.2 → 0.37.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.37.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Odds tab: show a single market-odds card per pin instead of a card-inside-a-card. The fixture/date is no longer duplicated — each pinned market renders one betting card (competition, fixture, market, odds) with the unpin in its own header, plus a slim live strip (score, minute, suspended/settled) shown only for in-play markets and hidden for pre-match. The unpin threads the exact stored pin key so it always removes the right pin.
8
+
3
9
  ## 0.37.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1801,7 +1801,7 @@ function OddsRow({ vm, row, ui, slip, inSlipIds }) {
1801
1801
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlipButton, { selection, shownOdds: row.odds, marketName: vm.market, slip, ui })
1802
1802
  ] });
1803
1803
  }
1804
- function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader }) {
1804
+ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
1805
1805
  const [open, setOpen] = (0, import_react12.useState)(false);
1806
1806
  const kickoff = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
1807
1807
  const hasNamedTeams = !!vm.homeTeamName && !!vm.awayTeamName;
@@ -1829,7 +1829,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader }) {
1829
1829
  {
1830
1830
  ui,
1831
1831
  monitor,
1832
- pin: { kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName, line: vm.mainLine }
1832
+ pin: pinRef ?? { kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName, line: vm.mainLine }
1833
1833
  }
1834
1834
  ) : null
1835
1835
  ] })
@@ -1857,9 +1857,9 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader }) {
1857
1857
  vm.disclaimer ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "ss-w-bi-disc", children: vm.disclaimer }) : null
1858
1858
  ] });
1859
1859
  }
1860
- function MarketOddsCardList({ cards, ui, slip, monitor, inSlipIds, hideHeader }) {
1860
+ function MarketOddsCardList({ cards, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
1861
1861
  if (!cards || cards.length === 0) return null;
1862
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mocards", children: cards.map((vm) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MarketOddsCard, { vm, ui, slip, monitor, inSlipIds, hideHeader }, vm.id)) });
1862
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mocards", children: cards.map((vm) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MarketOddsCard, { vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }, vm.id)) });
1863
1863
  }
1864
1864
 
1865
1865
  // src/components/OddsMovementCard.tsx
@@ -3144,36 +3144,24 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip }) {
3144
3144
 
3145
3145
  // src/components/MonitorTabs.tsx
3146
3146
  var import_jsx_runtime48 = require("react/jsx-runtime");
3147
- function ContextLine({ m, monitor, ui }) {
3148
- const kick = m.kickoffUtc ? ui.bettingKickoff(m.kickoffUtc) : void 0;
3149
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mk-ctx", children: [
3150
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "ss-w-mk-ctx-side", children: [
3151
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Crest2, { kind: "team", url: m.homeCrestUrl ?? void 0, name: m.homeTeamName ?? void 0 }),
3152
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-name", children: m.homeTeamName })
3153
- ] }),
3154
- m.phase === "preMatch" ? kick && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "ss-w-mon-pill", children: [
3155
- kick.dayLabel,
3147
+ function OddsLiveStrip({ m, ui }) {
3148
+ const showScore = m.phase !== "preMatch" && typeof m.homeScore === "number";
3149
+ const stale = m.status === "stale";
3150
+ if (!showScore && !m.minuteLabel && !(m.isSuspended && !m.isSettled) && !m.isSettled && !stale) return null;
3151
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mk-live", children: [
3152
+ showScore && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("b", { className: "ss-w-mk-live-score", children: [
3153
+ m.homeTeamName,
3156
3154
  " ",
3157
- kick.time
3158
- ] }) : typeof m.homeScore === "number" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("b", { children: [
3159
3155
  m.homeScore,
3160
3156
  "\u2013",
3161
- m.awayScore
3162
- ] }),
3163
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "ss-w-mk-ctx-side", children: [
3164
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-name", children: m.awayTeamName }),
3165
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Crest2, { kind: "team", url: m.awayCrestUrl ?? void 0, name: m.awayTeamName ?? void 0 })
3157
+ m.awayScore,
3158
+ " ",
3159
+ m.awayTeamName
3166
3160
  ] }),
3167
3161
  m.minuteLabel && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-min", children: m.minuteLabel }),
3168
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "ss-w-mk-ctx-right", children: [
3169
- m.isSuspended && !m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }),
3170
- m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
3171
- m.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(new Date(m.asOfUtc).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })) }),
3172
- (() => {
3173
- const pin = monitor.pins.find((p) => p.key === m.key);
3174
- return pin ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PinToggle, { ui, monitor, pin }) : null;
3175
- })()
3176
- ] })
3162
+ m.isSuspended && !m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }),
3163
+ m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
3164
+ stale && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(new Date(m.asOfUtc).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })) })
3177
3165
  ] });
3178
3166
  }
3179
3167
  function MatchesPanel({ monitor, ui, slip }) {
@@ -3206,20 +3194,25 @@ function withSinceViewMovement(vm, prev) {
3206
3194
  function OddsPanel({ monitor, ui, slip }) {
3207
3195
  const markets = (monitor.snapshot?.markets ?? []).filter((m) => monitor.pins.some((p) => p.key === m.key));
3208
3196
  if (markets.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ss-w-mon-empty", children: ui.emptyOddsTab });
3209
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ss-w-mon-list", children: markets.map((m) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mon-oddspin", "data-settled": m.isSettled || void 0, children: [
3210
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ContextLine, { m, monitor, ui }),
3211
- m.card && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3212
- MarketOddsCardList,
3213
- {
3214
- cards: [withSinceViewMovement(toMarketOddsVM(m.card), monitor.lastViewedPrices[m.key])],
3215
- ui,
3216
- slip,
3217
- inSlipIds: monitor.inSlip
3218
- }
3219
- ),
3220
- m.history && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OddsMovementCardList, { cards: [toOddsMovementVM(m.history)], ui }),
3221
- !m.card && !m.history && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ss-w-mon-empty-card", children: ui.oddsUnavailable })
3222
- ] }, m.key)) });
3197
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ss-w-mon-list", children: markets.map((m) => {
3198
+ const pin = monitor.pins.find((p) => p.key === m.key);
3199
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mon-oddspin", "data-settled": m.isSettled || void 0, children: [
3200
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OddsLiveStrip, { m, ui }),
3201
+ m.card && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
3202
+ MarketOddsCardList,
3203
+ {
3204
+ cards: [withSinceViewMovement(toMarketOddsVM(m.card), monitor.lastViewedPrices[m.key])],
3205
+ ui,
3206
+ slip,
3207
+ monitor,
3208
+ pinRef: pin ?? void 0,
3209
+ inSlipIds: monitor.inSlip
3210
+ }
3211
+ ),
3212
+ m.history && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OddsMovementCardList, { cards: [toOddsMovementVM(m.history)], ui }),
3213
+ !m.card && !m.history && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ss-w-mon-empty-card", children: ui.oddsUnavailable })
3214
+ ] }, m.key);
3215
+ }) });
3223
3216
  }
3224
3217
 
3225
3218
  // src/components/ChatPanel.tsx
@@ -4059,7 +4052,11 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
4059
4052
  a bare context line with nothing under it. */
4060
4053
  .ss-w-mon-empty-card { padding: 8px 0 2px; font-size: 12px; color: var(--ss-w-faint); }
4061
4054
  .ss-w-mon-inslip { display: inline-flex; flex: none; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--ss-w-pos); }
4062
- .ss-w-mon-oddspin { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--ss-w-line); border-radius: 12px; background: var(--ss-w-panel); }
4055
+ /* Odds-tab item is bare: the visible card is the market-odds card itself (no outer wrapper card),
4056
+ with an optional slim live strip above it. */
4057
+ .ss-w-mon-oddspin { display: flex; flex-direction: column; gap: 8px; }
4058
+ .ss-w-mk-live { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 2px; font-size: 11.5px; color: var(--ss-w-faint); }
4059
+ .ss-w-mk-live-score { color: var(--ss-w-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
4063
4060
  .ss-w-mon-oddspin[data-settled] .ss-w-mo-price,
4064
4061
  .ss-w-mon-oddspin[data-settled] .ss-w-mon-price { text-decoration: line-through; color: var(--ss-w-faint); }
4065
4062