From 1e340663341120e4cf697ffd56a67b501f93ca74 Mon Sep 17 00:00:00 2001 From: Federico <38290480+FedeIlLeone@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:00:06 +0200 Subject: [PATCH 1/2] fix: correct badge colors --- src/renderer/coremods/badges/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/coremods/badges/index.tsx b/src/renderer/coremods/badges/index.tsx index 36599a00d..7fd1b9e26 100644 --- a/src/renderer/coremods/badges/index.tsx +++ b/src/renderer/coremods/badges/index.tsx @@ -154,12 +154,15 @@ export async function start(): Promise { badgeElements.forEach((badgeElement) => { if (badgeCache[badgeElement.id]) { const { component, ...props } = badgeElement; + const badgeColor = badgeCache.custom.color; newBadges.push({ ...props, icon: "replugged", component: React.createElement(component, { - color: badgeCache.custom.color ?? DISCORD_BLURPLE, + color: + (badgeColor && (badgeColor.startsWith("#") ? badgeColor : `#${badgeColor}`)) ?? + DISCORD_BLURPLE, }), }); } From ea24f0002502f838c123b794ac393e485a8a4b40 Mon Sep 17 00:00:00 2001 From: Federico <38290480+FedeIlLeone@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:11:27 +0200 Subject: [PATCH 2/2] chore: cleanup --- src/renderer/coremods/badges/badge.css | 6 ------ src/renderer/coremods/badges/index.tsx | 3 +-- .../coremods/badges/plaintextPatches.ts | 18 +----------------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/renderer/coremods/badges/badge.css b/src/renderer/coremods/badges/badge.css index cd7f55114..826d0c2c0 100644 --- a/src/renderer/coremods/badges/badge.css +++ b/src/renderer/coremods/badges/badge.css @@ -1,9 +1,3 @@ -[class*="containerWithContent"] { - min-height: -webkit-fit-content; - min-height: -moz-fit-content; - min-height: fit-content; -} - .replugged-badge { padding: 3px; box-sizing: border-box; diff --git a/src/renderer/coremods/badges/index.tsx b/src/renderer/coremods/badges/index.tsx index 7fd1b9e26..5a7d88677 100644 --- a/src/renderer/coremods/badges/index.tsx +++ b/src/renderer/coremods/badges/index.tsx @@ -24,7 +24,6 @@ interface APIRepluggedCustomBadge { } interface APIRepluggedBadges { - [key: string]: boolean | APIRepluggedCustomBadge; developer: boolean; staff: boolean; support: boolean; @@ -152,7 +151,7 @@ export async function start(): Promise { } badgeElements.forEach((badgeElement) => { - if (badgeCache[badgeElement.id]) { + if (badgeElement.id in badgeCache) { const { component, ...props } = badgeElement; const badgeColor = badgeCache.custom.color; diff --git a/src/renderer/coremods/badges/plaintextPatches.ts b/src/renderer/coremods/badges/plaintextPatches.ts index e99849175..51c2d05d2 100644 --- a/src/renderer/coremods/badges/plaintextPatches.ts +++ b/src/renderer/coremods/badges/plaintextPatches.ts @@ -2,23 +2,7 @@ import type { PlaintextPatch } from "src/types"; export default [ { - // Edit the UserProfileBadgeList component - find: ".profileBadge2", - replacements: [ - { - // Add the "replugged-badge" class if it's our custom badge - match: /src:(\w+)\.src,className:\w+\(\)\({/, - replace: `$&["replugged-badge"]:$1.component,`, - }, - { - // Change to a div and add a children for our custom badge - match: /"img",({.+?src:(\w+)\.src,)/, - replace: `$2.component?"div":"img",$1children:$2.component,`, - }, - ], - }, - { - // Edit the ProfileBadges component (new profile design) + // Edit the ProfileBadges component find: /\.container,\w+\),"aria-label":\w+.\w+\.Messages\.PROFILE_USER_BADGES/, replacements: [ // Add the "replugged-badge" class if it's our custom badge