From d42a864f774044f7b562e040524547eb4e0ae490 Mon Sep 17 00:00:00 2001
From: Kalle <38327916+Sendouc@users.noreply.github.com>
Date: Sat, 8 Aug 2026 13:59:17 +0300
Subject: [PATCH] /to/:id/admin allow editing tournament team map pool if the
format has one
Closes #3322
---
.../routes/tournament.$id.teams.upsert.ts | 2 +
.../settings/components/ModeMapPoolPicker.tsx | 6 +-
.../to.$id.admin.registration.server.ts | 9 ++
.../routes/to.$id.admin.registration.$tid.tsx | 48 ++++++++
...ament-admin-registration-schemas.server.ts | 46 +++++++
.../tournament-admin-registration-schemas.ts | 6 +
.../TournamentTeamRepository.server.ts | 67 +++++++----
.../components/CounterPickMapPoolPicker.tsx | 111 +++++++++++++++++
.../tournament/components/TeamWithRoster.tsx | 6 +-
.../tournament/routes/to.$id.register.tsx | 112 ++++--------------
e2e/helpers/counterpick-map-pool.ts | 45 +++++++
.../tournament-admin-registration-page.ts | 24 ++++
.../tournament/tournament-register-page.ts | 27 ++---
e2e/pages/tournament/tournament-team-page.ts | 6 +
e2e/tournament-admin.spec.ts | 76 +++++++++++-
15 files changed, 451 insertions(+), 140 deletions(-)
create mode 100644 app/features/tournament/components/CounterPickMapPoolPicker.tsx
create mode 100644 e2e/helpers/counterpick-map-pool.ts
diff --git a/app/features/api-public/routes/tournament.$id.teams.upsert.ts b/app/features/api-public/routes/tournament.$id.teams.upsert.ts
index 477dbb008..643a28e7d 100644
--- a/app/features/api-public/routes/tournament.$id.teams.upsert.ts
+++ b/app/features/api-public/routes/tournament.$id.teams.upsert.ts
@@ -76,6 +76,8 @@ export const action = async (args: ActionFunctionArgs) => {
userId: member.userId,
inGameName: member.inGameName ?? null,
})),
+ // the API can't edit counterpick maps, so the team's existing pool is carried over as is
+ mapPool: existingTeam?.mapPool ?? [],
}),
});
diff --git a/app/features/settings/components/ModeMapPoolPicker.tsx b/app/features/settings/components/ModeMapPoolPicker.tsx
index 88eaa1a15..1b24dd886 100644
--- a/app/features/settings/components/ModeMapPoolPicker.tsx
+++ b/app/features/settings/components/ModeMapPoolPicker.tsx
@@ -186,7 +186,11 @@ function MapButton({
data-testid={testId}
/>
{selected ? (
-