@sensiblestats/widget-react 0.61.1 → 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 +6 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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" }) });
|