Fix impossible admin action preselected when tournament has started

This commit is contained in:
Kalle 2024-03-27 23:13:09 +02:00
parent 9c9ff3333c
commit b762c68ac3

View File

@ -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);