aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-01-22 04:26:33 +0100
committerVendicated <vendicated@riseup.net>2023-01-22 04:26:33 +0100
commitb4f98e5066aa41f986865f4b598593afc9161d3b (patch)
treebd26c6c36e4fa54f106c17bf635bce0801d29728 /src/plugins
parent9602f527d8e2a8c90856d76c1da5d9a592fc08fc (diff)
downloadVencord-b4f98e5066aa41f986865f4b598593afc9161d3b.tar.gz
Vencord-b4f98e5066aa41f986865f4b598593afc9161d3b.tar.bz2
Vencord-b4f98e5066aa41f986865f4b598593afc9161d3b.zip
Fix Settings ContextMenu Shortcuts & Settings on canary
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/settings.tsx75
1 files changed, 61 insertions, 14 deletions
diff --git a/src/plugins/settings.tsx b/src/plugins/settings.tsx
index 183798a..36bf525 100644
--- a/src/plugins/settings.tsx
+++ b/src/plugins/settings.tsx
@@ -17,10 +17,12 @@
*/
import { Settings } from "@api/settings";
+import PatchHelper from "@components/PatchHelper";
import { Devs } from "@utils/constants";
import Logger from "@utils/Logger";
import { LazyComponent } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
+import { Router } from "@webpack/common";
import gitHash from "~git-hash";
@@ -62,23 +64,68 @@ export default definePlugin({
}
}
},
- replace: (m, mod) => {
- const updater = !IS_WEB ? '{section:"VencordUpdater",label:"Updater",element:Vencord.Plugins.plugins.Settings.tabs.updater},' : "";
- const patchHelper = IS_DEV ? '{section:"VencordPatchHelper",label:"Patch Helper",element:Vencord.Components.PatchHelper},' : "";
- return (
- `{section:${mod}.ID.HEADER,label:"Vencord"},` +
- '{section:"VencordSettings",label:"Vencord",element:Vencord.Plugins.plugins.Settings.tabs.vencord},' +
- '{section:"VencordPlugins",label:"Plugins",element:Vencord.Plugins.plugins.Settings.tabs.plugins},' +
- '{section:"VencordThemes",label:"Themes",element:Vencord.Plugins.plugins.Settings.tabs.themes},' +
- updater +
- '{section:"VencordSettingsSync",label:"Backup & Restore",element:Vencord.Plugins.plugins.Settings.tabs.sync},' +
- patchHelper +
- `{section:${mod}.ID.DIVIDER},${m}`
- );
- }
+ replace: "...$self.makeSettingsCategories($1),$&"
}
}],
+ makeSettingsCategories({ ID }: { ID: Record<string, unknown>; }) {
+ const makeOnClick = (tab: string) => () => Router.open(tab);
+
+ const cats = [
+ {
+ section: ID.HEADER,
+ label: "Vencord"
+ }, {
+ section: "VencordSettings",
+ label: "Vencord",
+ element: () => <SettingsComponent tab="VencordSettings" />,
+ onClick: makeOnClick("VencordSettings")
+ }, {
+ section: "VencordPlugins",
+ label: "Plugins",
+ element: () => <SettingsComponent tab="VencordPlugins" />,
+ onClick: makeOnClick("VencordPlugins")
+ }, {
+ section: "VencordThemes",
+ label: "Themes",
+ element: () => <SettingsComponent tab="VencordThemes" />,
+ onClick: makeOnClick("VencordThemes")
+ }
+ ] as Array<{
+ section: unknown,
+ label?: string;
+ element?: React.ComponentType;
+ onClick?(): void;
+ }>;
+
+ if (!IS_WEB)
+ cats.push({
+ section: "VencordUpdater",
+ label: "Updater",
+ element: () => <SettingsComponent tab="VencordUpdater" />,
+ onClick: makeOnClick("VencordUpdater")
+ });
+
+ cats.push({
+ section: "VencordSettingsSync",
+ label: "Backup & Restore",
+ element: () => <SettingsComponent tab="VencordSettingsSync" />,
+ onClick: makeOnClick("VencordSettingsSync")
+ });
+
+ if (IS_DEV)
+ cats.push({
+ section: "VencordPatchHelper",
+ label: "Patch Helper",
+ element: PatchHelper!,
+ onClick: makeOnClick("VencordPatchHelper")
+ });
+
+ cats.push({ section: ID.DIVIDER });
+
+ return cats;
+ },
+
options: {
settingsLocation: {
type: OptionType.SELECT,