fix MutualGroupDMs

This commit is contained in:
Vendicated 2026-01-23 20:27:23 +01:00
parent 918f27876e
commit 518408894b
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 14 additions and 11 deletions

View file

@ -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 (
<ScrollerThin
className={ProfileListClasses.listScroller}
className={TabBarClasses.tabPanelScroller}
fade={true}
onClose={onClose}
>
@ -180,8 +183,9 @@ export default definePlugin({
? entries
: (
<div className={ProfileListClasses.empty}>
<div className={ProfileListClasses.emptyIconFriends}></div>
<div className={ProfileListClasses.emptyText}>No group dms in common</div>
<div className={ProfileListClasses.textContainer}>
<BaseText tag="h3" size="md" weight="medium" style={{ color: "var(--text-strong)" }}>You don't have any group chats in common</BaseText>
</div>
</div>
)
}

View file

@ -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<string, string>;
export const scrollerClasses = findCssClassesLazy("thin", "auto", "fade", "customTheme", "none");
export let listScrollerClasses: Record<string, string>;
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));