mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-23 11:57:50 -05:00
Add subs popover with info text visible to team member Closes #1689
This commit is contained in:
parent
9c645fbad2
commit
5cbe1ea482
|
|
@ -237,7 +237,6 @@ export default function TournamentBracketsPage() {
|
|||
const showAddSubsButton =
|
||||
!tournament.canFinalize(user) &&
|
||||
!tournament.everyBracketOver &&
|
||||
tournament.ownedTeamByUser(user) &&
|
||||
tournament.hasStarted;
|
||||
|
||||
const waitingForTeamsText = () => {
|
||||
|
|
@ -465,7 +464,21 @@ function AddSubsPopOver() {
|
|||
const user = useUser();
|
||||
|
||||
const ownedTeam = tournament.ownedTeamByUser(user);
|
||||
invariant(ownedTeam, "User doesn't have owned team");
|
||||
if (!ownedTeam) {
|
||||
const teamMemberOf = tournament.teamMemberOfByUser(user);
|
||||
if (!teamMemberOf) return null;
|
||||
|
||||
return (
|
||||
<Popover
|
||||
buttonChildren={<>{t("tournament:actions.addSub")}</>}
|
||||
triggerClassName="tiny outlined ml-auto"
|
||||
triggerTestId="add-sub-button"
|
||||
contentClassName="text-xs"
|
||||
>
|
||||
Only team captain or a TO can add subs
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
||||
const subsAvailableToAdd =
|
||||
tournament.maxTeamMemberCount - ownedTeam.members.length;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user