From 4fc41c8c0b1acf5f161a3589f9ad02edb17ebb3b Mon Sep 17 00:00:00 2001 From: megumin Date: Sun, 27 Nov 2022 15:07:31 +0000 Subject: fix: add predicate to updater menu item (#266) * fix: add predicate to updater menu item * dont include Updater in web builds * i can spell --- src/components/VencordSettings/index.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/VencordSettings/index.tsx b/src/components/VencordSettings/index.tsx index 3701897..028bd5e 100644 --- a/src/components/VencordSettings/index.tsx +++ b/src/components/VencordSettings/index.tsx @@ -39,19 +39,25 @@ interface SettingsProps { tab: string; } -const SettingsTabs = { +interface SettingsTab { + name: string; + component?: React.ComponentType; +} + +const SettingsTabs: Record = { VencordSettings: { name: "Vencord", component: () => }, VencordPlugins: { name: "Plugins", component: () => }, VencordThemes: { name: "Themes", component: () => Coming soon to a Vencord near you! }, - VencordUpdater: { name: "Updater", component: () => Updater ? : null }, + VencordUpdater: { name: "Updater" }, // Only show updater if IS_WEB is false VencordSettingsSync: { name: "Backup & Restore", component: () => }, }; +if (!IS_WEB) SettingsTabs.VencordUpdater.component = () => Updater && ; function Settings(props: SettingsProps) { const { tab = "VencordSettings" } = props; - const CurrentTab = SettingsTabs[tab]?.component ?? null; + const CurrentTab = SettingsTabs[tab]?.component; return Vencord Settings @@ -63,7 +69,8 @@ function Settings(props: SettingsProps) { selectedItem={tab} onItemSelect={Router.open} > - {Object.entries(SettingsTabs).map(([key, { name }]) => { + {Object.entries(SettingsTabs).map(([key, { name, component }]) => { + if (!component) return null; return - + {CurrentTab && } ; } -- cgit