server/frontend/ui/src/routes/rank.svelte

53 lines
1.4 KiB
Svelte
Raw Normal View History

<script>
import {
Alert,
Card,
CardBody,
CardTitle,
Col,
Container,
Icon,
Row,
} from 'sveltestrap';
import { my } from '../stores/my.js';
import { rank } from '../stores/teams.js';
2022-05-01 20:33:59 +00:00
import { challengeInfo } from '../stores/challengeinfo.js';
import CardTheme from '../components/CardTheme.svelte';
let search = "";
</script>
<Container fluid class="my-3">
2021-08-31 23:47:44 +00:00
<h1 class="text-dark">
2022-05-01 20:33:59 +00:00
{$challengeInfo.title}
<small class="text-muted">Classement</small>
</h1>
<div class="card niceborder text-light">
<div class="card-body">
<input type="text" class="form-control" placeholder="Rechercher" bind:value={search}>
</div>
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Rang</th>
<th>Équipe</th>
<th>Points</th>
</tr>
</thead>
<tbody>
{#each $rank as team (team.id)}
{#if team.rank != 0 || ($my && $my.team_id == team.id)}
<tr class:bg-info={$my && $my.team_id == team.id} class:bg-warning={search.length && team.name.toLowerCase().indexOf(search.toLowerCase()) >= 0}>
<td>{team.rank}</td>
<td>{team.name}</td>
2021-09-02 09:15:35 +00:00
<td>{Math.round(team.score*100)/100}</td>
</tr>
{/if}
{/each}
</tbody>
</table>
</div>
</Container>