67 lines
2.2 KiB
Svelte
67 lines
2.2 KiB
Svelte
<!-- @migration-task Error while migrating Svelte code: `<tr>` is invalid inside `<table>` -->
|
|
<!--
|
|
- This file is a part of the SteamWar software.
|
|
-
|
|
- Copyright (C) 2023 SteamWar.de-Serverteam
|
|
-
|
|
- This program is free software: you can redistribute it and/or modify
|
|
- it under the terms of the GNU Affero General Public License as published by
|
|
- the Free Software Foundation, either version 3 of the License, or
|
|
- (at your option) any later version.
|
|
-
|
|
- This program is distributed in the hope that it will be useful,
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
- GNU Affero General Public License for more details.
|
|
-
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
-->
|
|
|
|
<script lang="ts">
|
|
import { window } from "./utils.ts";
|
|
import { t } from "astro-i18n";
|
|
import type { ExtendedEvent } from "@type/event.ts";
|
|
import "@styles/table.css";
|
|
|
|
let {
|
|
event,
|
|
group,
|
|
rows = 1,
|
|
}: {
|
|
event: ExtendedEvent;
|
|
group: number;
|
|
rows?: number;
|
|
} = $props();
|
|
|
|
let teamPoints = $derived(
|
|
Object.entries(event.groups.find((g) => g.id === group)?.points ?? {}).map(([teamId, points]) => ({
|
|
team: event.teams.find((t) => t.id === Number(teamId))!!,
|
|
points: points,
|
|
}))
|
|
);
|
|
</script>
|
|
|
|
<div class="p-3 bg-gray-200 dark:bg-neutral-800 rounded-2xl w-3/4 mx-auto">
|
|
<table class="w-full">
|
|
<thead>
|
|
<tr class="font-bold border-b">
|
|
{#each Array(rows) as i (i)}
|
|
<td>{t("announcements.table.team")}</td>
|
|
<td>{t("announcements.table.points")}</td>
|
|
{/each}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{#each window(teamPoints, rows) as teams}
|
|
<tr>
|
|
{#each teams as team (team.team.id)}
|
|
<td>{team.team.name}</td>
|
|
<td>{team.points}</td>
|
|
{/each}
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|