diff --git a/manifest.json b/manifest.json index 25e46c1..23fac3f 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "discordID": "498989696412549120", "github": "Puyodead1" }, - "version": "1.3.9", + "version": "1.3.10", "updater": { "type": "store", "id": "me.puyodead1.PlatformIndicators" diff --git a/package.json b/package.json index 33ef064..65a29de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "replugged-platformindicators", - "version": "1.3.9", + "version": "1.3.10", "description": "Adds Platform Indicators for to for users to various places.", "engines": { "node": ">=18.0.0", diff --git a/src/index.tsx b/src/index.tsx index ca772af..4d698b0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -98,19 +98,36 @@ function patchProfile(PlatformIndicatorProps: { if (!cfg.get("renderInProfile")) return res; const user = args.user as User; - const theChildren = res?.props?.children; - if (!theChildren || !user || !(theChildren instanceof Array)) return res; + const theChildren = res?.props?.children?.props?.children; + + if (!theChildren) { + logger.error("[patchProfile] No children found", res); + return res; + } + + if (!user) { + logger.error("[patchProfile] No user found", args); + return res; + } + + if (!(theChildren instanceof Array)) { + logger.error("[patchProfile] Children is not an array", res); + return res; + } + const icon = ; if (icon === null) return res; // to prevent adding an empty div const a = {icon}; - res.props.children = [a, ...theChildren]; + res.props.children.props.children = [a, ...theChildren]; if (theChildren.length > 0) { - if (!res.props.className.includes(modules.userBadgeClasses?.containerWithContent)) - res.props.className += ` ${modules.userBadgeClasses?.containerWithContent}`; + if ( + !res.props.children.props.className.includes(modules.userBadgeClasses?.containerWithContent) + ) + res.props.children.props.className += ` ${modules.userBadgeClasses?.containerWithContent}`; - if (!res.props.className.includes("platform-indicator-badge-container")) - res.props.className += " platform-indicator-badge-container"; + if (!res.props.children.props.className.includes("platform-indicator-badge-container")) + res.props.children.props.className += " platform-indicator-badge-container"; } return res;