feat: add support to select default radio button based on key
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful

also simplifies the radio button code, making it easier to parse
This commit is contained in:
Twig 2025-08-11 22:08:14 +02:00
parent e1f30ba9a8
commit 446038d37f
Signed by: twig
SSH key fingerprint: SHA256:nBO+OwpTkd8LYhe38PIqdxmDvkIg9Vw2EbrRZM97dkU
2 changed files with 45 additions and 20 deletions

View file

@ -5,9 +5,8 @@
<p class="subtitle">TIME FORMAT</p>
<div class="icons">
<RadioButtons
:button-count="3"
:text-strings="timeFormatTextStrings"
:default-button-index="timeFormatSelectedIndex"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
:callback="(index: number) => {settingSave('timeFormat', timeFormatTextStrings[index])}"
/>
</div>
@ -20,7 +19,6 @@ import RadioButtons from '~/components/UserInterface/RadioButtons.vue';
import type { TimeFormat } from '~/types/settings';
const timeFormatTextStrings: TimeFormat[] = ["Auto", "4:18 PM", "16:18"]
const timeFormatSelectedIndex = timeFormatTextStrings.indexOf(settingsLoad().timeFormat ?? "Auto")
</script>