diff --git a/src/components/Bracket.svelte b/src/components/Bracket.svelte index 54e0656..0acfd73 100644 --- a/src/components/Bracket.svelte +++ b/src/components/Bracket.svelte @@ -20,11 +20,11 @@ matches: Matches; bracket: Brackets; teams: Teams; - readonly: Boolean; + readOnly: Boolean; } = $props(); let rounds: Record = $state({}); - let numRounds = 0; + let numRounds = $state(0); function determineRounds() { const newRounds: Record = {}; @@ -73,6 +73,7 @@ error('Failed to create matches'); } else { subscribeToMatches(); + await bracket.load(); } } catch (err) { error((err as HttpError).toString()); diff --git a/src/components/Teams.svelte b/src/components/Teams.svelte index ee04700..434cbd5 100644 --- a/src/components/Teams.svelte +++ b/src/components/Teams.svelte @@ -7,6 +7,11 @@ let { teams = $bindable() }: { teams: Teams } = $props(); async function createTeam() { + if (teams.teams.findIndex((team) => team.name === newTeamName) !== -1) { + error('Team already exists'); + return; + } + try { const newTeam: Partial = { name: newTeamName, @@ -44,7 +49,7 @@
Teams:
- A list of your recent invoices. + A list of your teams. {#each teams?.teams as team} diff --git a/src/routes/protected-routes/events/[slug]/+page.svelte b/src/routes/protected-routes/events/[slug]/+page.svelte index 254c2ed..bdfbfa9 100644 --- a/src/routes/protected-routes/events/[slug]/+page.svelte +++ b/src/routes/protected-routes/events/[slug]/+page.svelte @@ -13,7 +13,6 @@ import { closeModal } from '$lib/helper.svelte'; let { data = $bindable() }: { data: PageData } = $props(); - let { tournament, bracket, teams, matches, defaultTeam } = $state(data); let open = $state($page.state.showModal); @@ -35,9 +34,9 @@ > {#if $page.state.type === 'pool'} - + {:else} - + {/if} @@ -82,7 +81,13 @@ Update pool play match results - + @@ -93,7 +98,12 @@ Current standings based on pool play results - + @@ -104,7 +114,13 @@ Single/Double elim bracket - +