From 6b55dee9fbba1a54cbe2ba1f2067e2d14190ab93 Mon Sep 17 00:00:00 2001
From: megumin <megumin.bakaretsurie@gmail.com>
Date: Fri, 25 Nov 2022 22:38:55 +0000
Subject: feat(settings): new settings design (#261)

---
 src/plugins/settings.tsx | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

(limited to 'src/plugins/settings.tsx')

diff --git a/src/plugins/settings.tsx b/src/plugins/settings.tsx
index ec42956..2777572 100644
--- a/src/plugins/settings.tsx
+++ b/src/plugins/settings.tsx
@@ -19,8 +19,11 @@
 import gitHash from "~git-hash";
 
 import { Devs } from "../utils/constants";
+import { LazyComponent } from "../utils/misc";
 import definePlugin from "../utils/types";
 
+const SettingsComponent = LazyComponent(() => require("../components/VencordSettings").default);
+
 export default definePlugin({
     name: "Settings",
     description: "Adds Settings UI and debug info",
@@ -42,13 +45,15 @@ export default definePlugin({
         replacement: {
             match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/,
             replace: (m, mod) => {
-                const updater = !IS_WEB ? '{section:"VencordUpdater",label:"Updater",element:Vencord.Components.Updater},' : "";
-                const patchHelper = IS_DEV ? '{section:"VencordPatchHelper",label:"PatchHelper",element:Vencord.Components.PatchHelper},' : "";
+                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:"VencordSetting",label:"Vencord",element:Vencord.Components.Settings},' +
-                    '{section:"VencordPlugins",label:"Plugins",element:Vencord.Components.PluginSettings},' +
+                    '{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}`
                 );
@@ -56,6 +61,14 @@ export default definePlugin({
         }
     }],
 
+    tabs: {
+        vencord: () => <SettingsComponent tab="VencordSettings" />,
+        plugins: () => <SettingsComponent tab="VencordPlugins" />,
+        themes: () => <SettingsComponent tab="VencordThemes" />,
+        updater: () => <SettingsComponent tab="VencordUpdater" />,
+        sync: () => <SettingsComponent tab="VencordSettingsSync" />
+    },
+
     get electronVersion() {
         return VencordNative.getVersions().electron || window.armcord?.electron || null;
     },
-- 
cgit 

