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,33 +19,40 @@
-->
<script lang="ts">
import {window} from "./utils.ts";
import {t} from "astro-i18n";
import type {ExtendedEvent} from "@type/event.ts";
import "@styles/table.css"
import { window } from "./utils.ts";
import { t } from "astro-i18n";
import type { ExtendedEvent } from "@type/event.ts";
import "@styles/table.css";
export let event: ExtendedEvent;
export let group: string;
export let group: number;
export let rows: number = 1;
$: teamPoints = event.teams.map(team => {
const fights = event.fights.filter(fight => fight.blueTeam.id === team.id || fight.redTeam.id === team.id);
const points = fights.reduce((acc, fight) => {
if (fight.ergebnis === 1 && fight.blueTeam.id === team.id) {
return acc + 3;
} else if (fight.ergebnis === 2 && fight.redTeam.id === team.id) {
return acc + 3;
} else if (fight.ergebnis === 3) {
return acc + 1;
} else {
return acc;
$: teamPoints = event.teams
.map((team) => {
let fights = event.fights.filter((fight) => fight.blueTeam.id === team.id || fight.redTeam.id === team.id);
if (group !== undefined) {
fights = fights.filter((fight) => fight.group?.id === group);
}
}, 0);
return {
team,
points,
};
}).sort((a, b) => b.points - a.points);
const points = fights.reduce((acc, fight) => {
if (fight.ergebnis === 1 && fight.blueTeam.id === team.id) {
return acc + (fight.group?.pointsPerWin ?? 3);
} else if (fight.ergebnis === 2 && fight.redTeam.id === team.id) {
return acc + (fight.group?.pointsPerWin ?? 3);
} else if (fight.ergebnis === 3) {
return acc + (fight.group?.pointsPerDraw ?? 1);
} else {
return acc + (fight.group?.pointsPerLoss ?? 0);
}
}, 0);
return {
team,
points,
};
})
.sort((a, b) => b.points - a.points);
</script>
<div class="p-3 bg-gray-200 dark:bg-neutral-800 rounded-2xl w-3/4 mx-auto">