Skip to content

Commit

Permalink
remove context code
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Aug 12, 2024
1 parent cac2050 commit fd2633f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/components/EditMatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import type { Brackets } from '$lib/brackets/brackets.svelte';
import type { Teams } from '$lib/teams.svelte';
import { error } from '@sveltejs/kit';
import { getContext } from 'svelte';
import type { Pool } from '$lib/pool/pool.svelte';
let { matchId, matches }: { matchId: number; matches: Pool | Brackets } = $props();
const teams = getContext('teams') as Teams;
let { matchId, matches, teams }: { matchId: number; matches: Pool | Brackets; teams: Teams } =
$props();
let match = $derived(matches?.matches?.find((m) => m.id === matchId));
Expand Down
12 changes: 10 additions & 2 deletions src/routes/events/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@
<AlertDialog.Content>
{#if $page.state.type === 'pool'}
{#if data.matches}
<EditMatch matchId={$page.state.matchId as number} matches={data.matches} />
<EditMatch
matchId={$page.state.matchId as number}
matches={data.matches}
teams={data.teams}
/>
{/if}
{:else if data.bracket}
<EditMatch matchId={$page.state.matchId as number} matches={data.bracket} />
<EditMatch
matchId={$page.state.matchId as number}
matches={data.bracket}
teams={data.teams}
/>
{/if}
</AlertDialog.Content>
</AlertDialog.Root>
Expand Down

0 comments on commit fd2633f

Please sign in to comment.