From 592da87c26ee9f3f052c3ebd5005ed7478d8e9f3 Mon Sep 17 00:00:00 2001 From: unurled Date: Mon, 7 Jul 2025 19:22:26 +0000 Subject: [PATCH] create rounds --- src/lib/components/rounds/create-round.svelte | 88 ++++++++++++------- src/lib/components/rounds/rounds.svelte | 3 - src/lib/i18n/locales/en.json | 12 +++ src/lib/i18n/locales/fr.json | 1 + src/routes/api/competitions/[id]/+server.ts | 3 + src/types.ts | 2 +- svelte.config.js | 3 +- 7 files changed, 73 insertions(+), 39 deletions(-) create mode 100644 src/routes/api/competitions/[id]/+server.ts diff --git a/src/lib/components/rounds/create-round.svelte b/src/lib/components/rounds/create-round.svelte index 3069ea9..90e1e15 100644 --- a/src/lib/components/rounds/create-round.svelte +++ b/src/lib/components/rounds/create-round.svelte @@ -1,41 +1,61 @@ -
- - - {#each Object.values(SchedulingMode) as mode} -
- - {#snippet children({ props })} - - {mode} - {/snippet} - -
- {/each} -
- - - -
-
+
+ schedulingMode, (t: SchedulingMode) => {}} + name="scheduling_mode" + > + {#each Object.values(SchedulingMode) as mode} + + {/each} + +
+ +
+
diff --git a/src/lib/components/rounds/rounds.svelte b/src/lib/components/rounds/rounds.svelte index d7eb96d..82d0d1f 100644 --- a/src/lib/components/rounds/rounds.svelte +++ b/src/lib/components/rounds/rounds.svelte @@ -4,7 +4,4 @@ let { rounds, createForm } = $props(); -{JSON.stringify(rounds)} -
- diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index e69de29..3f9560f 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -0,0 +1,12 @@ +{ + "single": "Single", + "single.description": "In a single elimination format, a participant is eliminated after one loss. The last undefeated player is the winner.", + "double": "Double", + "double.description": "In a double elimination format, a participant must lose twice before being eliminated. It includes a winners bracket and a losers bracket.", + "swiss": "Swiss", + "swiss.description": "The Swiss system pairs players with similar win records over a fixed number of rounds. No one is eliminated, and standings are based on overall performance.", + "round_robin": "Round Robin", + "round_robin.description": "In a round robin format, each participant plays against every other participant once. Rankings are determined by total wins or points.", + "double_round_robin": "Double Round Robin", + "double_round_robin.description": "A double round robin has each participant play every other twice—once at 'home' and once 'away'. It provides a balanced and fair comparison across all competitors." +} diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index e69de29..0967ef4 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -0,0 +1 @@ +{} diff --git a/src/routes/api/competitions/[id]/+server.ts b/src/routes/api/competitions/[id]/+server.ts new file mode 100644 index 0000000..60ff3f8 --- /dev/null +++ b/src/routes/api/competitions/[id]/+server.ts @@ -0,0 +1,3 @@ +import type { RequestHandler } from '../../../competitions/[id]/$types'; + +export const POST: RequestHandler = () => {}; diff --git a/src/types.ts b/src/types.ts index c79f477..058c6eb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -14,7 +14,7 @@ export interface NavItem { } export enum SchedulingMode { - single = 'signle', + single = 'single', double = 'double', swiss = 'swiss', round_robin = 'round_robin', diff --git a/svelte.config.js b/svelte.config.js index 9f60e88..60d77f7 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -9,7 +9,8 @@ const config = { kit: { adapter: adapter(), alias: { - '@/*': './src/*' + '@/*': './src/*', + '$ui/*': './src/lib/components/ui/*' } } };