From fa7e68ca10c5fb4060706eb5253fb891e20889f2 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 1 Jan 2026 16:23:13 +0100 Subject: [PATCH] feat: Add roundRows configuration to group view and update event markdowns --- src/components/event/GroupDisplay.svelte | 41 ++++++++++++++++++------ src/components/event/types.ts | 1 + src/content/events/neujahr2026.md | 1 + src/content/events/wg-sfa.md | 12 +++---- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/components/event/GroupDisplay.svelte b/src/components/event/GroupDisplay.svelte index 6f1e91e..9ac8a4b 100644 --- a/src/components/event/GroupDisplay.svelte +++ b/src/components/event/GroupDisplay.svelte @@ -41,6 +41,20 @@ return rounds; } + function chunkIntoRows(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; @@ -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)}
@@ -60,15 +76,22 @@
- {#each rounds as round, index} - {@const teams = Array.from(new Set(round.flatMap((f) => [f.redTeam, f.blueTeam])))} -
- - {#each round as fight} - +
+ {#each roundRowsChunked as row} +
+ {#each row as round, index (round)} + {@const roundIndex = rounds.indexOf(round)} + {@const teams = Array.from(new Set(round.flatMap((f) => [f.redTeam, f.blueTeam])))} +
+ + {#each round as fight} + + {/each} + +
{/each} - -
- {/each} +
+ {/each} +
{/each} diff --git a/src/components/event/types.ts b/src/components/event/types.ts index c13b435..853ed25 100644 --- a/src/components/event/types.ts +++ b/src/components/event/types.ts @@ -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; diff --git a/src/content/events/neujahr2026.md b/src/content/events/neujahr2026.md index ea98bb7..92a3520 100644 --- a/src/content/events/neujahr2026.md +++ b/src/content/events/neujahr2026.md @@ -8,6 +8,7 @@ viewConfig: view: type: "GROUP" groups: [13] + roundRows: 2 --- **Ahoi, liebe Community,** diff --git a/src/content/events/wg-sfa.md b/src/content/events/wg-sfa.md index 66baf04..9e677cf 100644 --- a/src/content/events/wg-sfa.md +++ b/src/content/events/wg-sfa.md @@ -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.