diff --git a/src/equicordplugins/globalBadges/index.tsx b/src/equicordplugins/globalBadges/index.tsx
index 2775ca46f..8e6fc3db7 100644
--- a/src/equicordplugins/globalBadges/index.tsx
+++ b/src/equicordplugins/globalBadges/index.tsx
@@ -17,9 +17,13 @@
*/
import { addBadge, BadgePosition, ProfileBadge, removeBadge } from "@api/Badges";
+import { classNameFactory } from "@api/Styles";
+import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants";
+import { ModalContent, ModalRoot, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { React, Tooltip } from "@webpack/common";
+import { Forms, React, Tooltip, UserStore } from "@webpack/common";
+import { User } from "discord-types/general";
type CustomBadge = string | {
name: string;
@@ -32,6 +36,8 @@ interface BadgeCache {
expires: number;
}
+let badgeImages;
+
// const API_URL = "https://clientmodbadges-api.herokuapp.com/";
const API_URL = "https://globalbadges.suncord.rest/";
@@ -72,6 +78,7 @@ const GlobalBadges = ({ userId }: { userId: string; }) => {
if (!badges) return null;
const globalBadges: JSX.Element[] = [];
+ const badgeModal: JSX.Element[] = [];
Object.keys(badges).forEach(mod => {
if (mod.toLowerCase() === "vencord") return;
@@ -90,11 +97,17 @@ const GlobalBadges = ({ userId }: { userId: string; }) => {
const prefix = showPrefix() ? mod : "";
if (!badge.custom) badge.name = `${prefix} ${cleanName.charAt(0).toUpperCase() + cleanName.slice(1)}`;
globalBadges.push();
+ badgeModal.push();
});
});
+ badgeImages = badgeModal;
return (
-
+
openBadgeModal(UserStore.getUser(userId))}
+ >
{globalBadges}
);
@@ -133,3 +146,69 @@ export default definePlugin({
}
}
});
+
+/*
+Badge duping fix for modal lines below
+L39 the value for everything below
+L81 for not reusing globalbadges const
+L100 for the size of the badges
+L103 actual dupe fix
+L109 is when clicking the badge open the modal
+Everything below is related to the badge modal
+*/
+const cl = classNameFactory("vc-badges-modal-");
+
+const BadgeModalComponent = ({ name, img }: { name: string, img: string; }) => {
+ return (
+
+ {(tooltipProps: any) => (
+
+ )}
+
+ );
+};
+
+function BadgeModal({ user }: { user: User; }) {
+ return (
+ <>
+
+

+
{user.username}
+
+ {badgeImages.length ? (
+
+ This person has {badgeImages.length} global badges.
+
+ ) : (
+
+ This person has no global badges.
+
+ )}
+ {!!badgeImages.length && (
+
+ {badgeImages}
+
+ )}
+ >
+ );
+}
+
+function openBadgeModal(user: User) {
+ openModal(modalprops =>
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx
index 6b26ec069..5989b58aa 100644
--- a/src/plugins/_api/badges/index.tsx
+++ b/src/plugins/_api/badges/index.tsx
@@ -48,14 +48,8 @@ const EquicordContributorBadge: ProfileBadge = {
description: "Equicord Contributor",
image: EQUICORD_CONTRIBUTOR_BADGE,
position: BadgePosition.START,
- props: {
- style: {
- borderRadius: "50%",
- transform: "scale(0.9)" // The image is a bit too big compared to default badges
- }
- },
shouldShow: ({ userId }) => isEquicordPluginDev(userId),
- link: "https://github.com/Equicord/Equicord"
+ onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
};
let DonorBadges = {} as Record
>>;