diff --git a/src/components/SettingsInput.svelte b/src/components/SettingsInput.svelte new file mode 100644 index 0000000..f95650b --- /dev/null +++ b/src/components/SettingsInput.svelte @@ -0,0 +1,58 @@ + + + + + + + + {#if suffix} + {suffix} + {/if} + + + {#if helpText} + {helpText} + {/if} + + diff --git a/src/components/SettingsSelect.svelte b/src/components/SettingsSelect.svelte new file mode 100644 index 0000000..ef34fec --- /dev/null +++ b/src/components/SettingsSelect.svelte @@ -0,0 +1,34 @@ + + + + + + + {#each options as [key, val]} + + {/each} + + {#if helpText} + {helpText} + {/if} + + diff --git a/src/components/SettingsSwitch.svelte b/src/components/SettingsSwitch.svelte new file mode 100644 index 0000000..27a3156 --- /dev/null +++ b/src/components/SettingsSwitch.svelte @@ -0,0 +1,15 @@ + + + + + diff --git a/src/routes/Settings.svelte b/src/routes/Settings.svelte index fe9591c..fe8a084 100644 --- a/src/routes/Settings.svelte +++ b/src/routes/Settings.svelte @@ -3,6 +3,7 @@ import { PUBLIC_BASE_URL } from '$lib/config'; import { uiSettings } from '$lib/uiSettings'; import { createEventDispatcher } from 'svelte'; + import SettingsSwitch from '../components/SettingsSwitch.svelte'; import { _ } from 'svelte-i18n'; import { @@ -13,12 +14,6 @@ CardTitle, Col, Form, - FormText, - Input, - InputGroup, - InputGroupText, - Label, - Tooltip, Row } from '@sveltestrap/sveltestrap'; @@ -27,6 +22,8 @@ import { derived } from 'svelte/store'; import ToggleHeader from '../components/ToggleHeader.svelte'; + import SettingsInput from '../components/SettingsInput.svelte'; + import SettingsSelect from '../components/SettingsSelect.svelte'; export let settings; @@ -156,7 +153,7 @@ } }; - const checkValidNostrPubkey = (key) => { + const checkValidNostrPubkey = (key: string) => { if (isValidNpub($settings[key])) { dispatch('showToast', { color: 'info', @@ -258,6 +255,7 @@ {$_('section.settings.title', { default: 'Settings' })} +
@@ -267,107 +265,86 @@ isOpen={screenSettingsIsOpen} > - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + {#if !$settings.actCurrencies} - - - + {/if}
{$_('section.settings.screens')}
{#if $settings.screens} {#each $settings.screens as s} - - - + {/each} {/if}
@@ -401,217 +378,157 @@ header={$_('section.settings.section.displaysAndLed')} isOpen={displaysAndLedIsOpen} > - - - - - - - - - + + + + + + + + + + + {#if $settings.hasFrontlight && !$settings.flDisable} + + + + {/if} + + {#if !$settings.flDisable && $settings.hasLightLevel} + + {/if} - - - - - {$_('time.minutes')} - - - - - - - - - {$_('time.minutes')} - - - - - - - - - {$_('time.seconds')} - - {$_('section.settings.shortAmountsWarning')} - - - - - - - - - {#if $settings.hasFrontlight && !$settings.flDisable} - - - - - - - - - - - - - {/if} - {#if !$settings.flDisable && $settings.hasLightLevel} - - - - - {$_('section.settings.luxLightToggleText')} - - - {/if} - - - - - - - - - - + + + + + + {#if $settings.hasFrontlight} - - - + {/if} + {#if $settings.hasFrontlight && !$settings.flDisable} - - - - - - - - - + + + + + {/if} @@ -620,69 +537,40 @@ header={$_('section.settings.section.dataSource')} isOpen={dataSourceIsOpen} > + + - - - - - - - HTTPS - - - {$_('section.settings.mempoolInstanceHelpText')} - - - - - - + + {#if $settings.nostrRelay} - - - - {$_('section.settings.useNostrTooltip')} - - + {/if} + {#if 'stagingSource' in $settings} - - - + {/if} @@ -692,334 +580,213 @@ isOpen={extraFeaturesIsOpen} > {#if $settings.bitaxeEnabled} - - + - - - - - - - + {/if} {#if $settings.miningPoolStats} - - - - - {#each $settings.availablePools as pool} - - {/each} - - - - - - - - - + [getMiningPoolName(pool), pool])} + size={$uiSettings.inputSize} + selectClass={$uiSettings.selectClass} + /> + {/if} {#if 'nostrZapNotify' in $settings && $settings['nostrZapNotify']} - - - - checkValidNostrPubkey('nostrZapPubkey')} - invalid={!isValidHexPubKey($settings.nostrZapPubkey)} - bsSize={$uiSettings.inputSize} - required - minlength="64" - > - {#if !isValidHexPubKey($settings.nostrZapPubkey)} - {$_('section.settings.invalidNostrPubkey')} - {/if} - - + checkValidNostrPubkey('nostrZapPubkey')} + /> {/if} {#if $settings.useNostr} - - - - checkValidNostrPubkey('nostrPubKey')} - invalid={!isValidHexPubKey($settings.nostrPubKey)} - bsSize={$uiSettings.inputSize} - > - {#if !isValidHexPubKey($settings.nostrPubKey)} - {$_('section.settings.invalidNostrPubkey')} - {/if} - - + checkValidNostrPubkey('nostrPubKey')} + /> {/if} {#if 'nostrZapNotify' in $settings || $settings.useNostr} - - + - - - - - - - + {/if} {#if 'bitaxeEnabled' in $settings} - - - + {/if} {#if 'miningPoolStats' in $settings} - - - + {/if} {#if 'nostrZapNotify' in $settings} - - - - - - + + {#if $settings.hasFrontlight && !$settings.flDisable} - - - + {/if} {/if}
- - + - - - - {$_('time.minutes')} - - - {$_('section.settings.tzOffsetHelpText')} - - + + {#if $settings.httpAuthEnabled} - - + + - - {$_('section.settings.httpAuthText')} - - + {#if !showPassword}{:else}{/if} + + {/if} + + + + + + + - - - - - - - - - - {#each wifiTxPowerMap as [key, value]} - - {/each} - - {$_('section.settings.wifiTxPowerText')} - - - - - - - - {$_('time.seconds')} - - - - - - - - - - - - - + + +