diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index 6909fbd25..5c54d11f1 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -18,22 +18,25 @@ import "./style.css"; +import { BaseText } from "@components/BaseText"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { isNonNullish } from "@utils/guards"; import { Logger } from "@utils/Logger"; import definePlugin from "@utils/types"; import { Channel, User } from "@vencord/discord-types"; -import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; +import { findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy } from "@webpack"; import { Avatar, ChannelStore, Clickable, IconUtils, RelationshipStore, ScrollerThin, Text, useMemo, UserStore } from "@webpack/common"; import { JSX } from "react"; const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel"); const UserUtils = findByPropsLazy("getGlobalName"); -const ProfileListClasses = findByPropsLazy("emptyIconFriends", "emptyIconGuilds"); -const MutualsListClasses = findByPropsLazy("row", "icon", "name", "nick"); -const ExpandableList = findComponentByCodeLazy('"PRESS_SECTION"', ".header"); +const ProfileListClasses = findCssClassesLazy("empty", "textContainer", "connectionIcon"); +const TabBarClasses = findCssClassesLazy("tabPanelScroller", "tabBarPanel"); +const MutualsListClasses = findCssClassesLazy("row", "icon", "name", "details"); +// FIXME +const ExpandableList = findComponentByCodeLazy('"PRESS_SECTION"'); function getGroupDMName(channel: Channel) { return channel.name || @@ -116,7 +119,7 @@ export default definePlugin({ replace: "$&$self.pushSection($1,arguments[0].user);" }, { - match: /\.tabBarPanel,.*?children:(?=.+?section:(\i))/, + match: /className:\i\.\i,children:(?=.{0,100}?component:.*?section:(\i))/, replace: "$&$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):" }, // Make the gap between each item smaller so our tab can fit. @@ -172,7 +175,7 @@ export default definePlugin({ return ( @@ -180,8 +183,9 @@ export default definePlugin({ ? entries : (
-
-
No group dms in common
+
+ You don't have any group chats in common +
) } diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 4a52b49c9..91c53465c 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -26,7 +26,7 @@ import { TooltipContainer as TooltipContainerComponent } from "@components/Toolt import { TooltipFallback } from "@components/TooltipFallback"; import { LazyComponent } from "@utils/lazyReact"; import * as t from "@vencord/discord-types"; -import { filters, mapMangledModuleLazy, waitFor } from "@webpack"; +import { filters, findCssClassesLazy, mapMangledModuleLazy, waitFor } from "@webpack"; import { waitForComponent } from "./internal"; @@ -77,12 +77,11 @@ export const UserSummaryItem = waitForComponent("UserSummaryItem", filters.compo export let createScroller: (scrollbarClassName: string, fadeClassName: string, customThemeClassName: string) => t.ScrollerThin; export let createListScroller: (scrollBarClassName: string, fadeClassName: string, someOtherClassIdkMan: string, resizeObserverClass: typeof ResizeObserver) => t.ListScrollerThin; -export let scrollerClasses: Record; +export const scrollerClasses = findCssClassesLazy("thin", "auto", "fade", "customTheme", "none"); export let listScrollerClasses: Record; waitFor(filters.byCode('="ltr",orientation:', "customTheme:", "forwardRef"), m => createScroller = m); waitFor(filters.byCode("getScrollerNode:", "resizeObserver:", "sectionHeight:"), m => createListScroller = m); -waitFor(["thin", "auto", "customTheme"], m => scrollerClasses = m); waitFor(m => m.thin && m.auto && !m.customTheme, m => listScrollerClasses = m); export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.none, scrollerClasses.fade, scrollerClasses.customTheme));