Data: Disable "Create" buttons for non-admins

This commit is contained in:
2025-12-25 20:01:35 +01:00
parent 7434165ab0
commit 9bdf6ea8ef
5 changed files with 21 additions and 6 deletions

View File

@ -5,9 +5,12 @@
import { get_by_value } from "$lib/database";
import { PXX_COLORS } from "$lib/config";
import type { RaceResult } from "$lib/schema";
import { pbUser } from "$lib/pocketbase";
let { data }: { data: PageData } = $props();
let disabled: boolean = $derived(!$pbUser?.admin);
const modalStore: ModalStore = getModalStore();
const result_handler = async (event: Event, id?: string) => {
@ -92,7 +95,7 @@
</svelte:head>
<div class="pb-2">
<Button width="w-full" color="tertiary" onclick={result_handler} shadow>
<Button width="w-full" color="tertiary" onclick={result_handler} shadow {disabled}>
<span class="font-bold">Create Race Result</span>
</Button>
</div>