From 15b2c4b6e308c351c72b3614e2ed8bee0f1b3a6b Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:52:16 +0200 Subject: [PATCH] Delete unused file --- .../ActionSectionBeforeStartContent.tsx | 145 ------------------ 1 file changed, 145 deletions(-) delete mode 100644 app/components/tournament/ActionSectionBeforeStartContent.tsx diff --git a/app/components/tournament/ActionSectionBeforeStartContent.tsx b/app/components/tournament/ActionSectionBeforeStartContent.tsx deleted file mode 100644 index 613ef4129..000000000 --- a/app/components/tournament/ActionSectionBeforeStartContent.tsx +++ /dev/null @@ -1,145 +0,0 @@ -// TODO: Warning: Text content did not match. Server: "57" Client: "56" - -import * as React from "react"; -import { useTransition, useLoaderData, Form } from "remix"; -import { - checkInClosesDate, - TOURNAMENT_TEAM_ROSTER_MIN_SIZE, -} from "~/constants"; -import { TournamentAction } from "~/routes/to/$organization.$tournament"; -import type { FindTournamentByNameForUrlI } from "~/services/tournament"; -import { Unpacked } from "~/utils"; -import { Button } from "../Button"; -import { AlertIcon } from "../icons/Alert"; -import { CheckInIcon } from "../icons/CheckIn"; -import { ErrorIcon } from "../icons/Error"; -import { SuccessIcon } from "../icons/Success"; -import { ActionSectionWrapper } from "./ActionSectionWrapper"; - -export function ActionSectionBeforeStartContent({ - ownTeam, -}: { - ownTeam: Unpacked; -}) { - const transition = useTransition(); - const tournament = useLoaderData(); - - const timeInMinutesBeforeCheckInCloses = () => { - return Math.floor( - (checkInClosesDate(tournament.startTime).getTime() - - new Date().getTime()) / - (1000 * 60) - ); - }; - - const [minutesTillCheckInCloses, setMinutesTillCheckInCloses] = - React.useState(timeInMinutesBeforeCheckInCloses()); - - React.useEffect(() => { - const timeout = setInterval(() => { - setMinutesTillCheckInCloses(timeInMinutesBeforeCheckInCloses()); - }, 1000 * 15); - - return () => clearTimeout(timeout); - }, []); - - if (ownTeam.checkedInTime) { - return ( - - Your team is checked in! - - ); - } - - const checkInHasStarted = new Date(tournament.checkInStartTime) < new Date(); - const teamHasEnoughMembers = - ownTeam.members.length >= TOURNAMENT_TEAM_ROSTER_MIN_SIZE; - - if (!checkInHasStarted && !teamHasEnoughMembers) { - return ( - - You need at least 4 players in your roster to play - - ); - } - - const differenceInMinutesBetweenCheckInAndStart = Math.floor( - (new Date(tournament.startTime).getTime() - - new Date(tournament.checkInStartTime).getTime()) / - (1000 * 60) - ); - - if (!checkInHasStarted && teamHasEnoughMembers) { - return ( - - Check-in starts{" "} - {differenceInMinutesBetweenCheckInAndStart} minutes before the - tournament starts - - ); - } - - if ( - checkInHasStarted && - !teamHasEnoughMembers && - minutesTillCheckInCloses > 0 - ) { - return ( - - You need at least 4 players in your roster to play. - Check-in is open for {minutesTillCheckInCloses} more{" "} - {minutesTillCheckInCloses > 1 ? "minutes" : "minute"} - - ); - } - - if ( - checkInHasStarted && - teamHasEnoughMembers && - minutesTillCheckInCloses > 0 - ) { - return ( - - {minutesTillCheckInCloses > 1 ? ( - <> - Check-in is open for {minutesTillCheckInCloses} more - minutes - - ) : ( - <> - Check-in closes in less than a minute - - )} -
- - - -
-
- ); - } - - return ( - - Check-in has closed. Your team is not checked in - - ); -}