error proof settings ui

This commit is contained in:
Vendicated
2025-10-16 13:57:15 +02:00
parent 5734a1d33c
commit 40d9cba2f0
3 changed files with 49 additions and 43 deletions

View File

@@ -4,23 +4,26 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { ErrorBoundary } from "@vencord/types/components";
import { Select } from "@vencord/types/webpack/common"; import { Select } from "@vencord/types/webpack/common";
import { SettingsComponent } from "./Settings"; import { SettingsComponent } from "./Settings";
export const DiscordBranchPicker: SettingsComponent = ({ settings }) => { export const DiscordBranchPicker: SettingsComponent = ({ settings }) => {
return ( return (
<Select <ErrorBoundary noop>
placeholder="Stable" <Select
options={[ placeholder="Stable"
{ label: "Stable", value: "stable", default: true }, options={[
{ label: "Canary", value: "canary" }, { label: "Stable", value: "stable", default: true },
{ label: "PTB", value: "ptb" } { label: "Canary", value: "canary" },
]} { label: "PTB", value: "ptb" }
closeOnSelect={true} ]}
select={v => (settings.discordBranch = v)} closeOnSelect={true}
isSelected={v => v === settings.discordBranch} select={v => (settings.discordBranch = v)}
serialize={s => s} isSelected={v => v === settings.discordBranch}
/> serialize={s => s}
/>
</ErrorBoundary>
); );
}; };

View File

@@ -179,12 +179,12 @@ function SettingsSections() {
export default ErrorBoundary.wrap( export default ErrorBoundary.wrap(
function SettingsUI() { function SettingsUI() {
return ( return (
<Forms.FormSection> <section>
<Text variant="heading-xl/semibold" color="header-primary" className="vcd-settings-title"> <Text variant="heading-xl/semibold" color="header-primary" className="vcd-settings-title">
Vesktop Settings Vesktop Settings
</Text> </Text>
<SettingsSections /> <SettingsSections />
</Forms.FormSection> </section>
); );
}, },
{ {

View File

@@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { ErrorBoundary } from "@vencord/types/components";
import { Margins } from "@vencord/types/utils"; import { Margins } from "@vencord/types/utils";
import { Forms, Select } from "@vencord/types/webpack/common"; import { Forms, Select } from "@vencord/types/webpack/common";
@@ -13,35 +14,37 @@ export const WindowsTransparencyControls: SettingsComponent = ({ settings }) =>
if (!VesktopNative.app.supportsWindowsTransparency()) return null; if (!VesktopNative.app.supportsWindowsTransparency()) return null;
return ( return (
<div> <ErrorBoundary noop>
<Forms.FormTitle className={Margins.bottom8}>Transparency Options</Forms.FormTitle> <div>
<Forms.FormText className={Margins.bottom8}> <Forms.FormTitle className={Margins.bottom8}>Transparency Options</Forms.FormTitle>
Requires a full restart. You will need a theme that supports transparency for this to work. <Forms.FormText className={Margins.bottom8}>
</Forms.FormText> Requires a full restart. You will need a theme that supports transparency for this to work.
</Forms.FormText>
<Select <Select
placeholder="None" placeholder="None"
options={[ options={[
{ {
label: "None", label: "None",
value: "none", value: "none",
default: true default: true
}, },
{ {
label: "Mica (incorporates system theme + desktop wallpaper to paint the background)", label: "Mica (incorporates system theme + desktop wallpaper to paint the background)",
value: "mica" value: "mica"
}, },
{ label: "Tabbed (variant of Mica with stronger background tinting)", value: "tabbed" }, { label: "Tabbed (variant of Mica with stronger background tinting)", value: "tabbed" },
{ {
label: "Acrylic (blurs the window behind Vesktop for a translucent background)", label: "Acrylic (blurs the window behind Vesktop for a translucent background)",
value: "acrylic" value: "acrylic"
} }
]} ]}
closeOnSelect={true} closeOnSelect={true}
select={v => (settings.transparencyOption = v)} select={v => (settings.transparencyOption = v)}
isSelected={v => v === settings.transparencyOption} isSelected={v => v === settings.transparencyOption}
serialize={s => s} serialize={s => s}
/> />
</div> </div>
</ErrorBoundary>
); );
}; };