@sensiblestats/widget-react 0.61.1 → 0.61.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
@@ -4951,13 +4951,16 @@ function initialsOf(name) {
4951
4951
  if (parts.length === 1 || !last) return first.slice(0, 2).toUpperCase();
4952
4952
  return ((first[0] ?? "") + (last[0] ?? "")).toUpperCase();
4953
4953
  }
4954
+ function isPlaceholderImage(url) {
4955
+ return !!url && /\/placeholder\.(png|jpe?g|svg|webp)(\?|$)/i.test(url);
4956
+ }
4954
4957
  function PlayerAvatar({
4955
4958
  name,
4956
4959
  imagePath,
4957
4960
  className
4958
4961
  }) {
4959
4962
  const [failed, setFailed] = useState24(false);
4960
- const showImage = Boolean(imagePath) && !failed;
4963
+ const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
4961
4964
  return /* @__PURE__ */ jsx58("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ jsx58("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ jsx58("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
4962
4965
  }
4963
4966
 
@@ -5454,7 +5457,7 @@ import { useState as useState26 } from "react";
5454
5457
  import { jsx as jsx69 } from "react/jsx-runtime";
5455
5458
  function CrestShield({ src, name, size = 28 }) {
5456
5459
  const [failed, setFailed] = useState26(false);
5457
- if (src && !failed) {
5460
+ if (src && !isPlaceholderImage(src) && !failed) {
5458
5461
  return /* @__PURE__ */ jsx69("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
5459
5462
  }
5460
5463
  return /* @__PURE__ */ jsx69("svg", { className: "ss-g-crest ss-g-crest--ph", width: size, height: size * 32 / 28, viewBox: "0 0 28 32", role: "img", "aria-label": name, children: /* @__PURE__ */ jsx69("path", { d: "M2 3h24v12c0 9-6 14-12 17C8 29 2 24 2 15z", fill: "currentColor" }) });
@@ -5521,7 +5524,7 @@ function CareerPathGame({
5521
5524
  /* @__PURE__ */ jsx70(GameHeader, { title, eyebrow: s.eyebrow, right, onBack, backLabel: ui.back }),
5522
5525
  /* @__PURE__ */ jsxs58("div", { className: "ss-g-body", children: [
5523
5526
  /* @__PURE__ */ jsxs58("div", { className: "ss-g-cp-card", children: [
5524
- /* @__PURE__ */ jsx70(Silhouette, { size: 64, variant: isOver ? "default" : "mystery" }),
5527
+ isOver && clientState?.revealedPlayerName ? /* @__PURE__ */ jsx70(PlayerAvatar, { className: "ss-g-cp-photo", name: clientState.revealedPlayerName, imagePath: clientState.revealedPlayerImagePath }) : /* @__PURE__ */ jsx70(Silhouette, { size: 64, variant: isOver ? "default" : "mystery" }),
5525
5528
  /* @__PURE__ */ jsxs58("div", { className: "ss-g-cp-card-text", children: [
5526
5529
  /* @__PURE__ */ jsx70("span", { className: "ss-g-cp-card-title", children: isOver && clientState?.revealedPlayerName ? clientState.revealedPlayerName : s.mysteryPlayer }),
5527
5530
  clientState?.hintLine ? /* @__PURE__ */ jsx70("span", { className: "ss-g-cp-hint", children: clientState.hintLine }) : !isOver ? /* @__PURE__ */ jsxs58("span", { className: "ss-g-cp-locks", children: [
@@ -5937,7 +5940,8 @@ function toRows(positions) {
5937
5940
  bucket.push(p);
5938
5941
  byRow.set(rowKey, bucket);
5939
5942
  });
5940
- return [...byRow.keys()].sort((a, b) => b - a).map((k) => byRow.get(k));
5943
+ const col = (p) => Number(p.slot?.split(":")[1]) || 0;
5944
+ return [...byRow.keys()].sort((a, b) => b - a).map((k) => [...byRow.get(k)].sort((a, b) => col(b) - col(a)));
5941
5945
  }
5942
5946
  function formationLabel(rowsAttackFirst) {
5943
5947
  if (rowsAttackFirst.length < 2) return "";
@@ -8493,6 +8497,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
8493
8497
  .ss-g-mt-portrait .ss-g-sil { font-size: 46px; }
8494
8498
  .ss-g-mt-photo { width: 132px; height: 132px; margin-bottom: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--ss-g-accent-tint); color: var(--ss-w-accent); font: 800 40px var(--ss-g-font-display); }
8495
8499
  .ss-g-mt-photo img { width: 100%; height: 100%; object-fit: cover; }
8500
+ .ss-g-cp-photo { width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--ss-g-accent-tint); color: var(--ss-w-accent); font: 800 22px var(--ss-g-font-display); }
8501
+ .ss-g-cp-photo img { width: 100%; height: 100%; object-fit: cover; }
8496
8502
  .ss-g-mt-reveal-name { position: absolute; bottom: 6px; left: 12px; right: 12px; text-align: center; font: 800 20px var(--ss-g-font-display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
8497
8503
  .ss-g-mt-known { display: grid; gap: 6px; padding: 12px; }
8498
8504
  .ss-g-mt-known-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }