chore: review changes
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful

This commit is contained in:
Temmie 2025-08-15 13:05:36 +02:00
parent baff4de406
commit 2da62b2e94
Signed by: temmie
SSH key fingerprint: SHA256:nBO+OwpTkd8LYhe38PIqdxmDvkIg9Vw2EbrRZM97dkU
4 changed files with 9 additions and 10 deletions

View file

@ -6,8 +6,8 @@
<div class="icons">
<RadioButtons
:text-strings="timeFormatTextStrings"
:default-button-key='settingsLoad().timeFormat ?? "Auto"'
:callback="(index: number) => {settingSave('timeFormat', timeFormatTextStrings[index])}"
:default-button-key='settingsLoad().timeFormat || "Auto"'
:callback="(index: number) => { settingSave('timeFormat', timeFormatTextStrings[index]) }"
/>
</div>

View file

@ -28,7 +28,7 @@ onMounted(async () => {
const children = radioButtonsContainer.value.children
// set the button based on key
if (props.defaultButtonKey != undefined) {
if (props.defaultButtonKey) {
const newIndex = props.textStrings.indexOf(props.defaultButtonKey)
const defaultButton = children.item(newIndex)
if (defaultButton) {
@ -49,10 +49,9 @@ function onClick(clickedIndex: number) {
if (radioButtonsContainer.value) {
// remove selected-radio-button class from all buttons except the clicked one
const children = radioButtonsContainer.value.children
for (let i = 0; i < children.length; i++) {
const button = children.item(i)
for (const button of children) {
if (button) {
unSelectButton(button)
unselectButton(button)
}
}
@ -65,7 +64,7 @@ function onClick(clickedIndex: number) {
props.callback(clickedIndex)
}
function unSelectButton(button: Element) {
function unselectButton(button: Element) {
button.classList.remove("selected-radio-button")
button.children.item(0)?.classList.remove("selected-radio-button-radio")
}