Lib: Add "Select Random" button to RacePickCard
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 26s

This commit is contained in:
2025-02-07 00:04:40 +01:00
parent 88fb24a20c
commit 91fc3ae7a2

View File

@ -84,6 +84,18 @@
const img: HTMLImageElement = document.getElementById("headshot_preview") as HTMLImageElement;
if (img) img.src = src;
});
const random_select_handler = (event: Event): void => {
pxx_select_value =
active_drivers_and_substitutes[
Math.floor(Math.random() * active_drivers_and_substitutes.length)
].id;
dnf_select_value =
active_drivers_and_substitutes[
Math.floor(Math.random() * active_drivers_and_substitutes.length)
].id;
};
</script>
{#await Promise.all([data.graphics, data.drivers]) then [graphics, drivers]}
@ -136,6 +148,10 @@
DNF
</Dropdown>
<Button color="tertiary" {disabled} width="w-full" onclick={random_select_handler}>
Select Random
</Button>
<!-- Save/Delete buttons -->
<div class="flex justify-end gap-2">
{#if racepick}