Settings: Give vencord sections classes so themes can match them

This commit is contained in:
V 2023-08-12 02:59:24 +02:00
parent 54cbdfdad0
commit 243381fc91
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -19,7 +19,6 @@
import { addContextMenuPatch } from "@api/ContextMenu"; import { addContextMenuPatch } from "@api/ContextMenu";
import { Settings } from "@api/Settings"; import { Settings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { React, SettingsRouter } from "@webpack/common"; import { React, SettingsRouter } from "@webpack/common";
@ -66,16 +65,11 @@ export default definePlugin({
case "top": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.USER_SETTINGS\}/; case "top": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.USER_SETTINGS\}/;
case "aboveNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.BILLING_SETTINGS\}/; case "aboveNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.BILLING_SETTINGS\}/;
case "belowNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.APP_SETTINGS\}/; case "belowNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.APP_SETTINGS\}/;
case "aboveActivity": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/;
case "belowActivity": return /(?<=\{section:(.{1,2})\.ID\.DIVIDER},)\{section:"changelog"/; case "belowActivity": return /(?<=\{section:(.{1,2})\.ID\.DIVIDER},)\{section:"changelog"/;
case "bottom": return /\{section:(.{1,2})\.ID\.CUSTOM,\s*element:.+?}/; case "bottom": return /\{section:(.{1,2})\.ID\.CUSTOM,\s*element:.+?}/;
default: { case "aboveActivity":
new Logger("Settings").error( default:
new Error("No switch case matched????? Don't mess with the settings, silly") return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/;
);
// matches nothing
return /(?!a)a/;
}
} }
}, },
replace: "...$self.makeSettingsCategories($1),$&" replace: "...$self.makeSettingsCategories($1),$&"
@ -88,48 +82,57 @@ export default definePlugin({
return [ return [
{ {
section: ID.HEADER, section: ID.HEADER,
label: "Vencord" label: "Vencord",
className: "vc-settings-header"
}, },
{ {
section: "VencordSettings", section: "VencordSettings",
label: "Vencord", label: "Vencord",
element: require("@components/VencordSettings/VencordTab").default element: require("@components/VencordSettings/VencordTab").default,
className: "vc-settings"
}, },
{ {
section: "VencordPlugins", section: "VencordPlugins",
label: "Plugins", label: "Plugins",
element: require("@components/VencordSettings/PluginsTab").default, element: require("@components/VencordSettings/PluginsTab").default,
className: "vc-plugins"
}, },
{ {
section: "VencordThemes", section: "VencordThemes",
label: "Themes", label: "Themes",
element: require("@components/VencordSettings/ThemesTab").default, element: require("@components/VencordSettings/ThemesTab").default,
className: "vc-themes"
}, },
!IS_WEB && { !IS_WEB && {
section: "VencordUpdater", section: "VencordUpdater",
label: "Updater", label: "Updater",
element: require("@components/VencordSettings/UpdaterTab").default, element: require("@components/VencordSettings/UpdaterTab").default,
className: "vc-updater"
}, },
{ {
section: "VencordCloud", section: "VencordCloud",
label: "Cloud", label: "Cloud",
element: require("@components/VencordSettings/CloudTab").default, element: require("@components/VencordSettings/CloudTab").default,
className: "vc-cloud"
}, },
{ {
section: "VencordSettingsSync", section: "VencordSettingsSync",
label: "Backup & Restore", label: "Backup & Restore",
element: require("@components/VencordSettings/BackupAndRestoreTab").default, element: require("@components/VencordSettings/BackupAndRestoreTab").default,
className: "vc-backup-restore"
}, },
IS_DEV && { IS_DEV && {
section: "VencordPatchHelper", section: "VencordPatchHelper",
label: "Patch Helper", label: "Patch Helper",
element: require("@components/VencordSettings/PatchHelperTab").default, element: require("@components/VencordSettings/PatchHelperTab").default,
className: "vc-patch-helper"
}, },
// TODO: make this use customSections // TODO: make this use customSections
IS_VENCORD_DESKTOP && { IS_VENCORD_DESKTOP && {
section: "VencordDesktop", section: "VencordDesktop",
label: "Desktop Settings", label: "Desktop Settings",
element: VencordDesktop.Components.Settings, element: VencordDesktop.Components.Settings,
className: "vc-desktop-settings"
}, },
...this.customSections.map(func => func(ID)), ...this.customSections.map(func => func(ID)),
{ {