feat: Add roundRows configuration to group view and update event markdowns
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2026-01-01 16:23:13 +01:00
parent f507dce94a
commit fa7e68ca10
4 changed files with 40 additions and 15 deletions

View File

@@ -41,6 +41,20 @@
return rounds;
}
function chunkIntoRows<T>(items: T[], rowCount: number): T[][] {
if (!items || items.length === 0) return [];
const rows = Math.max(1, Math.floor(rowCount || 1));
const perRow = Math.ceil(items.length / rows);
const chunked: T[][] = [];
for (let i = 0; i < rows; i++) {
const slice = items.slice(i * perRow, (i + 1) * perRow);
if (slice.length) chunked.push(slice);
}
return chunked;
}
const hover = $teamHoverService;
</script>
@@ -48,6 +62,8 @@
{@const group = event.groups.find((g) => g.id === groupId)!!}
{@const fights = event.fights.filter((f) => f.group?.id === groupId)}
{@const rounds = detectRounds(fights)}
{@const roundRows = config.roundRows ?? 1}
{@const roundRowsChunked = chunkIntoRows(rounds, roundRows)}
<div class="flex">
<div>
<EventCard title={group.name}>
@@ -60,15 +76,22 @@
</EventCardOutline>
</EventCard>
</div>
{#each rounds as round, index}
{@const teams = Array.from(new Set(round.flatMap((f) => [f.redTeam, f.blueTeam])))}
<div class="{hover.currentHover && !teams.some((t) => t?.id === hover.currentHover) ? 'opacity-30' : ''} transition-opacity">
<EventCard title="Runde {index + 1}">
{#each round as fight}
<EventFightChip {event} {fight} {group} />
<div class="flex flex-col">
{#each roundRowsChunked as row}
<div class="flex">
{#each row as round, index (round)}
{@const roundIndex = rounds.indexOf(round)}
{@const teams = Array.from(new Set(round.flatMap((f) => [f.redTeam, f.blueTeam])))}
<div class="{hover.currentHover && !teams.some((t) => t?.id === hover.currentHover) ? 'opacity-30' : ''} transition-opacity">
<EventCard title="Runde {roundIndex + 1}">
{#each round as fight}
<EventFightChip {event} {fight} {group} />
{/each}
</EventCard>
</div>
{/each}
</EventCard>
</div>
{/each}
</div>
{/each}
</div>
</div>
{/each}

View File

@@ -3,6 +3,7 @@ import { z } from "astro:content";
export const GroupViewSchema = z.object({
type: z.literal("GROUP"),
groups: z.array(z.number()),
roundRows: z.number().int().positive().optional().default(1),
});
export type GroupViewConfig = z.infer<typeof GroupViewSchema>;

View File

@@ -8,6 +8,7 @@ viewConfig:
view:
type: "GROUP"
groups: [13]
roundRows: 2
---
**Ahoi, liebe Community,**

View File

@@ -22,12 +22,12 @@ lange ist es her seit dem letzten WarGear-Event. Nun ist es so weit: Am **29. un
## Übersicht
- **Datum:** 29.11.: Gruppenphase, 30.11.: KO-Phase
- **Spielmodus:** Standard **und** Pro WarGear
- **Teamgröße**: 6
- **Anmeldeschluss:** 22. November
- **Einsendeschluss:** 24. November
- **Hotfix-Schluss:** 27. November
- **Datum:** 29.11.: Gruppenphase, 30.11.: KO-Phase
- **Spielmodus:** Standard **und** Pro WarGear
- **Teamgröße**: 6
- **Anmeldeschluss:** 22. November
- **Einsendeschluss:** 24. November
- **Hotfix-Schluss:** 27. November
Bei der SFA muss sich an eines der Regelwerke gehalten werden. Standard- und Pro-WarGear treten gleichwertig gegeneinander an.