Skip to content

Commit

Permalink
Disable changing is follow up bracket after tournament start
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc committed Jan 24, 2025
1 parent c58000f commit 71bb340
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export function BracketProgressionSelector({
initialBrackets,
isInvitationalTournament,
setErrored,
isTournamentInProgress,
}: {
initialBrackets?: Progression.InputBracket[];
isInvitationalTournament: boolean;
setErrored: (errored: boolean) => void;
isTournamentInProgress: boolean;
}) {
const [brackets, setBrackets] = React.useState<Progression.InputBracket[]>(
initialBrackets ?? [defaultBracket()],
Expand Down Expand Up @@ -106,6 +108,7 @@ export function BracketProgressionSelector({
}
count={i + 1}
isInvitationalTournament={isInvitationalTournament}
isTournamentInProgress={isTournamentInProgress}
/>
))}
</div>
Expand All @@ -132,13 +135,15 @@ function TournamentFormatBracketSelector({
onDelete,
count,
isInvitationalTournament,
isTournamentInProgress,
}: {
bracket: Progression.InputBracket;
brackets: Progression.InputBracket[];
onChange: (newBracket: Progression.InputBracket) => void;
onDelete?: () => void;
count: number;
isInvitationalTournament: boolean;
isTournamentInProgress: boolean;
}) {
const id = React.useId();

Expand Down Expand Up @@ -353,7 +358,7 @@ function TournamentFormatBracketSelector({
startTime: undefined,
})
}
disabled={bracket.disabled}
disabled={bracket.disabled || isTournamentInProgress}
/>
<Label htmlFor={createId("follow-up-bracket")} spaced={false}>
Is follow-up bracket
Expand Down
1 change: 1 addition & 0 deletions app/features/calendar/routes/calendar.new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ function EventForm() {
}
isInvitationalTournament={isInvitational}
setErrored={setBracketProgressionErrored}
isTournamentInProgress={false}
/>
</div>
) : null}
Expand Down
1 change: 1 addition & 0 deletions app/features/tournament/routes/to.$id.admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ function BracketProgressionEditDialog({ close }: { close: () => void }) {
}))}
isInvitationalTournament={tournament.isInvitational}
setErrored={setBracketProgressionErrored}
isTournamentInProgress
/>
<div className="stack md horizontal justify-center mt-6">
<SubmitButton
Expand Down

0 comments on commit 71bb340

Please sign in to comment.