generated from schreifuchs/wails-template
47 lines
1.2 KiB
Svelte
47 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
import { run } from "svelte/legacy";
|
|
|
|
import { Link, navigate } from "svelte-routing";
|
|
import { GetTournament } from "../../wailsjs/go/main/App";
|
|
import { model } from "../../wailsjs/go/models";
|
|
import { onMount } from "svelte";
|
|
import { Button, Heading, TabItem, Tabs } from "flowbite-svelte";
|
|
import Participants from "./Participants.svelte";
|
|
import Matches from "./Matches.svelte";
|
|
|
|
interface Props {
|
|
id?: number | null;
|
|
}
|
|
|
|
let { id = $bindable(null) }: Props = $props();
|
|
let tournament: model.Tournament = $state();
|
|
|
|
function update() {
|
|
GetTournament(id).then((t) => {
|
|
console.log(t);
|
|
tournament = t;
|
|
});
|
|
}
|
|
run(() => {
|
|
id = id;
|
|
update();
|
|
});
|
|
onMount(update);
|
|
</script>
|
|
|
|
<div></div>
|
|
{#if tournament}
|
|
<section class="grid grid-cols-2 p-5">
|
|
<Heading>{tournament.Title}</Heading>
|
|
<Button on:click={() => navigate("/", { replace: true })}>Export</Button>
|
|
</section>
|
|
<Tabs>
|
|
<TabItem open title="Participants">
|
|
<Participants tournamentID={tournament.ID} />
|
|
</TabItem>
|
|
<TabItem title="Matches">
|
|
<Matches tournamentID={tournament.ID} />
|
|
</TabItem>
|
|
</Tabs>
|
|
{/if}
|