diff --git a/components/play/ActiveMatchesTab.tsx b/components/play/ActiveMatchesTab.tsx deleted file mode 100644 index cf13215d2..000000000 --- a/components/play/ActiveMatchesTab.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { Box, Center, Flex, Grid, Heading } from "@chakra-ui/layout"; -import ModeImage from "components/common/ModeImage"; -import MyError from "components/common/MyError"; -import MySpinner from "components/common/MySpinner"; -import SubText from "components/common/SubText"; -import { CSSVariables } from "utils/CSSVariables"; -import { Fragment } from "react"; -import { hoursToMilliseconds } from "utils/numbers"; -import { trpc } from "utils/trpc"; -import MatchUp from "./MatchUp"; - -const ActiveMatchesTab = () => { - const previousLadderDayQuery = trpc.useQuery(["play.previousLadderDay"]); - - if (previousLadderDayQuery.isLoading) return ; - if (previousLadderDayQuery.error) - return ; - - const previousLadderDay = previousLadderDayQuery.data!; - - return ( - <> - {previousLadderDay && previousLadderDay.matches.length > 0 && ( - <> - {[1].map((round) => ( - - Round {round} - - {new Date( - new Date(previousLadderDay.date).getTime() + - hoursToMilliseconds(round - 1) - ).toLocaleString()}{" "} - ({Intl.DateTimeFormat().resolvedOptions().timeZone}) - - Maplist - {( - previousLadderDay.matches.find( - (match) => match.order === round - )!.maplist as any[] - ).map(({ stage, mode }, i) => { - return ( - - {i + 1}){" "} -
- -
{" "} - {stage} -
- ); - })} - - {previousLadderDay.matches - .filter((match) => match.order === round) - .map((match) => ( - - ))} - -
- ))} - - )} - - ); -}; - -export default ActiveMatchesTab; diff --git a/components/play/FAQTab.tsx b/components/play/FAQTab.tsx deleted file mode 100644 index 3c930c89c..000000000 --- a/components/play/FAQTab.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { - Accordion, - AccordionButton, - AccordionIcon, - AccordionItem, - AccordionPanel, -} from "@chakra-ui/accordion"; -import { Box } from "@chakra-ui/layout"; -import MyLink from "components/common/MyLink"; - -/* -// //"Moray Towers", -// //"Port Mackerel", -// //"Walleye Warehouse", -// //"Arowana Mall", -// //"Kelp Dome" - */ - -const questionsAndAnswers = [ - { - q: "What is the schedule?", - a: ( - <> - During the beta testing phase follow Sendou's Twitter for updates. - You can choose when to play - there is no commitment.
-
- The plan after the beta testing phase is to have 5 event dates a week - when you can play: Monday and Wednesday Americas friendly times (8PM - ET). Tuesday and Thursday Europe friendly times (8PM CET). Sunday for a - time that is aimed for both regions (9PM CET). - - ), - }, - { - q: "How many matches do we play when we register for an event?", - a: ( - <> - If there is an even number of teams everyone plays 2 matches. If there - is an uneven number of teams then two teams play 1 match each and the - rest play 2 matches. - - ), - }, - { - q: "Can I switch who I play with between the event dates? Can I sign up without a team?", - a: ( - <> - You can play with a different set of people each time you play the - ladder if you want. However you need to find people to play with before - signing up (so it doesn't work like solo queue in that sense). - - ), - }, - { - q: "What this the format of the matches?", - a: ( - <> - Best of 9. Even numbered weeks SZ/TC/RM/CB but Splat Zones is the every - other mode. Uneven numbered weeks SZ only. - - ), - }, - { - q: "What is the maplist used?", - a: <>Every map except Moray, Port, Walleye, Mall & Kelp Dome is in play., - }, - { - q: "What ranking system is used?", - a: ( - <> - You can read more about the ranking system used{" "} - - here - - . - - ), - }, - { - q: "How are the teams matched?", - a: ( - <> - The algorithm goes through every possible way to pair the teams that are - signed up. It chooses the match-ups based on which two ways without - repeat matches produce the best quality of matches. Quality of match is - determined by the theoretical likelihood of a draw as provided by the - ranking system we use. - - ), - }, - { - q: "Why are players ranked and not teams? What does this mean in practice?", - a: ( - <> - In Splatoon teams are pretty volatile. It's common for people to - play with a lot of different people. Even in one team there is typically - a big difference in level depending on who from the roster is playing. - Ranking players lets us have more accurate rankings in these conditions. -
-
- If you always play with the same people the ranking system won't be - able to make a difference between your scores. The difference only comes - if you play with different people also. - - ), - }, - { - q: "DC rules?", - a: ( - <> - One DC replay per team per set is allowed. If DC happens before the game - started (counted from players being able to move) room should be remade - without DC replays being used. DC replay is only granted if it was less - than 2 minutes 30 seconds into the match AND the team's score - without DC didn't pass the 50 point mark AND the team with the DC - stopped playing without delay. -
-
If host DC's during game the hosting team has to use their - DC replay if they have any left otherwise they lose the map. - - ), - }, - { - q: "Who hosts?", - a: ( - <> - If you can't agree which team should host then the team who is on - the left side chooses a player in their team to host the room. - - ), - }, - { - q: "How do I report the score?", - a: ( - <> - You report the score by DM'ing the bot Lanista#5266. The bot can be - found on our{" "} - - Discord - - . If you have not registed your Nintendo account with Lanista you have - to use the !register command before. After that reporting - the score is done with the !sendoureport command.
-
- If you have problems please contact Lean#3146 on Discord. - - ), - }, - { - q: "Can we get a sub?", - a: ( - <> - You need to play the sets with the 4 people you sign up with. If a - player becomes unable to play then the rest of the matches need to be - forfeited. - - ), - }, - { - q: "How do I report a forfeit?", - a: ( - <> - You can do on our{" "} - - Discord - {" "} - on the #helpdesk channel. - - ), - }, -] as const; - -const FAQTab = () => { - return ( - - {questionsAndAnswers.map(({ q, a }) => ( - -

- - - {q} - - - -

- {a} -
- ))} -
- ); -}; - -export default FAQTab; diff --git a/components/play/LadderTeam.tsx b/components/play/LadderTeam.tsx deleted file mode 100644 index 5994981ef..000000000 --- a/components/play/LadderTeam.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { Box, BoxProps, Flex, HStack } from "@chakra-ui/react"; -import SubText from "components/common/SubText"; -import TwitterAvatar from "components/common/TwitterAvatar"; -import UserAvatar from "components/common/UserAvatar"; -import { CSSVariables } from "utils/CSSVariables"; -import { GetAllLadderRegisteredTeamsData } from "prisma/queries/getAllLadderRegisteredTeams"; -import { Unpacked } from "utils/types"; - -interface Props { - roster: Unpacked["roster"]; -} - -const LadderTeam: React.FC = ({ roster, ...props }) => { - const teamTuple = roster - .filter((member) => member.team) - .map((member) => member.team) - .reduce( - ( - acc: [ - { - name: string; - twitterName: string; - nameForUrl: string; - }, - number - ][], - cur - ) => { - const tuple = acc.find(([{ name }]) => name === cur!.name); - if (tuple) tuple[1]++; - - acc.push([{ ...(cur as any) }, 1]); - return acc; - }, - [] - ) - .find((tuple) => tuple[1] >= 3); - - return ( - - {teamTuple && roster.length === 4 ? ( - - {teamTuple[0].twitterName && ( - - )} - {teamTuple[0].name} - {teamTuple[1] === 3 && roster.length >= 4 && ( - +1 - )} - - ) : ( - - {roster.map((member) => ( - - ))} - - )} - - {roster - .map((user) => `${user.username}#${user.discriminator}`) - .join(", ")} - - - ); -}; - -export default LadderTeam; diff --git a/components/play/MatchUp.tsx b/components/play/MatchUp.tsx deleted file mode 100644 index e4832ef79..000000000 --- a/components/play/MatchUp.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Box } from "@chakra-ui/react"; -import { PreviousLadderDay } from "services/play"; -import { Unpacked } from "utils/types"; -import LadderTeam from "./LadderTeam"; - -interface Props { - matchUp: Unpacked["matches"]>; -} - -const MatchUp: React.FC = ({ matchUp }) => { - return ( - <> - - player.team === "ALPHA") - .map((player) => player.user)} - /> - - - {matchUp.teamAScore}-{matchUp.teamBScore} - - - player.team === "BRAVO") - .map((player) => player.user)} - /> - - - ); -}; - -export default MatchUp; diff --git a/components/play/RegisterHeader.tsx b/components/play/RegisterHeader.tsx deleted file mode 100644 index a8665935a..000000000 --- a/components/play/RegisterHeader.tsx +++ /dev/null @@ -1,167 +0,0 @@ -import { - Alert, - AlertDescription, - AlertTitle, - Box, - Button, - Input, - useToast, -} from "@chakra-ui/react"; -import { t, Trans } from "@lingui/macro"; -import { useUser } from "hooks/common"; -import { useLadderTeams } from "hooks/play"; -import { useEffect, useState } from "react"; -import { FiCheck, FiTrash } from "react-icons/fi"; -import { getToastOptions } from "utils/objects"; -import { sendData } from "utils/postData"; - -interface Props {} - -const RegisterHeader: React.FC = ({}) => { - const toast = useToast(); - const [user] = useUser(); - const { data, mutate } = useLadderTeams(); - - const [sending, setSending] = useState(false); - const [copied, setCopied] = useState(false); - - useEffect(() => { - if (!copied) return; - - const timer = setTimeout(() => { - setCopied(false); - }, 750); - - return () => clearTimeout(timer); - }, [copied]); - - const createNewTeam = async () => { - setSending(true); - const success = await sendData("POST", "/api/play/teams"); - setSending(false); - if (!success) return; - - mutate(); - - toast(getToastOptions(t`Team created`, "success")); - }; - - const deleteTeam = async () => { - if (!window.confirm(t`Delete registration?`)) return; - setSending(true); - const success = await sendData("DELETE", "/api/play/teams"); - setSending(false); - if (!success) return; - - mutate(); - - toast(getToastOptions(t`Registration canceled`, "success")); - }; - - const leaveTeam = async () => { - if (!window.confirm(t`Leave team?`)) return; - setSending(true); - const success = await sendData("POST", "/api/play/teams/leave"); - setSending(false); - if (!success) return; - - mutate(); - - toast(getToastOptions(t`Team left`, "success")); - }; - - if (!user) return null; - - const ownTeam = data?.find((team) => - team.roster.some((member) => member.id === user.id) - ); - - const ownTeamFullyRegisted = !!ownTeam && ownTeam.roster.length >= 4; - - return ( - - {ownTeam ? ( - - - {ownTeam.roster.length >= 4 ? ( - Team fully registered - ) : ( - Add players to complete registration - )} - - - {ownTeam.inviteCode && ownTeam.roster.length < 4 && ( - - - - - )} - - {ownTeam.roster - .map((member) => `${member.username}#${member.discriminator}`) - .join(", ")} - - - {ownTeam.ownerId === user.id ? ( - - ) : ( - - )} - - - - ) : ( - - )} - - ); -}; - -export default RegisterHeader; diff --git a/components/play/RegisterTab.tsx b/components/play/RegisterTab.tsx deleted file mode 100644 index 05a40d814..000000000 --- a/components/play/RegisterTab.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { Box, Heading } from "@chakra-ui/layout"; -import MyError from "components/common/MyError"; -import MySpinner from "components/common/MySpinner"; -import { trpc } from "utils/trpc"; -import LadderTeam from "./LadderTeam"; -import RegisterHeader from "./RegisterHeader"; - -const RegisterTab = () => { - const registeredTeamsQuery = trpc.useQuery(["play.allRegisteredTeams"]); - const nextLadderDayQuery = trpc.useQuery(["play.nextLadderDay"]); - - if (process.env.NODE_ENV === "production") { - return ( - - <> - First ladder test date is planned for 8th May. Follow Sendou's - Twitter for updates! - - - ); - } - - if (nextLadderDayQuery.isLoading) return ; - if (nextLadderDayQuery.error) - return ; - - const nextLadderDay = nextLadderDayQuery.data!; - - return ( - <> - {!nextLadderDay?.matches.length && ( - - {nextLadderDay ? ( - <> - Next ladder event takes place at{" "} - {new Date(nextLadderDay.date).toLocaleString()} - - ) : ( - <> - Next ladder date is not confirmed. Follow this page for updates! - - )} - - )} - {nextLadderDay && ( - <> - - - - Registered teams - - {registeredTeamsQuery.data - ?.sort((a, b) => b.roster.length - a.roster.length) - .map((team) => ( - - ))} - - - )} - - ); -}; - -export default RegisterTab;