diff --git a/src/api/MemberListDecorators.tsx b/src/api/MemberListDecorators.tsx index ab5a618b..ada60776 100644 --- a/src/api/MemberListDecorators.tsx +++ b/src/api/MemberListDecorators.tsx @@ -21,25 +21,14 @@ import { Channel, User } from "discord-types/general/index.js"; import { JSX } from "react"; interface DecoratorProps { - activities: any[]; - channel: Channel; - /** - * Only for DM members - */ - channelName?: string; - /** - * Only for server members - */ - currentUser?: User; - guildId?: string; - isMobile: boolean; - isOwner?: boolean; - isTyping: boolean; - selected: boolean; - status: string; + type: "guild" | "dm"; user: User; - [key: string]: any; + /** only present when this is a DM list item */ + channel: Channel; + /** only present when this is a guild list item */ + isOwner: boolean; } + export type MemberListDecoratorFactory = (props: DecoratorProps) => JSX.Element | null; type OnlyIn = "guilds" | "dms"; @@ -53,18 +42,16 @@ export function removeMemberListDecorator(identifier: string) { decoratorsFactories.delete(identifier); } -export function __getDecorators(props: DecoratorProps): JSX.Element { - const isInGuild = !!(props.guildId); - +export function __getDecorators(props: DecoratorProps, type: "guild" | "dm"): JSX.Element { const decorators = Array.from( decoratorsFactories.entries(), ([key, { render: Decorator, onlyIn }]) => { - if ((onlyIn === "guilds" && !isInGuild) || (onlyIn === "dms" && isInGuild)) + if ((onlyIn === "guilds" && type !== "guild") || (onlyIn === "dms" && type !== "dm")) return null; return ( - + ); } diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index e8ecb43b..7e6d9a3e 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -91,7 +91,7 @@ export default definePlugin({ required: true, patches: [ { - find: ".FULL_SIZE]:26", + find: ".MODAL]:26", replacement: { match: /(?=;return 0===(\i)\.length\?)(?<=(\i)\.useMemo.+?)/, replace: ";$1=$2.useMemo(()=>[...$self.getBadges(arguments[0].displayProfile),...$1],[$1])" diff --git a/src/plugins/_api/memberListDecorators/index.tsx b/src/plugins/_api/memberListDecorators/index.tsx index 3f76a42f..90f09d8f 100644 --- a/src/plugins/_api/memberListDecorators/index.tsx +++ b/src/plugins/_api/memberListDecorators/index.tsx @@ -32,25 +32,17 @@ export default definePlugin({ { find: ".lostPermission)", replacement: [ - { - match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/, - replace: "$&vencordProps=$1," - }, - { - match: /decorators:.{0,100}?(?=user:)/, - replace: "$&vencordProps:typeof vencordProps!=='undefined'?vencordProps:void 0," - }, { match: /children:\[(?=.{0,300},lostPermissionTooltipText:)/, - replace: "children:[(arguments[0]?.vencordProps&&Vencord.Api.MemberListDecorators.__getDecorators(arguments[0].vencordProps))," + replace: "children:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0],'guild')," } ] }, { find: "PrivateChannel.renderAvatar", replacement: { - match: /decorators:(\i\.isSystemDM\(\))\?(.+?):null/, - replace: "decorators:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0]),$1?$2:null]" + match: /decorators:(\i\.isSystemDM\(\)\?.+?:null)/, + replace: "decorators:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0],'dm'),$1]" } } ] diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts index edc25b21..eaee4395 100644 --- a/src/plugins/_api/serverList.ts +++ b/src/plugins/_api/serverList.ts @@ -32,14 +32,14 @@ export default definePlugin({ } }, { - find: "#{intl::SERVERS}),gap:\"xs\",children:", + find: ".setGuildsTree(", replacement: [ { - match: /(?<=#{intl::SERVERS}\),gap:"xs",children:)(\i\.map\(.{10,50}?)(}\))/, - replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($1)$2" + match: /(?<=#{intl::SERVERS}\),gap:"xs",children:)\i\.map\(.{0,50}\.length\)/, + replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)" }, { - match: /children:.{0,2000}?\{\}\)\]/, + match: /lastTargetNode.{0,50}\{\}\)\]/, replace: "$&.concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Below))" } ] diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index 536cf6e4..ad63ba27 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -19,7 +19,7 @@ interface UserProfileProps { originalRenderPopout: () => React.ReactNode; } -const UserProfile = findComponentByCodeLazy(".BITE_SIZE,user:"); +const UserProfile = findComponentByCodeLazy(".POPOUT,user"); let openAlternatePopout = false; let accountPanelRef: React.RefObject | null> = { current: null }; diff --git a/src/plugins/forceOwnerCrown/index.ts b/src/plugins/forceOwnerCrown/index.ts index df0243d8..bf115c64 100644 --- a/src/plugins/forceOwnerCrown/index.ts +++ b/src/plugins/forceOwnerCrown/index.ts @@ -29,9 +29,8 @@ export default definePlugin({ { find: "#{intl::GUILD_OWNER}),children:", replacement: { - // The isOwner prop is used in more tha one component in this module. Make sure we patch the right one - match: /,isOwner:(\i),(?=[^}]+guildId)/, - replace: ",_isOwner:$1=$self.isGuildOwner(e)," + match: /(?<=decorators:.{0,200}?isOwner:)\i/, + replace: "$self.isGuildOwner(arguments[0])" } } ], diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index 0f4016ad..07723bcc 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -24,7 +24,7 @@ export default definePlugin({ patches: [ // DM User Sidebar { - find: ".PANEL}),nicknameIcons", + find: ".SIDEBAR}),nicknameIcons", replacement: { match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/, replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})" diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index f2ca9282..087bea15 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -67,8 +67,8 @@ export default definePlugin({ { find: '="SYSTEM_TAG"', replacement: { - match: /\i.gradientClassName]\),style:/, - replace: "$&{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:" + match: /(?<=\.username.{0,50}?)style:/, + replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:" } }, { diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index 1c9ad40e..d71fd933 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +import "./style.css"; + import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { isNonNullish } from "@utils/guards"; @@ -95,6 +97,12 @@ export default definePlugin({ { match: /\(0,\i\.jsx\)\(\i,\{items:\i,section:(\i)/, replace: "$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):$&" + }, + // Discord adds spacing between each item which pushes our tab off screen. + // set the gap to zero to ensure ours stays on screen + { + match: /className:\i\.tabBar/, + replace: "$& + ' vc-mutual-gdms-tab-bar'" } ] }, diff --git a/src/plugins/mutualGroupDMs/style.css b/src/plugins/mutualGroupDMs/style.css new file mode 100644 index 00000000..14ea83c9 --- /dev/null +++ b/src/plugins/mutualGroupDMs/style.css @@ -0,0 +1,4 @@ +.vc-mutual-gdms-tab-bar { + gap: 0; + justify-content: space-between; +}