diff --git a/src/plugins/switchProfileButton/index.tsx b/src/plugins/switchProfileButton/index.tsx new file mode 100644 index 000000000..74e8b0ccb --- /dev/null +++ b/src/plugins/switchProfileButton/index.tsx @@ -0,0 +1,65 @@ +import { migratePluginSettings } from "@api/Settings"; +import ErrorBoundary from "@components/ErrorBoundary"; +import { Devs } from "@utils/constants"; +import { classes } from "@utils/misc"; +import definePlugin from "@utils/types"; +import { findByPropsLazy } from "@webpack"; +import { Button, Icons, TooltipContainer, Text, type MenuTypes } from "@webpack/common"; +import { ReactNode } from "react"; + +const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "banner"); + +type SwitchProfileMenuItemProps = { + id: string; + label: string; + subtext: ReactNode; + action(): void; +}; + +export default definePlugin({ + name: "SwitchProfileButton", + description: "Moves the View Main/Server Profile button out of the overflow menu", + authors: [Devs.Sqaaakoi], + + patches: [ + { + find: ".FULL_SIZE,user:", + group: true, + replacement: [ + { + match: /\(\i\.MenuItem(,{id:"view-)/g, + replace: "($self.SwitchProfileButton$1" + }, + { + match: /(\(0,\i\.jsx\)\(.{0,30}viewProfileItem:)(\i\(\))}\)/, + replace: "$2,$1null})" + } + ] + }, + ], + + SwitchProfileButton: ErrorBoundary.wrap((props: SwitchProfileMenuItemProps) => { + return + {props.label} + {props.subtext} + } + aria-label={false} + > + + ; + }, { noop: true }) +});