@sensiblestats/widget-react 0.60.1 → 0.60.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,17 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.60.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Higher or Lower fits the widget panel: the two player cards share the available height (photos scale with them), Higher/Lower sit side by side, and a compact type scale applies on short panels, so both players and the buttons stay on screen without scrolling.
8
+
9
+ ## 0.60.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Games hub refreshes today's points, tile status, streak and rank as soon as a fan returns from a game, instead of waiting for the 60-second poll or a tab switch.
14
+
3
15
  ## 0.60.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2211,6 +2211,7 @@ function useLeaderboard(conversation, { activeTab }) {
2211
2211
  void doFetch();
2212
2212
  return () => {
2213
2213
  active = false;
2214
+ inFlightRef.current = false;
2214
2215
  };
2215
2216
  }, [activeTab, refreshCount]);
2216
2217
  const refresh = (0, import_react7.useCallback)(() => {
@@ -6818,6 +6819,7 @@ function safeParseConfig(json) {
6818
6819
  function GameScreenHost({
6819
6820
  selected,
6820
6821
  onBack,
6822
+ onPlayed,
6821
6823
  conversation,
6822
6824
  ui
6823
6825
  }) {
@@ -6861,7 +6863,11 @@ function GameScreenHost({
6861
6863
  const sharedProps = {
6862
6864
  result,
6863
6865
  submitting,
6864
- onSubmit: submit,
6866
+ // Refresh only after the play is saved: a fan can tap Back while a submit is still in flight,
6867
+ // and a refetch fired from Back alone would read the hub's pre-play state.
6868
+ onSubmit: (answerJson) => {
6869
+ void submit(answerJson).then(() => onPlayed?.());
6870
+ },
6865
6871
  ui,
6866
6872
  onBack,
6867
6873
  lockAtUtc
@@ -6978,7 +6984,8 @@ function GamesPanel({
6978
6984
  games,
6979
6985
  ui,
6980
6986
  conversation,
6981
- leaderboard
6987
+ leaderboard,
6988
+ refreshHub
6982
6989
  }) {
6983
6990
  const [selected, setSelected] = (0, import_react41.useState)(null);
6984
6991
  (0, import_react41.useEffect)(() => {
@@ -6990,7 +6997,11 @@ function GamesPanel({
6990
6997
  GameScreenHost,
6991
6998
  {
6992
6999
  selected,
6993
- onBack: () => setSelected(null),
7000
+ onBack: () => {
7001
+ setSelected(null);
7002
+ refreshHub?.();
7003
+ },
7004
+ onPlayed: refreshHub,
6994
7005
  conversation: conversation ?? null,
6995
7006
  ui
6996
7007
  }
@@ -7240,7 +7251,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
7240
7251
  monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TodayPanel, { discovery, ui, monitor }),
7241
7252
  monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(MatchesPanel, { monitor, ui, slip }),
7242
7253
  monitor && monitor.activeTab === "odds" && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(OddsPanel, { monitor, ui, slip }),
7243
- monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(GamesPanel, { loggedIn: !!loggedIn, games: gamesResult.games, ui, conversation, leaderboard: leaderboardResult?.data ?? null }),
7254
+ monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7255
+ GamesPanel,
7256
+ {
7257
+ loggedIn: !!loggedIn,
7258
+ games: gamesResult.games,
7259
+ ui,
7260
+ conversation,
7261
+ leaderboard: leaderboardResult?.data ?? null,
7262
+ refreshHub: () => {
7263
+ gamesResult.refresh();
7264
+ leaderboardResult?.refresh();
7265
+ }
7266
+ }
7267
+ ),
7244
7268
  monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7245
7269
  LeaderboardPanel,
7246
7270
  {
@@ -8336,24 +8360,41 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
8336
8360
  .ss-g-hl-prompt-q { font-size: 13px; color: var(--ss-g-muted); }
8337
8361
  .ss-g-hl-prompt-stat { font: 800 30px var(--ss-g-font-display); text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; }
8338
8362
  .ss-g-hl-prompt-season { font-size: 12px; color: var(--ss-g-muted); }
8339
- .ss-g-hl-pair { display: flex; flex-direction: column; gap: 12px; }
8340
- .ss-g-hl-card { display: flex; min-height: 196px; border-radius: 18px; overflow: hidden; background: var(--ss-g-surface); border: 1px solid var(--ss-g-line); }
8363
+ /* The pair fills whatever height the panel leaves (a laptop demo panel is ~670px, the design 860px):
8364
+ both cards share it and the photos scale with them, so Higher/Lower never fall below the fold. */
8365
+ .ss-g-hl .ss-g-body { overflow-y: auto; container: hl / size; }
8366
+ .ss-g-hl-pair { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
8367
+ .ss-g-hl-card { flex: 1 1 0; min-height: min-content; max-height: 240px; display: flex; border-radius: 18px; overflow: hidden; background: var(--ss-g-surface); border: 1px solid var(--ss-g-line); }
8341
8368
  .ss-g-hl-card--b { border-color: var(--ss-g-line-warm); }
8342
- .ss-g-hl-photo-wrap { width: 40%; max-width: 170px; flex: none; display: flex; align-items: flex-end; justify-content: center; background: var(--ss-g-raised); overflow: hidden; }
8369
+ .ss-g-hl-photo-wrap { width: 38%; max-width: 160px; flex: none; align-self: stretch; display: flex; align-items: flex-end; justify-content: center; background: var(--ss-g-raised); overflow: hidden; }
8343
8370
  .ss-g-hl-photo-wrap .ss-g-sil { border-radius: 0; background: transparent; }
8344
8371
  .ss-g-hl-photo { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ss-g-muted); font: 800 36px var(--ss-g-font-display); }
8345
8372
  .ss-g-hl-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
8346
- .ss-g-hl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 16px; }
8373
+ .ss-g-hl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 12px 14px; }
8347
8374
  .ss-g-hl-first { font-size: 13px; color: var(--ss-g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
8348
- .ss-g-hl-surname { font: 800 30px var(--ss-g-font-display); text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
8349
- .ss-g-hl-value { font: 800 76px var(--ss-g-font-display); line-height: 1; color: var(--ss-w-accent); margin-top: 10px; }
8375
+ .ss-g-hl-surname { font: 800 26px var(--ss-g-font-display); text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
8376
+ .ss-g-hl-value { font: 800 56px var(--ss-g-font-display); line-height: .95; color: var(--ss-w-accent); margin-top: 6px; }
8350
8377
  .ss-g-hl-stat { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-g-muted); }
8351
- .ss-g-hl-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
8352
- .ss-g-hl-btns .ss-g-btn { font-weight: 800; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
8353
- .ss-g-hl-vs { position: relative; z-index: 1; align-self: center; width: 48px; height: 48px; margin: -30px 0; border-radius: 50%; display: grid; place-items: center; background: var(--ss-g-ground); border: 2px solid var(--ss-g-line-warm); color: var(--ss-w-accent); font: 800 18px var(--ss-g-font-display); }
8378
+ .ss-g-hl-btns { display: flex; flex-direction: row; gap: 8px; margin-top: 12px; }
8379
+ .ss-g-hl-btns .ss-g-btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 8px; }
8380
+ .ss-g-hl-btns .ss-g-btn { font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
8381
+ .ss-g-hl-vs { position: relative; z-index: 1; flex: none; align-self: center; width: 44px; height: 44px; margin: -28px 0; border-radius: 50%; display: grid; place-items: center; background: var(--ss-g-ground); border: 2px solid var(--ss-g-line-warm); color: var(--ss-w-accent); font: 800 18px var(--ss-g-font-display); }
8354
8382
  /* Clear the VS badge that straddles the seam between the two cards. */
8355
- .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 30px; }
8356
- .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 30px; }
8383
+ .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 24px; }
8384
+ .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 24px; }
8385
+ /* Short panels (a ~580px widget on a small laptop): tighten the type so both cards and the
8386
+ Higher/Lower buttons stay on screen; below this the body scrolls rather than clipping names. */
8387
+ @container hl (max-height: 420px) {
8388
+ .ss-g-hl-prompt-stat { font-size: 24px; }
8389
+ .ss-g-hl-prompt-season { display: none; }
8390
+ .ss-g-hl-info { padding: 8px 12px; }
8391
+ .ss-g-hl-surname { font-size: 22px; }
8392
+ .ss-g-hl-value { font-size: 42px; margin-top: 2px; }
8393
+ .ss-g-hl-btns { margin-top: 8px; }
8394
+ .ss-g-hl-vs { width: 38px; height: 38px; margin: -22px 0; font-size: 15px; }
8395
+ .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 18px; }
8396
+ .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 18px; }
8397
+ }
8357
8398
  .ss-g-hl-feedback { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ss-g-ink-2); }
8358
8399
  .ss-g-hl-feedback[data-correct="true"] svg { color: var(--ss-g-success); }
8359
8400
  .ss-g-hl-feedback[data-correct="false"] svg { color: var(--ss-g-wrong-mark); }