diff --git a/src/equicordplugins/githubRepos/index.tsx b/src/equicordplugins/githubRepos/index.tsx index 2faccdd4d..631af9577 100644 --- a/src/equicordplugins/githubRepos/index.tsx +++ b/src/equicordplugins/githubRepos/index.tsx @@ -69,8 +69,8 @@ export default definePlugin({ { find: ".hasAvatarForGuild(null==", replacement: { - match: /currentUser:\i,guild:\i.{0,15}\}\).{0,100}(?=\])/, - replace: "$&,$self.ProfilePopoutComponent({ user: arguments[0].user, displayProfile: arguments[0].displayProfile })" + match: /userId:\i\.id,guild:\i.{0,15}\}\).{0,100}(?=\])/, + replace: "$&,$self.ProfilePopoutComponent(arguments[0])" } }, // User Profile Modal v1 @@ -78,7 +78,7 @@ export default definePlugin({ find: ".connections,userId:", replacement: { match: /user:(\i).{0,15}displayProfile:(\i).*?application\.id\)\)\}\)/, - replace: "$&,$self.ProfilePopoutComponent({ user: arguments[0].user, displayProfile: arguments[0].displayProfile })," + replace: "$&,$self.ProfilePopoutComponent(arguments[0])," } }, // User Profile Modal v2 diff --git a/src/plugins/alwaysExpandRoles/index.ts b/src/plugins/alwaysExpandRoles/index.ts index 382037d18..fd9cedc47 100644 --- a/src/plugins/alwaysExpandRoles/index.ts +++ b/src/plugins/alwaysExpandRoles/index.ts @@ -17,12 +17,9 @@ */ import { definePluginSettings, migratePluginSettings } from "@api/Settings"; -import { disableStyle, enableStyle } from "@api/Styles"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import style from "./style.css?managed"; - const settings = definePluginSettings({ hideArrow: { type: OptionType.BOOLEAN, @@ -38,28 +35,27 @@ export default definePlugin({ description: "Always expands the role list in profile popouts", authors: [Devs.surgedevs], isModified: true, + settings, patches: [ { - find: 'action:"EXPAND_ROLES"', + find: "hasDeveloperContextMenu:", replacement: [ { - match: /(roles:\i(?=.+?(\i)\(!0\)[,;]\i\({action:"EXPAND_ROLES"}\)).+?\[\i,\2\]=\i\.useState\()!1\)/, - replace: (_, rest, setExpandedRoles) => `${rest}!0)` + match: /(?<=\?\i\.current\[\i\].{0,100})useState\(!1\)/, + replace: "useState(!0)" }, { // Fix not calculating non-expanded roles because the above patch makes the default "expanded", // which makes the collapse button never show up and calculation never occur - match: /(?<=useLayoutEffect\(\(\)=>{if\()\i/, - replace: isExpanded => "false" + match: /(?<=useLayoutEffect\(\(\)=>\{if\()\i/, + replace: "false" + }, + { + match: /\(\)=>\i\.length<\i\.length/, + replace: "()=>false", + predicate: () => settings.store.hideArrow } ] } ], - settings, - start() { - if (settings.store.hideArrow) enableStyle(style); - }, - stop() { - if (settings.store.hideArrow) disableStyle(style); - } }); diff --git a/src/plugins/alwaysExpandRoles/style.css b/src/plugins/alwaysExpandRoles/style.css deleted file mode 100644 index 5f0a19d66..000000000 --- a/src/plugins/alwaysExpandRoles/style.css +++ /dev/null @@ -1,3 +0,0 @@ -[aria-label]:has(> [class*="collapseButton"]) { - display: none -} \ No newline at end of file diff --git a/src/plugins/permissionsViewer/components/UserPermissions.tsx b/src/plugins/permissionsViewer/components/UserPermissions.tsx index b508f5eca..c30db7d50 100644 --- a/src/plugins/permissionsViewer/components/UserPermissions.tsx +++ b/src/plugins/permissionsViewer/components/UserPermissions.tsx @@ -39,14 +39,13 @@ interface UserPermission { type UserPermissions = Array; -const { RoleRootClasses, RoleClasses, RoleBorderClasses } = proxyLazyWebpack(() => { - const [RoleRootClasses, RoleClasses, RoleBorderClasses] = findBulk( - filters.byProps("root", "expandButton", "collapseButton"), - filters.byProps("role", "roleCircle", "roleName"), - filters.byProps("roleCircle", "dot", "dotBorderColor") +const { RoleClasses, RoleBorderClasses } = proxyLazyWebpack(() => { + const [RoleClasses, RoleBorderClasses] = findBulk( + filters.byProps("root", "role", "roleRemoveButton", "roleName"), + filters.byProps("roleCircle", "dotBorderColor") ) as Record[]; - return { RoleRootClasses, RoleClasses, RoleBorderClasses }; + return { RoleClasses, RoleBorderClasses }; }); interface FakeRoleProps extends React.HTMLAttributes { @@ -193,7 +192,7 @@ function UserPermissionsComponent({ guild, guildMember, closePopout }: { guild: {userPermissions.length > 0 && ( -
+
{userPermissions.map(({ permission, roleColor, roleName }) => ( { + ViewPermissionsButton: ErrorBoundary.wrap(({ className, guild, userId }: { className: string; guild: Guild; userId: string; }) => { + const guildMember = GuildMemberStore.getMember(guild.id, userId); + if (!guildMember) return null; + const buttonRef = useRef(null); return ( diff --git a/src/plugins/showConnections/index.tsx b/src/plugins/showConnections/index.tsx index 42385f0da..e3e7c263b 100644 --- a/src/plugins/showConnections/index.tsx +++ b/src/plugins/showConnections/index.tsx @@ -166,10 +166,10 @@ export default definePlugin({ patches: [ { - find: ".hasAvatarForGuild(null==", + find: "UserProfilePopoutBody", replacement: { - match: /currentUser:\i,guild:\i[^}]*?\}\)(?=])(?<=user:(\i),bio:null==(\i)\?.+?)/, - replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2 })" + match: /userId:\i\.id,guild:\i\}\)(?=])/, + replace: "$&,$self.profilePopoutComponent(arguments[0])" } } ],