From b762c68ac35537aa02cb34f167f9fdc9ae4484f4 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:13:09 +0200 Subject: [PATCH] Fix impossible admin action preselected when tournament has started --- app/features/tournament/routes/to.$id.admin.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/features/tournament/routes/to.$id.admin.tsx b/app/features/tournament/routes/to.$id.admin.tsx index 31ed175dd..3e678c134 100644 --- a/app/features/tournament/routes/to.$id.admin.tsx +++ b/app/features/tournament/routes/to.$id.admin.tsx @@ -396,7 +396,12 @@ function TeamActions() { ); const [selectedAction, setSelectedAction] = React.useState< (typeof actions)[number] - >(actions[0]); + >( + // if started, default to action with no restrictions + tournament.hasStarted + ? actions.find((a) => a.when.length === 0)! + : actions[0], + ); const selectedTeam = tournament.teamById(selectedTeamId);