diff --git a/app/routes/to/$organization.$tournament/seeds.tsx b/app/routes/to/$organization.$tournament/seeds.tsx index 20cfafc25..647ee4728 100644 --- a/app/routes/to/$organization.$tournament/seeds.tsx +++ b/app/routes/to/$organization.$tournament/seeds.tsx @@ -27,11 +27,7 @@ import { Alert } from "~/components/Alert"; import { Button } from "~/components/Button"; import { Catcher } from "~/components/Catcher"; import { Draggable } from "~/components/Draggable"; -import { TOURNAMENT_TEAM_ROSTER_MIN_SIZE } from "~/constants"; -import { checkInHasStarted } from "~/core/tournament/utils"; import { - checkIn, - checkOut, FindTournamentByNameForUrlI, updateSeeds, } from "~/services/tournament"; @@ -39,52 +35,22 @@ import seedsStylesUrl from "~/styles/tournament-seeds.css"; import { requireUser, Unpacked } from "~/utils"; import { useTimeoutState } from "~/utils/hooks"; -enum Action { - UPDATE_SEEDS = "UPDATE_SEEDS", - CHECK_IN = "CHECK_IN", - CHECK_OUT = "CHECK_OUT", -} - export const action: ActionFunction = async ({ context, request }) => { const data = Object.fromEntries(await request.formData()); - invariant(typeof data._action === "string", "Invalid type for _action"); - const user = requireUser(context); - switch (data._action) { - case Action.UPDATE_SEEDS: { - invariant(typeof data.seeds === "string", "Invalid type for seeds"); - invariant( - typeof data.tournamentId === "string", - "Invalid type for tournamentId" - ); - const newSeeds = JSON.parse(data.seeds); + invariant(typeof data.seeds === "string", "Invalid type for seeds"); + invariant( + typeof data.tournamentId === "string", + "Invalid type for tournamentId" + ); + const newSeeds = JSON.parse(data.seeds); - await updateSeeds({ - tournamentId: data.tournamentId, - userId: user.id, - newSeeds, - }); - - break; - } - // TODO: broken - case Action.CHECK_IN: { - invariant(typeof data.teamId === "string", "Invalid type for seeds"); - - await checkIn({ teamId: data.teamId, userId: user.id }); - break; - } - case Action.CHECK_OUT: { - invariant(typeof data.teamId === "string", "Invalid type for seeds"); - - await checkOut({ teamId: data.teamId, userId: user.id }); - break; - } - default: { - throw new Response("Bad Request", { status: 400 }); - } - } + await updateSeeds({ + tournamentId: data.tournamentId, + userId: user.id, + newSeeds, + }); return new Response(undefined, { status: 200 }); }; @@ -97,8 +63,7 @@ export const links: LinksFunction = () => { // TODO: error if not admin export default function SeedsTab() { const [, parentRoute] = useMatches(); - const { id, teams, checkInStartTime } = - parentRoute.data as FindTournamentByNameForUrlI; + const { id, teams } = parentRoute.data as FindTournamentByNameForUrlI; const transition = useTransition(); const [teamOrder, setTeamOrder] = React.useState(teams.map((t) => t.id)); const [activeTeam, setActiveTeam] = React.useStateSeed
Name
- {checkInHasStarted(checkInStartTime) ? "" : "Registered at"} -
-
- Roster size + Players
- + ; seed?: number; }) { - const [, parentRoute] = useMatches(); - const { checkInStartTime } = parentRoute.data as FindTournamentByNameForUrlI; - return ( <>
{seed}
-
{team.name}
-
- {!checkInHasStarted(checkInStartTime) ? ( - <> - {new Date(team.createdAt).toLocaleString("en-US", { - month: "numeric", - day: "numeric", - hour: "numeric", - minute: "numeric", - })} - - ) : team.checkedInTime ? ( - - ) : team.members.length >= TOURNAMENT_TEAM_ROSTER_MIN_SIZE ? ( - - ) : null} -
-
= TOURNAMENT_TEAM_ROSTER_MIN_SIZE, - tournament__seeds__problem: - team.members.length < TOURNAMENT_TEAM_ROSTER_MIN_SIZE, - })} +
{team.name}
+ {/* TODO: scrollbar overlaps on windows? */} +
    - {team.members.length} -
+ {team.members.map((member) => ( +
  • {member.member.discordName}
  • + ))} + ); -} - -function CheckOutButton({ teamId }: { teamId: string }) { - const transition = useTransition(); - return ( -
    - - - -
    - ); -} - -function CheckInButton({ teamId }: { teamId: string }) { - const transition = useTransition(); - return ( -
    - - - -
    - ); -} +}); export const CatchBoundary = Catcher; diff --git a/app/styles/tournament-manage.css b/app/styles/tournament-manage.css index 75199134d..cdfaa0235 100644 --- a/app/styles/tournament-manage.css +++ b/app/styles/tournament-manage.css @@ -7,8 +7,8 @@ display: grid; width: 100%; align-items: center; - margin: var(--s-1); padding: var(--s-2); + margin: var(--s-1); border-radius: var(--rounded); column-gap: var(--s-1); font-size: var(--fonts-sm); diff --git a/app/styles/tournament-seeds.css b/app/styles/tournament-seeds.css index d11966fe5..772beb3fb 100644 --- a/app/styles/tournament-seeds.css +++ b/app/styles/tournament-seeds.css @@ -22,8 +22,8 @@ padding: var(--s-3); border-radius: var(--rounded); column-gap: var(--s-1); - font-size: var(--fonts-sm); - grid-template-columns: 1fr 3fr 3fr 1fr; + font-size: var(--fonts-xs); + grid-template-columns: 3rem 10rem 1fr; list-style: none; row-gap: var(--s-1-5); } @@ -49,10 +49,26 @@ font-weight: var(--bold); } -.tournament__seeds__ok { - color: var(--theme-success); +.tournament__seeds__team-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } -.tournament__seeds__problem { - color: var(--theme-error); +.tournament__seeds__members-list { + display: flex; + padding: 0; + counter-reset: list; +} + +.tournament__seeds__members-list > li { + list-style: none; + margin-inline-start: var(--s-3); + white-space: nowrap; +} + +.tournament__seeds__members-list > li::before { + color: var(--theme-secondary); + content: counter(list) ") "; + counter-increment: list; }