@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/dist/index.js CHANGED
@@ -2174,6 +2174,7 @@ function useLeaderboard(conversation, { activeTab }) {
2174
2174
  void doFetch();
2175
2175
  return () => {
2176
2176
  active = false;
2177
+ inFlightRef.current = false;
2177
2178
  };
2178
2179
  }, [activeTab, refreshCount]);
2179
2180
  const refresh = useCallback5(() => {
@@ -6781,6 +6782,7 @@ function safeParseConfig(json) {
6781
6782
  function GameScreenHost({
6782
6783
  selected,
6783
6784
  onBack,
6785
+ onPlayed,
6784
6786
  conversation,
6785
6787
  ui
6786
6788
  }) {
@@ -6824,7 +6826,11 @@ function GameScreenHost({
6824
6826
  const sharedProps = {
6825
6827
  result,
6826
6828
  submitting,
6827
- onSubmit: submit,
6829
+ // Refresh only after the play is saved: a fan can tap Back while a submit is still in flight,
6830
+ // and a refetch fired from Back alone would read the hub's pre-play state.
6831
+ onSubmit: (answerJson) => {
6832
+ void submit(answerJson).then(() => onPlayed?.());
6833
+ },
6828
6834
  ui,
6829
6835
  onBack,
6830
6836
  lockAtUtc
@@ -6941,7 +6947,8 @@ function GamesPanel({
6941
6947
  games,
6942
6948
  ui,
6943
6949
  conversation,
6944
- leaderboard
6950
+ leaderboard,
6951
+ refreshHub
6945
6952
  }) {
6946
6953
  const [selected, setSelected] = useState35(null);
6947
6954
  useEffect16(() => {
@@ -6953,7 +6960,11 @@ function GamesPanel({
6953
6960
  GameScreenHost,
6954
6961
  {
6955
6962
  selected,
6956
- onBack: () => setSelected(null),
6963
+ onBack: () => {
6964
+ setSelected(null);
6965
+ refreshHub?.();
6966
+ },
6967
+ onPlayed: refreshHub,
6957
6968
  conversation: conversation ?? null,
6958
6969
  ui
6959
6970
  }
@@ -7203,7 +7214,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
7203
7214
  monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx85(TodayPanel, { discovery, ui, monitor }),
7204
7215
  monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx85(MatchesPanel, { monitor, ui, slip }),
7205
7216
  monitor && monitor.activeTab === "odds" && /* @__PURE__ */ jsx85(OddsPanel, { monitor, ui, slip }),
7206
- monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx85(GamesPanel, { loggedIn: !!loggedIn, games: gamesResult.games, ui, conversation, leaderboard: leaderboardResult?.data ?? null }),
7217
+ monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx85(
7218
+ GamesPanel,
7219
+ {
7220
+ loggedIn: !!loggedIn,
7221
+ games: gamesResult.games,
7222
+ ui,
7223
+ conversation,
7224
+ leaderboard: leaderboardResult?.data ?? null,
7225
+ refreshHub: () => {
7226
+ gamesResult.refresh();
7227
+ leaderboardResult?.refresh();
7228
+ }
7229
+ }
7230
+ ),
7207
7231
  monitor && monitor.activeTab === "leaderboard" && leaderboardResult && /* @__PURE__ */ jsx85(
7208
7232
  LeaderboardPanel,
7209
7233
  {
@@ -8299,24 +8323,41 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
8299
8323
  .ss-g-hl-prompt-q { font-size: 13px; color: var(--ss-g-muted); }
8300
8324
  .ss-g-hl-prompt-stat { font: 800 30px var(--ss-g-font-display); text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; }
8301
8325
  .ss-g-hl-prompt-season { font-size: 12px; color: var(--ss-g-muted); }
8302
- .ss-g-hl-pair { display: flex; flex-direction: column; gap: 12px; }
8303
- .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); }
8326
+ /* The pair fills whatever height the panel leaves (a laptop demo panel is ~670px, the design 860px):
8327
+ both cards share it and the photos scale with them, so Higher/Lower never fall below the fold. */
8328
+ .ss-g-hl .ss-g-body { overflow-y: auto; container: hl / size; }
8329
+ .ss-g-hl-pair { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
8330
+ .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); }
8304
8331
  .ss-g-hl-card--b { border-color: var(--ss-g-line-warm); }
8305
- .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; }
8332
+ .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; }
8306
8333
  .ss-g-hl-photo-wrap .ss-g-sil { border-radius: 0; background: transparent; }
8307
8334
  .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); }
8308
8335
  .ss-g-hl-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
8309
- .ss-g-hl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 16px; }
8336
+ .ss-g-hl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 12px 14px; }
8310
8337
  .ss-g-hl-first { font-size: 13px; color: var(--ss-g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
8311
- .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; }
8312
- .ss-g-hl-value { font: 800 76px var(--ss-g-font-display); line-height: 1; color: var(--ss-w-accent); margin-top: 10px; }
8338
+ .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; }
8339
+ .ss-g-hl-value { font: 800 56px var(--ss-g-font-display); line-height: .95; color: var(--ss-w-accent); margin-top: 6px; }
8313
8340
  .ss-g-hl-stat { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-g-muted); }
8314
- .ss-g-hl-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
8315
- .ss-g-hl-btns .ss-g-btn { font-weight: 800; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
8316
- .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); }
8341
+ .ss-g-hl-btns { display: flex; flex-direction: row; gap: 8px; margin-top: 12px; }
8342
+ .ss-g-hl-btns .ss-g-btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 8px; }
8343
+ .ss-g-hl-btns .ss-g-btn { font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
8344
+ .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); }
8317
8345
  /* Clear the VS badge that straddles the seam between the two cards. */
8318
- .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 30px; }
8319
- .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 30px; }
8346
+ .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 24px; }
8347
+ .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 24px; }
8348
+ /* Short panels (a ~580px widget on a small laptop): tighten the type so both cards and the
8349
+ Higher/Lower buttons stay on screen; below this the body scrolls rather than clipping names. */
8350
+ @container hl (max-height: 420px) {
8351
+ .ss-g-hl-prompt-stat { font-size: 24px; }
8352
+ .ss-g-hl-prompt-season { display: none; }
8353
+ .ss-g-hl-info { padding: 8px 12px; }
8354
+ .ss-g-hl-surname { font-size: 22px; }
8355
+ .ss-g-hl-value { font-size: 42px; margin-top: 2px; }
8356
+ .ss-g-hl-btns { margin-top: 8px; }
8357
+ .ss-g-hl-vs { width: 38px; height: 38px; margin: -22px 0; font-size: 15px; }
8358
+ .ss-g-hl-pair > .ss-g-hl-card:first-child .ss-g-hl-info { padding-bottom: 18px; }
8359
+ .ss-g-hl-vs + .ss-g-hl-card .ss-g-hl-info { padding-top: 18px; }
8360
+ }
8320
8361
  .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); }
8321
8362
  .ss-g-hl-feedback[data-correct="true"] svg { color: var(--ss-g-success); }
8322
8363
  .ss-g-hl-feedback[data-correct="false"] svg { color: var(--ss-g-wrong-mark); }