From a397f18ec97d462e5fc4ab086ce664897a4551f0 Mon Sep 17 00:00:00 2001 From: Justin Chung <20733699+justin13888@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:43:48 -0500 Subject: [PATCH] Organized Vesktop settings page --- src/renderer/components/Settings.tsx | 156 +++++++++++++++++++++++---- 1 file changed, 135 insertions(+), 21 deletions(-) diff --git a/src/renderer/components/Settings.tsx b/src/renderer/components/Settings.tsx index eb0387f..7badbb3 100644 --- a/src/renderer/components/Settings.tsx +++ b/src/renderer/components/Settings.tsx @@ -20,11 +20,17 @@ export default function SettingsUi() { const { autostart } = VesktopNative; const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); - const allSwitches: Array boolean)?]> = [ + type SettingsCategory = "System" | "Performance" | "User Interface" | "Notifications"; + const allSwitches: Array< + false | [keyof typeof Settings, string, string, boolean?, (() => boolean)?, SettingsCategory?] + > = [ [ "customTitleBar", "Discord Titlebar", - "Use Discord's custom title bar instead of the native system one. Requires a full restart." + "Use Discord's custom title bar instead of the native system one. Requires a full restart.", + undefined, + undefined, + "User Interface" ], !isMac && ["tray", "Tray Icon", "Add a tray icon for Vesktop", true], !isMac && [ @@ -32,29 +38,57 @@ export default function SettingsUi() { "Minimize to tray", "Hitting X will make Vesktop minimize to the tray instead of closing", true, - () => Settings.tray ?? true + () => Settings.tray ?? true, + "User Interface" ], ["arRPC", "Rich Presence", "Enables Rich Presence via arRPC", false], [ "disableMinSize", "Disable minimum window size", - "Allows you to make the window as small as your heart desires" + "Allows you to make the window as small as your heart desires", + undefined, + undefined, + undefined ], ["staticTitle", "Static Title", 'Makes the window title "Vesktop" instead of changing to the current page'], [ "enableMenu", "Enable Menu Bar", - "Enables the application menu bar. Press ALT to toggle visibility. Incompatible with 'Discord Titlebar'" + "Enables the application menu bar. Press ALT to toggle visibility. Incompatible with 'Discord Titlebar'", + undefined, + undefined, + "User Interface" + ], + [ + "disableSmoothScroll", + "Disable smooth scrolling", + "Disables smooth scrolling in Vesktop", + false, + undefined, + "User Interface" + ], + [ + "hardwareAcceleration", + "Hardware Acceleration", + "Enable hardware acceleration", + true, + undefined, + "Performance" + ], + [ + "splashTheming", + "Splash theming", + "Adapt the splash window colors to your custom theme", + false, + undefined, + "User Interface" ], - ["disableSmoothScroll", "Disable smooth scrolling", "Disables smooth scrolling in Vesktop", false], - ["hardwareAcceleration", "Hardware Acceleration", "Enable hardware acceleration", true], - ["splashTheming", "Splash theming", "Adapt the splash window colors to your custom theme", false], [ "openLinksWithElectron", "Open Links in app (experimental)", "Opens links in a new Vesktop window instead of your web browser" ], - ["checkUpdates", "Check for updates", "Automatically check for Vesktop updates", true] + ["checkUpdates", "Check for updates", "Automatically check for Vesktop updates", true, undefined, "System"] ]; const switches = allSwitches.filter(isTruthy); @@ -81,6 +115,15 @@ export default function SettingsUi() { + + System Startup & Performance + + { @@ -92,6 +135,52 @@ export default function SettingsUi() { Start With System + {switches + .filter(item => item[5] === "System" || item[5] === "Performance") + .map(([key, text, note, def, predicate]) => ( + (Settings[key as any] = v)} + note={note} + key={key} + > + {text} + + ))} + + + User Interface & Experience + + + {switches + .filter(item => item[5] === "User Interface") + .map(([key, text, note, def, predicate]) => ( + (Settings[key as any] = v)} + note={note} + key={key} + > + {text} + + ))} + + + Notifications & Updates + + { @@ -104,18 +193,6 @@ export default function SettingsUi() { Notification Badge - {switches.map(([key, text, note, def, predicate]) => ( - (Settings[key as any] = v)} - note={note} - key={key} - > - {text} - - ))} - {supportsWindowsTransparency && ( <> @@ -153,6 +230,43 @@ export default function SettingsUi() { )} + {switches + .filter(item => item[5] === "Notifications") + .map(([key, text, note, def, predicate]) => ( + (Settings[key as any] = v)} + note={note} + key={key} + > + {text} + + ))} + + + Miscellaneous + + + {switches + .filter(item => item[5] === undefined) + .map(([key, text, note, def, predicate]) => ( + (Settings[key as any] = v)} + note={note} + key={key} + > + {text} + + ))} + Vencord Location Vencord files are loaded from{" "}