diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index 926363848..90287b4c7 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -1142,3 +1142,31 @@ export function PencilSparkleIcon(props: IconProps) { ); } + +export function HammerIcon(props: IconProps) { + return ( + + + + ); +} + +export function AchievementsIcon(props: IconProps) { + return ( + + + + ); +} diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index c5c555a50..31b4e235c 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -6,7 +6,7 @@ import { definePluginSettings } from "@api/Settings"; import { disableStyle, enableStyle } from "@api/Styles"; -import { AppsIcon, CreditCardIcon, DeveloperIcon, EquicordIcon, GameControllerIcon, MainSettingsIcon, PencilSparkleIcon, UserIcon } from "@components/Icons"; +import { AchievementsIcon, AppsIcon, CreditCardIcon, DeveloperIcon, EquicordIcon, GameControllerIcon, HammerIcon, MainSettingsIcon, PencilSparkleIcon, UserIcon } from "@components/Icons"; import { buildPluginMenuEntries, buildThemeMenuEntries } from "@equicordplugins/equicordToolbox/menu"; import { Devs } from "@utils/constants"; import { classNameFactory } from "@utils/css"; @@ -32,6 +32,8 @@ const SECTION_ICONS: Record = { activity_section: GameControllerIcon, developer_section: DeveloperIcon, utility_section: MainSettingsIcon, + playgrounds_section: AchievementsIcon, + build_overrides_section: HammerIcon, }; const settings = definePluginSettings({ @@ -169,11 +171,23 @@ export default definePlugin({ predicate: () => settings.store.organizeMenu, replacement: [ { - match: /children:\[(\i),(?<=\1=(?:function|.{0,30}\.openUserSettings).+?)/, // TODO .{0,30}\.openUserSettings is stable compat - replace: "children:[$self.transformSettingsEntries($1),", + match: /"clear-build-override"\)\]\}/, + replace: '$&,"build_overrides_section"' }, + { + match: /children:\[(\i),null!=(\i).{0,30}\}\),(\i)\](?<=\1=(?:function|.{0,30}\.openUserSettings).+?)/, // TODO .{0,30}\.openUserSettings is stable compat + replace: "children:$self.transformSettingsEntries([$1,$2,$3])", + } ] }, + { + find: '},"design-systems")', + predicate: () => settings.store.organizeMenu, + replacement: { + match: /\},"playgrounds"\)/, + replace: '},"playgrounds_section")' + } + }, ], // This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary @@ -194,12 +208,14 @@ export default definePlugin({ transformSettingsEntries(list) { const items: ReactNode[] = []; const SECTION_NAMES: Record = { - profile_section: getIntlMessage("EDIT_PROFILES"), user_section: getIntlMessage("ACCOUNT_SETTINGS"), utility_section: getIntlMessage("USER_SETTINGS_KEYBINDS_MISCELLANEOUS_SECTION_TITLE") }; - for (const item of list) { + const flat = list.flat(Infinity); + let logout: ReactNode = null; + + for (const item of flat) { const { key, props } = item; if (!props) continue; @@ -213,8 +229,12 @@ export default definePlugin({ {children} ); - } else if (key.endsWith("_section") && (props.label ?? SECTION_NAMES[key])) { + } else if (key?.endsWith("_section") && (props.label ?? SECTION_NAMES[key])) { const iconLeft = SECTION_ICONS[key]; + const children: any = [].concat(props.children ?? []).flat(Infinity); + const logoutItem = children.find(c => c?.key === "logout_sidebar_item"); + if (logoutItem) logout = ; + items.push( - {this.transformSettingsEntries(props.children)} + {this.transformSettingsEntries(children.filter(c => c?.key !== "logout_sidebar_item"))} ); } else { @@ -230,6 +250,7 @@ export default definePlugin({ } } + if (logout) items.push(logout); return items; } }); diff --git a/src/plugins/callTimer/index.tsx b/src/plugins/callTimer/index.tsx index 765ed610b..1e0e6dad0 100644 --- a/src/plugins/callTimer/index.tsx +++ b/src/plugins/callTimer/index.tsx @@ -143,7 +143,7 @@ export default definePlugin({ replace: "$1[$2,$self.renderConnectionTimer({ channelId: this?.props?.channel?.id })]" }, { - match: /("RTCConnectionMenu".{0,100}?lineClamp:1,children:)(\i)(?=,|}\))/, + match: /("RTCConnectionMenu".{0,200}?lineClamp:1,children:)(\i)(?=,|}\))/, replace: "$1[$2,$self.renderConnectionTimer({ channelId: this?.props?.channel?.id })]" } ]