From 50f9c60d5530eef52dc1c50ea742fb8beab6b0fe Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:41:53 -0500 Subject: [PATCH] Use Discord Icons --- .../components/BookmarkContainer.tsx | 24 +++--------- .../channelTabs/components/ChannelTab.tsx | 4 +- .../components/ChannelTabsContainer.tsx | 18 +-------- .../channelTabs/util/constants.tsx | 20 +--------- src/equicordplugins/loginWithQR/ui/index.ts | 4 ++ src/equicordplugins/pinIcon/index.tsx | 7 ++-- src/equicordplugins/sidebarChat/index.tsx | 39 ++----------------- src/equicordplugins/statusPresets/index.tsx | 19 ++------- 8 files changed, 23 insertions(+), 112 deletions(-) diff --git a/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx b/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx index fcacd0af..4fbf0768 100644 --- a/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx +++ b/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx @@ -8,6 +8,7 @@ import { classNameFactory } from "@api/Styles"; import { getIntlMessage } from "@utils/discord"; import { classes } from "@utils/misc"; import { closeModal, openModal } from "@utils/modal"; +import { findComponentByCodeLazy } from "@webpack"; import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, Menu, ReadStateStore, ReadStateUtils, Text, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore } from "@webpack/common"; import { BasicChannelTabsProps, Bookmark, BookmarkFolder, BookmarkProps, CircleQuestionIcon, isBookmarkFolder, settings, switchChannel, useBookmarks } from "../util"; @@ -16,23 +17,7 @@ import { BookmarkContextMenu, EditModal } from "./ContextMenus"; const cl = classNameFactory("vc-channeltabs-"); -function StarIcon({ className = "", ...props }) { - return - - ; -} +const StarIcon = findComponentByCodeLazy(".73-2.25h6.12l1.9-5.83Z"); function FolderIcon({ fill }: { fill: string; }) { return ( @@ -304,8 +289,9 @@ export default function BookmarkContainer(props: BasicChannelTabsProps & { userI }} > + height={20} + width={20} + colorClass={isCurrentChannelBookmarked ? cl("bookmark-star-checked") : cl("bookmark-star")} /> } diff --git a/src/equicordplugins/channelTabs/components/ChannelTab.tsx b/src/equicordplugins/channelTabs/components/ChannelTab.tsx index 9c70b22d..0a601b36 100644 --- a/src/equicordplugins/channelTabs/components/ChannelTab.tsx +++ b/src/equicordplugins/channelTabs/components/ChannelTab.tsx @@ -17,9 +17,7 @@ import { TabContextMenu } from "./ContextMenus"; const ThreeDots = findComponentByCodeLazy(".dots,", "dotRadius:"); const dotStyles = findByPropsLazy("numberBadge", "textBadge"); -function FriendsIcon() { - return ; -} +const FriendsIcon = findComponentByCodeLazy("12h1a8"); const ChannelTypeIcon = findComponentByCodeLazy(".iconContainerWithGuildIcon,"); const cl = classNameFactory("vc-channeltabs-"); diff --git a/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx b/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx index 91de3840..4fd26e76 100644 --- a/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx +++ b/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx @@ -6,6 +6,7 @@ import { classNameFactory } from "@api/Styles"; import { useForceUpdater } from "@utils/react"; +import { findComponentByCodeLazy } from "@webpack"; import { Button, ContextMenuApi, Flex, FluxDispatcher, Forms, useCallback, useEffect, useRef, UserStore, useState } from "@webpack/common"; import { BasicChannelTabsProps, ChannelTabsProps, createTab, handleChannelSwitch, openedTabs, openStartupTabs, saveTabs, settings, setUpdaterFunction, useGhostTabs } from "../util"; @@ -15,22 +16,7 @@ import { BasicContextMenu } from "./ContextMenus"; type TabSet = Record; -function PlusSmallIcon() { - return - - - ; -} +const PlusSmallIcon = findComponentByCodeLazy("0v-5h5a1"); const cl = classNameFactory("vc-channeltabs-"); diff --git a/src/equicordplugins/channelTabs/util/constants.tsx b/src/equicordplugins/channelTabs/util/constants.tsx index 10aba4fe..04e2b078 100644 --- a/src/equicordplugins/channelTabs/util/constants.tsx +++ b/src/equicordplugins/channelTabs/util/constants.tsx @@ -7,6 +7,7 @@ import { definePluginSettings } from "@api/Settings"; import { Logger } from "@utils/Logger"; import { OptionType } from "@utils/types"; +import { findComponentByCodeLazy } from "@webpack"; import { ChannelTabsPreview } from "../components/ChannelTabsContainer"; @@ -73,21 +74,4 @@ export const settings = definePluginSettings({ } }); -export function CircleQuestionIcon({ height = 24, width = 24 }) { - return - - - - ; - -} +export const CircleQuestionIcon = findComponentByCodeLazy("10.58l-3.3-3.3a1"); diff --git a/src/equicordplugins/loginWithQR/ui/index.ts b/src/equicordplugins/loginWithQR/ui/index.ts index a8d67673..23e2fa27 100644 --- a/src/equicordplugins/loginWithQR/ui/index.ts +++ b/src/equicordplugins/loginWithQR/ui/index.ts @@ -8,6 +8,7 @@ import "./styles.css"; import { classNameFactory } from "@api/Styles"; import { proxyLazy } from "@utils/lazy"; +import { findComponentByCodeLazy } from "@webpack"; import { Forms } from "@webpack/common"; import { ComponentType, HTMLAttributes } from "react"; @@ -35,4 +36,7 @@ export const { Spinner } = proxyLazy(() => Forms as any as { Spinner: Spinner, SpinnerTypes: typeof SpinnerTypes; }); + +export const QrCodeIcon = findComponentByCodeLazy("0v3ZM20"); + export const cl = classNameFactory("qrlogin-"); diff --git a/src/equicordplugins/pinIcon/index.tsx b/src/equicordplugins/pinIcon/index.tsx index ac547423..8ae671df 100644 --- a/src/equicordplugins/pinIcon/index.tsx +++ b/src/equicordplugins/pinIcon/index.tsx @@ -18,11 +18,10 @@ import { EquicordDevs } from "@utils/constants"; import definePlugin from "@utils/types"; +import { findComponentByCodeLazy } from "@webpack"; import { Message } from "discord-types/general"; -function PinIcon({ style = {} }) { - return ; -} +const PinIcon = findComponentByCodeLazy("1-.06-.63L6.16"); export default definePlugin({ name: "PinIcon", description: "Adds a pin icon to pinned messages", @@ -37,6 +36,6 @@ export default definePlugin({ } ], PinnedIcon({ pinned }: Message) { - return pinned ? () : null; + return pinned ? () : null; } }); diff --git a/src/equicordplugins/sidebarChat/index.tsx b/src/equicordplugins/sidebarChat/index.tsx index 8c88e50d..bff94c59 100644 --- a/src/equicordplugins/sidebarChat/index.tsx +++ b/src/equicordplugins/sidebarChat/index.tsx @@ -44,41 +44,8 @@ interface ContextMenuProps { user: User; } -function ArrowsLeftRightIcon() { - return - - - - - ; -} - -function XSmallIcon() { - return - - - ; -} +const ArrowsLeftRightIcon = findComponentByCodeLazy("18.58V3a1"); +const XSmallIcon = findComponentByCodeLazy("13.42l5.3"); function MakeContextCallback(name: "user" | "channel"): NavContextMenuPatchCallback { return (children, { user, channel, guildId }: ContextMenuProps) => { @@ -156,7 +123,7 @@ export default definePlugin({ toolbar={ <> } tooltip="Switch channels" onClick={() => { const currentChannel = ChannelStore.getChannel(SelectedChannelStore.getChannelId()); diff --git a/src/equicordplugins/statusPresets/index.tsx b/src/equicordplugins/statusPresets/index.tsx index 80b11118..05bf14df 100644 --- a/src/equicordplugins/statusPresets/index.tsx +++ b/src/equicordplugins/statusPresets/index.tsx @@ -46,22 +46,9 @@ interface Emoji { id: bigint | null; name: string; } -function CircleXIcon() { - return - - - - ; -} + +const CircleXIcon = findComponentByCodeLazy("22Zm4.7-15.7a1"); + interface DiscordStatus { emojiInfo: Emoji | null; text: string;