@sensiblestats/widget-react 0.61.0 → 0.61.2

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.61.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Games: a provider placeholder photo (Sportmonks `placeholder.png`) now shows the player's initials or the crest shield instead of a grey silhouette.
8
+
9
+ ## 0.61.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Beat the Grid: stat column headers show their own icon again (calendar, gloves, ball…) instead of a flag when the label is translated.
14
+
3
15
  ## 0.61.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -4988,13 +4988,16 @@ function initialsOf(name) {
4988
4988
  if (parts.length === 1 || !last) return first.slice(0, 2).toUpperCase();
4989
4989
  return ((first[0] ?? "") + (last[0] ?? "")).toUpperCase();
4990
4990
  }
4991
+ function isPlaceholderImage(url) {
4992
+ return !!url && /\/placeholder\.(png|jpe?g|svg|webp)(\?|$)/i.test(url);
4993
+ }
4991
4994
  function PlayerAvatar({
4992
4995
  name,
4993
4996
  imagePath,
4994
4997
  className
4995
4998
  }) {
4996
4999
  const [failed, setFailed] = (0, import_react30.useState)(false);
4997
- const showImage = Boolean(imagePath) && !failed;
5000
+ const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
4998
5001
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
4999
5002
  }
5000
5003
 
@@ -5491,7 +5494,7 @@ var import_react32 = require("react");
5491
5494
  var import_jsx_runtime69 = require("react/jsx-runtime");
5492
5495
  function CrestShield({ src, name, size = 28 }) {
5493
5496
  const [failed, setFailed] = (0, import_react32.useState)(false);
5494
- if (src && !failed) {
5497
+ if (src && !isPlaceholderImage(src) && !failed) {
5495
5498
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
5496
5499
  }
5497
5500
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("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__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M2 3h24v12c0 9-6 14-12 17C8 29 2 24 2 15z", fill: "currentColor" }) });
@@ -5674,7 +5677,7 @@ function CriterionIcon({ kind }) {
5674
5677
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(IconFlag, {});
5675
5678
  }
5676
5679
  }
5677
- function HeaderVisual({ label, key: iKey, meta }) {
5680
+ function HeaderVisual({ label, textKey: iKey, meta }) {
5678
5681
  if (!meta) {
5679
5682
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CriterionIcon, { kind: criterionIconKind(label, iKey) });
5680
5683
  }
@@ -5851,7 +5854,7 @@ function BeatTheGridGame({
5851
5854
  cols.map((col, colIdx) => {
5852
5855
  const colMeta = config.colsMeta?.[colIdx];
5853
5856
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ss-g-btg-colhdr", "data-meta": colMeta ? "true" : void 0, children: [
5854
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HeaderVisual, { label: col, meta: colMeta }, config.colsI18n?.[colIdx]?.key),
5857
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HeaderVisual, { label: col, textKey: config.colsI18n?.[colIdx]?.key, meta: colMeta }),
5855
5858
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { children: col })
5856
5859
  ] }, col);
5857
5860
  }),
@@ -5859,7 +5862,7 @@ function BeatTheGridGame({
5859
5862
  const rowMeta = config.rowsMeta?.[rowIdx];
5860
5863
  const abbr = rowAbbrev(rowLabel, s.rowAbbrev, config.rowsI18n?.[rowIdx]?.key);
5861
5864
  const rowHeaderContent = rowMeta ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
5862
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HeaderVisual, { label: rowLabel, meta: rowMeta }, config.rowsI18n?.[rowIdx]?.key),
5865
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HeaderVisual, { label: rowLabel, textKey: config.rowsI18n?.[rowIdx]?.key, meta: rowMeta }),
5863
5866
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { children: rowLabel })
5864
5867
  ] }) : abbr === rowLabel ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { children: rowLabel }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
5865
5868
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { "aria-hidden": "true", children: abbr }),