aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/settings.tsx75
-rw-r--r--src/webpack/common.tsx5
2 files changed, 65 insertions, 15 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,
diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx
index 855b887..0be47ff 100644
--- a/src/webpack/common.tsx
+++ b/src/webpack/common.tsx
@@ -182,7 +182,9 @@ waitFor(["getMember", "initialize"], m => GuildMemberStore = m);
waitFor("getRelationshipType", m => RelationshipStore = m);
waitFor(["Hovers", "Looks", "Sizes"], m => Button = m);
-waitFor(filters.byCode("helpdeskArticleId"), m => Switch = m);
+
+waitFor(filters.byCode("tooltipNote", "ringTarget"), m => Switch = m);
+
waitFor(["Positions", "Colors"], m => Tooltip = m);
waitFor(m => m.Types?.PRIMARY === "cardPrimary", m => Card = m);
@@ -305,3 +307,4 @@ export const ContextMenu = mapMangledModuleLazy('type:"CONTEXT_MENU_OPEN"', {
export const MaskedLinkStore = mapMangledModuleLazy('"MaskedLinkStore"', {
openUntrustedLink: filters.byCode(".apply(this,arguments)")
});
+