From 28a4590b86ebe44b07571020350aeb5671e94024 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 24 Feb 2024 17:54:02 -0800 Subject: [PATCH] feat: allow disabling setting buttons --- client/src/lib/Apps/Settings/SettingsToggle.svelte | 6 +++++- client/src/lib/Apps/Settings/Switch.svelte | 11 ++++++++--- client/src/lib/Loading/SvelteLogo.svelte | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/client/src/lib/Apps/Settings/SettingsToggle.svelte b/client/src/lib/Apps/Settings/SettingsToggle.svelte index 39b0229..35ac12f 100644 --- a/client/src/lib/Apps/Settings/SettingsToggle.svelte +++ b/client/src/lib/Apps/Settings/SettingsToggle.svelte @@ -4,6 +4,7 @@ @param setting - The setting to be toggled @param inverted? - If false, the toggle syncs to the setting (toggle = on, setting = true). If true, the toggle syncs to the setting's inverse (toggle = off, setting = true). @param tooltip - Helpful tooltip for the setting + @param disabled - Whether or not the setting is disabled @children The setting's label --> @@ -16,6 +17,7 @@ export let setting: keyof SettingsStoreData export let inverted: boolean = false export let tooltip: string = '' + export let disabled: boolean = false $: value = inverted ? !$settingsStore[setting] : $settingsStore[setting] @@ -24,4 +26,6 @@ } - + diff --git a/client/src/lib/Apps/Settings/Switch.svelte b/client/src/lib/Apps/Settings/Switch.svelte index 06dcc96..52e9381 100644 --- a/client/src/lib/Apps/Settings/Switch.svelte +++ b/client/src/lib/Apps/Settings/Switch.svelte @@ -3,14 +3,19 @@ export let checked: boolean export let tooltip: string + export let disabled: boolean = false -
+
- {#if tooltip !== ''} + {#if tooltip !== '' && !disabled} diff --git a/client/src/lib/Loading/SvelteLogo.svelte b/client/src/lib/Loading/SvelteLogo.svelte index c36e6b1..45e75a5 100644 --- a/client/src/lib/Loading/SvelteLogo.svelte +++ b/client/src/lib/Loading/SvelteLogo.svelte @@ -14,7 +14,7 @@ {#if visible} - +