mirror of
https://github.com/Equicord/Equicord.git
synced 2025-03-04 00:10:05 -05:00
fixes
This commit is contained in:
parent
74177ea025
commit
130af33415
7 changed files with 72 additions and 17 deletions
|
@ -9,7 +9,7 @@ import "./contributorModal.css";
|
|||
import { useSettings } from "@api/Settings";
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { DevsById } from "@utils/constants";
|
||||
import { DevsById, EquicordDevsById } from "@utils/constants";
|
||||
import { fetchUserProfile, getTheme, Theme } from "@utils/discord";
|
||||
import { ModalContent, ModalRoot, openModal } from "@utils/modal";
|
||||
import { Forms, MaskedLink, showToast, useEffect, useMemo, UserProfileStore, useStateFromStores } from "@webpack/common";
|
||||
|
@ -63,8 +63,8 @@ function ContributorModal({ user }: { user: User; }) {
|
|||
|
||||
const plugins = useMemo(() => {
|
||||
const allPlugins = Object.values(Plugins);
|
||||
const pluginsByAuthor = DevsById[user.id]
|
||||
? allPlugins.filter(p => p.authors.includes(DevsById[user.id]))
|
||||
const pluginsByAuthor = DevsById[user.id] || EquicordDevsById[user.id]
|
||||
? allPlugins.filter(p => p.authors.includes(DevsById[user.id] || EquicordDevsById[user.id]))
|
||||
: allPlugins.filter(p => p.authors.some(a => a.name === user.username));
|
||||
|
||||
return pluginsByAuthor
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { isPluginDev } from "@utils/misc";
|
||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
|
||||
|
@ -35,7 +35,7 @@ function CheckBadge({ badge, author }: { badge: string; author: any; }): JSX.Ele
|
|||
switch (badge) {
|
||||
case "EquicordDonor":
|
||||
return (
|
||||
<span style={{ order: settings.store.VencordDonorPosition }}>
|
||||
<span style={{ order: settings.store.EquicordDonorPosition }}>
|
||||
{badges.getEquicordDonorBadges(author.id)?.map((badge: any) => (
|
||||
<RoleIconComponent
|
||||
className={roleIconClassName}
|
||||
|
@ -46,6 +46,17 @@ function CheckBadge({ badge, author }: { badge: string; author: any; }): JSX.Ele
|
|||
))}
|
||||
</span>
|
||||
);
|
||||
case "EquicordContributer":
|
||||
return isEquicordPluginDev(author.id) ? (
|
||||
<span style={{ order: settings.store.EquicordContributorPosition }}>
|
||||
<RoleIconComponent
|
||||
className={roleIconClassName}
|
||||
name={"Equicord Contributor"}
|
||||
size={20}
|
||||
src={"https://github.com/Equicord/Ignore/blob/main/icon.png?raw=true"}
|
||||
/>
|
||||
</span>
|
||||
) : null;
|
||||
case "VencordDonor":
|
||||
return (
|
||||
<span style={{ order: settings.store.VencordDonorPosition }}>
|
||||
|
@ -64,7 +75,7 @@ function CheckBadge({ badge, author }: { badge: string; author: any; }): JSX.Ele
|
|||
<span style={{ order: settings.store.VencordContributorPosition }}>
|
||||
<RoleIconComponent
|
||||
className={roleIconClassName}
|
||||
name={"Vencord/Equicord Contributor"}
|
||||
name={"Vencord Contributor"}
|
||||
size={20}
|
||||
src={"https://i.imgur.com/OypoHrV.png"}
|
||||
/>
|
||||
|
@ -108,7 +119,8 @@ function CheckBadge({ badge, author }: { badge: string; author: any; }): JSX.Ele
|
|||
function ChatBadges({ author }: any) {
|
||||
return (
|
||||
<span style={{ display: "inline-flex", marginLeft: 2, verticalAlign: "top" }}>
|
||||
{settings.store.showVencordDonor && <CheckBadge badge={"EquicordDonor"} author={author} />}
|
||||
{settings.store.showEquicordDonor && <CheckBadge badge={"EquicordDonor"} author={author} />}
|
||||
{settings.store.showEquicordContributor && <CheckBadge badge={"EquicordContributor"} author={author} />}
|
||||
{settings.store.showVencordDonor && <CheckBadge badge={"VencordDonor"} author={author} />}
|
||||
{settings.store.showVencordContributor && <CheckBadge badge={"VencordContributer"} author={author} />}
|
||||
{settings.store.showDiscordProfile && <CheckBadge badge={"DiscordProfile"} author={author} />}
|
||||
|
|
|
@ -13,7 +13,7 @@ import { Text, useEffect, UserStore, useState } from "@webpack/common";
|
|||
const settings = definePluginSettings({
|
||||
showEquicordDonor: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Enable to show Vencord donor badges in chat.",
|
||||
description: "Enable to show Equicord donor badges in chat.",
|
||||
hidden: true,
|
||||
default: true
|
||||
},
|
||||
|
@ -23,6 +23,18 @@ const settings = definePluginSettings({
|
|||
hidden: true,
|
||||
default: 0
|
||||
},
|
||||
showEquicordContributor: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Enable to show Equicord contributor badges in chat.",
|
||||
hidden: true,
|
||||
default: true
|
||||
},
|
||||
EquicordContributorPosition: {
|
||||
type: OptionType.NUMBER,
|
||||
description: "The position of the Equicord Contributor badge.",
|
||||
hidden: true,
|
||||
default: 1
|
||||
},
|
||||
showVencordDonor: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Enable to show Vencord donor badges in chat.",
|
||||
|
@ -33,7 +45,7 @@ const settings = definePluginSettings({
|
|||
type: OptionType.NUMBER,
|
||||
description: "The position of the Vencord Donor badges.",
|
||||
hidden: true,
|
||||
default: 1
|
||||
default: 2
|
||||
},
|
||||
showVencordContributor: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
@ -45,7 +57,7 @@ const settings = definePluginSettings({
|
|||
type: OptionType.NUMBER,
|
||||
description: "The position of the Vencord Contributor badge.",
|
||||
hidden: true,
|
||||
default: 2
|
||||
default: 3
|
||||
},
|
||||
showDiscordProfile: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
@ -57,7 +69,7 @@ const settings = definePluginSettings({
|
|||
type: OptionType.NUMBER,
|
||||
description: "The position of the Discord profile badges.",
|
||||
hidden: true,
|
||||
default: 3
|
||||
default: 4
|
||||
},
|
||||
showDiscordNitro: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
@ -69,7 +81,7 @@ const settings = definePluginSettings({
|
|||
type: OptionType.NUMBER,
|
||||
description: "The position of the Discord Nitro badge.",
|
||||
hidden: true,
|
||||
default: 4
|
||||
default: 5
|
||||
},
|
||||
badgeSettings: {
|
||||
type: OptionType.COMPONENT,
|
||||
|
@ -83,6 +95,7 @@ export default settings;
|
|||
const BadgeSettings = () => {
|
||||
const [images, setImages] = useState([
|
||||
{ src: "https://i.imgur.com/KsxHlbD.png", shown: settings.store.showEquicordDonor, title: "Equicord donor badges", key: "EquicordDonor", position: settings.store.EquicordDonorPosition },
|
||||
{ src: "https://github.com/Equicord/Ignore/blob/main/icon.png?raw=true", shown: settings.store.showEquicordContributor, title: "Equicord donor badges", key: "EquicordDonor", position: settings.store.EquicordContributorPosition },
|
||||
{ src: "https://cdn.discordapp.com/emojis/1026533070955872337.png", shown: settings.store.showVencordDonor, title: "Vencord donor badges", key: "VencordDonor", position: settings.store.VencordDonorPosition },
|
||||
{ src: "https://i.imgur.com/OypoHrV.png", shown: settings.store.showVencordContributor, title: "Vencord/Equicord contributor badge", key: "VencordContributer", position: settings.store.VencordContributorPosition },
|
||||
{ src: "https://cdn.discordapp.com/badge-icons/bf01d1073931f921909045f3a39fd264.png", shown: settings.store.showDiscordProfile, title: "Discord profile badges (HypeSquad, Discord Staff, Active Developer, etc.)", key: "DiscordProfile", position: settings.store.DiscordProfilePosition },
|
||||
|
@ -96,6 +109,10 @@ const BadgeSettings = () => {
|
|||
settings.store.EquicordDonorPosition = image.position;
|
||||
settings.store.showEquicordDonor = image.shown;
|
||||
break;
|
||||
case "EquiordContributer":
|
||||
settings.store.EquicordContributorPosition = image.position;
|
||||
settings.store.showEquicordContributor = image.shown;
|
||||
break;
|
||||
case "VencordDonor":
|
||||
settings.store.VencordDonorPosition = image.position;
|
||||
settings.store.showVencordDonor = image.shown;
|
||||
|
|
|
@ -23,15 +23,16 @@ import { Flex } from "@components/Flex";
|
|||
import { Heart } from "@components/Heart";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { isPluginDev } from "@utils/misc";
|
||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import { closeModal, Modals, openModal } from "@utils/modal";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Forms, Toasts } from "@webpack/common";
|
||||
|
||||
const CONTRIBUTOR_BADGE = "https://i.imgur.com/OypoHrV.png";
|
||||
const CONTRIBUTOR_BADGE = "https://vencord.dev/assets/favicon.png";
|
||||
const EQUICORD_CONTRIBUTOR_BADGE = "https://github.com/Equicord/Ignore/blob/main/icon.png?raw=true";
|
||||
|
||||
const ContributorBadge: ProfileBadge = {
|
||||
description: "Vencord/Equicord Contributor",
|
||||
description: "Vencord Contributor",
|
||||
image: CONTRIBUTOR_BADGE,
|
||||
position: BadgePosition.START,
|
||||
props: {
|
||||
|
@ -44,6 +45,20 @@ const ContributorBadge: ProfileBadge = {
|
|||
link: "https://github.com/Vendicated/Vencord"
|
||||
};
|
||||
|
||||
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: ({ user }) => isEquicordPluginDev(user.id),
|
||||
link: "https://github.com/Vendicated/Vencord"
|
||||
};
|
||||
|
||||
let DonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
||||
let EquicordDonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
||||
|
||||
|
@ -110,6 +125,7 @@ export default definePlugin({
|
|||
|
||||
async start() {
|
||||
Vencord.Api.Badges.addBadge(ContributorBadge);
|
||||
Vencord.Api.Badges.addBadge(EquicordContributorBadge);
|
||||
await loadAllBadges();
|
||||
},
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import { DataStore } from "@api/index";
|
||||
import { Devs, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_ID } from "@utils/constants";
|
||||
import { isPluginDev } from "@utils/misc";
|
||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import { makeCodeblock } from "@utils/text";
|
||||
import definePlugin from "@utils/types";
|
||||
import { isOutdated } from "@utils/updater";
|
||||
|
@ -115,6 +115,7 @@ ${makeCodeblock(enabledPlugins.join(", ") + "\n\n" + enabledApiPlugins.join(", "
|
|||
});
|
||||
|
||||
if (isPluginDev(UserStore.getCurrentUser().id)) return;
|
||||
if (isEquicordPluginDev(UserStore.getCurrentUser().id)) return;
|
||||
|
||||
if (isOutdated && gitHash !== await DataStore.get(REMEMBER_DISMISS_KEY)) {
|
||||
const rememberDismiss = () => DataStore.set(REMEMBER_DISMISS_KEY, gitHash);
|
||||
|
|
|
@ -581,3 +581,11 @@ export const DevsById = /* #__PURE__*/ (() =>
|
|||
.map(([_, v]) => [v.id, v] as const)
|
||||
))
|
||||
)() as Record<string, Dev>;
|
||||
|
||||
export const EquicordDevsById = /* #__PURE__*/ (() =>
|
||||
Object.freeze(Object.fromEntries(
|
||||
Object.entries(EquicordDevs)
|
||||
.filter(d => d[1].id !== 0n)
|
||||
.map(([_, v]) => [v.id, v] as const)
|
||||
))
|
||||
)() as Record<string, Dev>;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import { Clipboard, Toasts } from "@webpack/common";
|
||||
|
||||
import { DevsById } from "./constants";
|
||||
import { DevsById, EquicordDevsById } from "./constants";
|
||||
|
||||
/**
|
||||
* Recursively merges defaults into an object and returns the same object
|
||||
|
@ -114,3 +114,4 @@ export function identity<T>(value: T): T {
|
|||
export const isMobile = navigator.userAgent.includes("Mobi");
|
||||
|
||||
export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id);
|
||||
export const isEquicordPluginDev = (id: string) => Object.hasOwn(EquicordDevsById, id);
|
||||
|
|
Loading…
Add table
Reference in a new issue