Refactor FightTable and GroupTable components to use numeric group identifiers; enhance event handling in FightEdit and EventFightList; add new Pages management UI with editor tabs; improve event data handling and display logic; update event types to include hasFinished status; optimize announcement page rendering and structure.
Some checks failed
SteamWarCI Build failed

This commit is contained in:
2025-05-28 12:30:05 +02:00
parent 0205108d2d
commit 7d75453be5
16 changed files with 679 additions and 226 deletions

View File

@@ -19,25 +19,27 @@
-->
<script lang="ts">
import {window} from "./utils.ts";
import {astroI18n, t} from "astro-i18n";
import type {EventFight, ExtendedEvent} from "@type/event";
import { window } from "./utils.ts";
import { astroI18n, t } from "astro-i18n";
import type { EventFight, ExtendedEvent } from "@type/event";
import "@styles/table.css";
export let event: ExtendedEvent;
export let group: string;
export let group: number;
export let rows: number = 1;
function getWinner(fight: EventFight) {
if (!fight.hasFinished) {
return t("announcements.table.notPlayed");
}
switch (fight.ergebnis) {
case 1:
return fight.blueTeam.kuerzel;
case 2:
return fight.redTeam.kuerzel;
case 3:
return t("announcements.table.draw");
default:
return t("announcements.table.notPlayed");
return t("announcements.table.draw");
}
}
</script>
@@ -55,13 +57,15 @@
</tr>
</thead>
<tbody>
{#each window(event.fights.filter(f => group === undefined ? true : f.group === group), rows) as fights}
{#each window( event.fights.filter((f) => (group === undefined ? true : f.group?.id === group)), rows ) as fights}
<tr>
{#each fights as fight (fight.id)}
<td>{Intl.DateTimeFormat(astroI18n.locale, {
hour: "numeric",
minute: "numeric",
}).format(new Date(fight.start))}</td>
<td
>{Intl.DateTimeFormat(astroI18n.locale, {
hour: "numeric",
minute: "numeric",
}).format(new Date(fight.start))}</td
>
<td class:font-bold={fight.ergebnis === 1} class:italic={fight.ergebnis === 3}>{fight.blueTeam.kuerzel}</td>
<td class:font-bold={fight.ergebnis === 2} class:italic={fight.ergebnis === 3}>{fight.redTeam.kuerzel}</td>
<td>{getWinner(fight)}</td>
@@ -70,4 +74,4 @@
{/each}
</tbody>
</table>
</div>
</div>