Skip to content

Commit

Permalink
allow deselect of defaultTeam
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Jan 19, 2024
1 parent be903c9 commit b67f135
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/lib/components/tournament/Standings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
TableBodyCell,
TableBodyRow,
TableHead,
TableHeadCell,
Checkbox,
TableSearch
TableHeadCell
} from 'flowbite-svelte';
export let event: Event;
export let matches: Matches;
export let teams: Teams;
export let defaultTeam: string;
interface TeamScores {
[key: string]: number;
Expand Down Expand Up @@ -48,7 +47,9 @@ Scoring based on {scoring}
</TableHead>
<TableBody>
{#each { length: orderedTeamScores.length } as _, i}
<TableBodyRow>
{@const isDefaultTeam =
defaultTeam && defaultTeam === orderedTeamScores[i] ? 'bg-green-200' : ''}
<TableBodyRow class={isDefaultTeam}>
<TableBodyCell>{i}</TableBodyCell>
<TableBodyCell>{orderedTeamScores[i]}</TableBodyCell>
<TableBodyCell>{teamScores[orderedTeamScores[i]]}</TableBodyCell>
Expand Down
10 changes: 6 additions & 4 deletions src/routes/events/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
Select a team:
<Select
class="mt-2"
items={teams.teams.map((team) => {
return { value: team.name, name: team.name };
})}
items={teams.teams
.map((team) => {
return { value: team.name, name: team.name };
})
.concat([{ value: '', name: 'none' }])}
bind:value={defaultTeam}
/>
</Label>
Expand All @@ -43,7 +45,7 @@
</TabItem>

<TabItem title="standings">
<Standings event={tournament} {matches} {teams} />
<Standings event={tournament} {matches} {teams} {defaultTeam} />
</TabItem>
</Tabs>
</div>
Expand Down

1 comment on commit b67f135

@vercel
Copy link

@vercel vercel bot commented on b67f135 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

volleyman – ./

volleyman-craigkai.vercel.app
volleyman.vercel.app
volleyman-git-main-craigkai.vercel.app

Please sign in to comment.