From 7e3cbb039782bec5b0a6fb81e9a7f94151d69d8a Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 16 Dec 2025 16:01:25 +0100 Subject: [PATCH] remove mario-kart route --- src/routes/mario-kart/+page.server.ts | 24 - src/routes/mario-kart/+page.svelte | 569 ------ src/routes/mario-kart/[id]/+page.server.ts | 43 - src/routes/mario-kart/[id]/+page.svelte | 2150 -------------------- 4 files changed, 2786 deletions(-) delete mode 100644 src/routes/mario-kart/+page.server.ts delete mode 100644 src/routes/mario-kart/+page.svelte delete mode 100644 src/routes/mario-kart/[id]/+page.server.ts delete mode 100644 src/routes/mario-kart/[id]/+page.svelte diff --git a/src/routes/mario-kart/+page.server.ts b/src/routes/mario-kart/+page.server.ts deleted file mode 100644 index 7f3fb94..0000000 --- a/src/routes/mario-kart/+page.server.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { PageServerLoad } from './$types'; -import { error } from '@sveltejs/kit'; -import { dbConnect } from '$utils/db'; -import { MarioKartTournament } from '$models/MarioKartTournament'; - -export const load: PageServerLoad = async () => { - try { - await dbConnect(); - - const tournaments = await MarioKartTournament.find() - .sort({ createdAt: -1 }) - .lean({ flattenMaps: true }); - - // Convert MongoDB documents to plain objects for serialization - const serializedTournaments = JSON.parse(JSON.stringify(tournaments)); - - return { - tournaments: serializedTournaments - }; - } catch (err) { - console.error('Error loading tournaments:', err); - throw error(500, 'Failed to load tournaments'); - } -}; diff --git a/src/routes/mario-kart/+page.svelte b/src/routes/mario-kart/+page.svelte deleted file mode 100644 index 71187fc..0000000 --- a/src/routes/mario-kart/+page.svelte +++ /dev/null @@ -1,569 +0,0 @@ - - -
-
-
-

Mario Kart Tournament Tracker

-

Manage your company Mario Kart tournaments

-
- -
- - {#if tournaments.length === 0} -
-
🏁
-

No tournaments yet

-

Create your first Mario Kart tournament to get started!

- -
- {:else} -
- {#each tournaments as tournament} -
-
-

{tournament.name}

- - {getStatusBadge(tournament.status).text} - -
- -
-
- 👥 - {tournament.contestants.length} contestants -
- {#if tournament.groups.length > 0} -
- 🎮 - {tournament.groups.length} groups -
- {/if} -
- 🔄 - {tournament.roundsPerMatch} rounds/match -
-
- - -
- {/each} -
- {/if} -
- -{#if showCreateModal} - -{/if} - - diff --git a/src/routes/mario-kart/[id]/+page.server.ts b/src/routes/mario-kart/[id]/+page.server.ts deleted file mode 100644 index 95d77be..0000000 --- a/src/routes/mario-kart/[id]/+page.server.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { PageServerLoad } from './$types'; -import { error } from '@sveltejs/kit'; -import { dbConnect } from '$utils/db'; -import { MarioKartTournament } from '$models/MarioKartTournament'; - -export const load: PageServerLoad = async ({ params }) => { - try { - await dbConnect(); - - // Use lean with flattenMaps option to convert Map objects to plain objects - const tournament = await MarioKartTournament.findById(params.id).lean({ flattenMaps: true }); - - if (!tournament) { - throw error(404, 'Tournament not found'); - } - - console.log('=== SERVER LOAD DEBUG ==='); - console.log('Raw tournament bracket:', tournament.bracket); - if (tournament.bracket?.rounds) { - console.log('First bracket round matches:', tournament.bracket.rounds[0]?.matches); - } - console.log('=== END SERVER LOAD DEBUG ==='); - - // Convert _id and other MongoDB ObjectIds to strings for serialization - const serializedTournament = JSON.parse(JSON.stringify(tournament)); - - console.log('=== SERIALIZED DEBUG ==='); - if (serializedTournament.bracket?.rounds) { - console.log('Serialized first bracket round matches:', serializedTournament.bracket.rounds[0]?.matches); - } - console.log('=== END SERIALIZED DEBUG ==='); - - return { - tournament: serializedTournament - }; - } catch (err: any) { - if (err.status === 404) { - throw err; - } - console.error('Error loading tournament:', err); - throw error(500, 'Failed to load tournament'); - } -}; diff --git a/src/routes/mario-kart/[id]/+page.svelte b/src/routes/mario-kart/[id]/+page.svelte deleted file mode 100644 index 9fa5129..0000000 --- a/src/routes/mario-kart/[id]/+page.svelte +++ /dev/null @@ -1,2150 +0,0 @@ - - -
-
-
- -

{tournament.name}

-
-
- {tournament.status.replace('_', ' ').toUpperCase()} -
-
- - - - {#if tournament.status === 'setup'} -
-
-

Contestants

- {tournament.contestants.length} total -
- -
- e.key === 'Enter' && addContestant()} - /> - -
- - {#if tournament.contestants.length > 0} -
- {#each tournament.contestants as contestant} -
- {contestant.name} - -
- {/each} -
- -
-
-
- -
- - -
-
- - {#if groupCreationMethod === 'numGroups'} -
- - -
- {:else} -
- - -
- {/if} -
- - -
- {/if} -
- {/if} - - - {#if tournament.status === 'group_stage'} -
-
-

Group Stage

-
- - -
-
- -
- - -
- - - {#if previewBracket} -
-
-

🔮 Bracket Preview

-

Based on current standings (Top {topNFromEachGroup} from each group)

-
- -
- {#each previewBracket.rounds as round, roundIndex} -
-

{round.name}

-
- {#each round.matches as match, matchIndex} - {@const contestantIds = match.contestantIds || []} -
-
- {#if contestantIds.length === 0} -
- TBD -
- {:else} - {#each contestantIds as contestantId, idx} -
- - {getContestantName(contestantId)} - -
- {#if idx < contestantIds.length - 1} -
vs
- {/if} - {/each} - {/if} -
-
- {/each} -
-
- {/each} -
-
- {/if} - - {#each tournament.groups as group} -
-

{group.name}

- -
- Contestants: - {#each group.contestantIds as contestantId, i} - - {getContestantName(contestantId)}{i < group.contestantIds.length - 1 ? ', ' : ''} - - {/each} -
- - {#each group.matches as match} -
-
- Match - - {match.completed ? 'Completed' : 'In Progress'} - -
- -
- {#each Array(tournament.roundsPerMatch) as _, roundIndex} - {@const roundNumber = roundIndex + 1} - {@const existingRound = match.rounds.find(r => r.roundNumber === roundNumber)} -
-
Round {roundNumber}
- {#if existingRound} -
- {#each match.contestantIds as contestantId} -
- {getContestantName(contestantId)} - {existingRound.scores[contestantId] || 0} pts -
- {/each} -
- {:else} - - {/if} -
- {/each} -
- - {#if match.rounds.length > 0} -
- Total Scores: - {#each match.contestantIds as contestantId} -
- {getContestantName(contestantId)} - {getTotalScore(match, contestantId)} pts -
- {/each} -
- {/if} -
- {/each} - - {#if group.standings && group.standings.length > 0} -
-

Standings

- - - - - - - - - - {#each group.standings as standing} - - - - - - {/each} - -
PosContestantTotal Score
{standing.position}{getContestantName(standing.contestantId)}{standing.totalScore}
-
- {/if} -
- {/each} -
- {/if} - - - {#if tournament.status === 'bracket' || tournament.status === 'completed'} -
-
-

🏆 Championship Bracket

- {#if tournament.status === 'completed' && winnerName} - 🏆 Champion: {winnerName} - {/if} -
- -
- {#each [...tournament.bracket.rounds].reverse() as round, roundIndex} - {@const visibleMatches = round.matches.filter(m => (m.contestantIds && m.contestantIds.length > 0) || roundIndex === 0)} - {#if visibleMatches.length > 0} -
-

{round.name}

-
- {#each visibleMatches as match, matchIndex} - {@const contestantIds = match.contestantIds || []} -
-
- {#if contestantIds.length === 0} -
- TBD -
- {:else} - {#each contestantIds as contestantId, idx} -
- - {getContestantName(contestantId)} - - {#if match.rounds.length > 0} - {getTotalScore(match, contestantId)} - {/if} -
- {#if idx < contestantIds.length - 1} -
vs
- {/if} - {/each} - {/if} - - {#if contestantIds.length >= (tournament.matchSize || 2) && !match.completed} -
- {#each Array(tournament.roundsPerMatch) as _, roundIdx} - {@const roundNumber = roundIdx + 1} - {@const existingRound = match.rounds.find(r => r.roundNumber === roundNumber)} - {#if existingRound} - R{roundNumber} ✓ - {:else} - - {/if} - {/each} -
- {/if} - - {#if match.winnerId} -
- 🏆 {getContestantName(match.winnerId)} -
- {/if} -
-
- {/each} -
-
- {/if} - {/each} -
-
- - - {#if tournament.runnersUpBracket} -
-
-

🥉 Runners-Up Bracket (Consolation)

-
- -
- {#each tournament.runnersUpBracket.rounds as round, roundIndex} -
-

{round.name}

-
- {#each round.matches as match, matchIndex} - {@const contestantIds = match.contestantIds || []} -
-
- {#if contestantIds.length === 0} -
- TBD -
- {:else} - {#each contestantIds as contestantId, idx} -
- - {getContestantName(contestantId)} - - {#if match.rounds.length > 0} - {getTotalScore(match, contestantId)} - {/if} -
- {#if idx < contestantIds.length - 1} -
vs
- {/if} - {/each} - {/if} - - {#if contestantIds.length >= (tournament.matchSize || 2) && !match.completed} -
- {#each Array(tournament.roundsPerMatch) as _, roundIdx} - {@const roundNumber = roundIdx + 1} - {@const existingRound = match.rounds.find(r => r.roundNumber === roundNumber)} - {#if existingRound} - R{roundNumber} ✓ - {:else} - - {/if} - {/each} -
- {/if} - - {#if match.winnerId} -
- 🥉 {getContestantName(match.winnerId)} -
- {/if} -
-
- {/each} -
-
- {/each} -
-
- {/if} - {/if} -
- - - -{#if activeScoreEntry} - -{/if} - - -{#if showManageContestantsModal} - -{/if} - - -{#if showConfetti} -
- {#each confettiPieces as piece (piece.id)} -
- {/each} -
-{/if} - -