diff --git a/app/routes/to/$organization.$tournament/manage-roster.tsx b/app/routes/to/$organization.$tournament/manage-roster.tsx index b7de797da..2b816dbfb 100644 --- a/app/routes/to/$organization.$tournament/manage-roster.tsx +++ b/app/routes/to/$organization.$tournament/manage-roster.tsx @@ -13,6 +13,7 @@ export default function ManageRosterPage() { const [, parentRoute] = useMatches(); const tournamentData = parentRoute.data as FindTournamentByNameForUrlI; const [urlWithInviteCode, setUrlWithInviteCode] = React.useState(""); + const [showCopied, setShowCopied] = React.useState(false); const ownTeam = tournamentData.teams.find(({ inviteCode }) => Boolean(inviteCode) @@ -21,13 +22,20 @@ export default function ManageRosterPage() { React.useEffect(() => { if (ownTeam) { setUrlWithInviteCode( - `${window.location.href.replace("/register", "")}?join=${ + `${window.location.href.replace("/manage-roster", "")}?join=${ ownTeam.inviteCode }` ); } }, []); + React.useEffect(() => { + if (!showCopied) return; + const timeout = setTimeout(() => setShowCopied(false), 3000); + + return () => clearTimeout(timeout); + }, [showCopied]); + // TODO: if not a captain of a team -> redirect if (!ownTeam) return null; @@ -47,7 +55,7 @@ export default function ManageRosterPage() { @@ -64,9 +72,12 @@ export default function ManageRosterPage() { />