From c708a1e9315771ee68ac6de962218a6230adeda2 Mon Sep 17 00:00:00 2001 From: heybereket Date: Mon, 5 Jun 2023 23:15:14 -0400 Subject: [PATCH] lint + accessibility --- components/navbar/index.tsx | 26 ++- components/wrapped/WrappedContainer.tsx | 2 +- components/wrapped/slides/TotalFavourited.tsx | 5 +- components/wrapped/spotify/SpotifyPlayer.tsx | 2 +- pages/team/[team]/next.tsx | 2 +- pages/team/[team]/wrap.tsx | 83 ++++----- pages/teams.tsx | 174 +++++++++--------- tailwind.config.js | 4 +- utils/lookup.ts | 31 ++-- 9 files changed, 169 insertions(+), 160 deletions(-) diff --git a/components/navbar/index.tsx b/components/navbar/index.tsx index ce9dedc..15ef097 100644 --- a/components/navbar/index.tsx +++ b/components/navbar/index.tsx @@ -132,15 +132,30 @@ export const Navbar = (props: { - + } /> - + } /> - + } /> @@ -150,7 +165,10 @@ export const Navbar = (props: { } rounded-lg py-2 px-[13px]`} onClick={() => setShowLinks(!showLinks)} > - + diff --git a/components/wrapped/WrappedContainer.tsx b/components/wrapped/WrappedContainer.tsx index 516d15f..7d69916 100644 --- a/components/wrapped/WrappedContainer.tsx +++ b/components/wrapped/WrappedContainer.tsx @@ -19,4 +19,4 @@ export const WrappedContainer = ({ {children} ); -} \ No newline at end of file +}; diff --git a/components/wrapped/slides/TotalFavourited.tsx b/components/wrapped/slides/TotalFavourited.tsx index 45ed398..cca720c 100644 --- a/components/wrapped/slides/TotalFavourited.tsx +++ b/components/wrapped/slides/TotalFavourited.tsx @@ -17,8 +17,7 @@ export const TotalFavourited = (props: any) => { return (

- {props.team} has been - favourited... + {props.team} has been favourited...

times @@ -28,4 +27,4 @@ export const TotalFavourited = (props: any) => {

); -}; \ No newline at end of file +}; diff --git a/components/wrapped/spotify/SpotifyPlayer.tsx b/components/wrapped/spotify/SpotifyPlayer.tsx index 3d14480..7bcaa31 100644 --- a/components/wrapped/spotify/SpotifyPlayer.tsx +++ b/components/wrapped/spotify/SpotifyPlayer.tsx @@ -6,4 +6,4 @@ export const SpotifyPlayer = () => {
); -} \ No newline at end of file +}; diff --git a/pages/team/[team]/next.tsx b/pages/team/[team]/next.tsx index f274f96..75d96a3 100644 --- a/pages/team/[team]/next.tsx +++ b/pages/team/[team]/next.tsx @@ -116,7 +116,7 @@ export default function NextTeamMatch({ ); } - const title = `${teamQuery}'s Upcoming Match / Scout Machine` + const title = `${teamQuery}'s Upcoming Match / Scout Machine`; return ( <> diff --git a/pages/team/[team]/wrap.tsx b/pages/team/[team]/wrap.tsx index 6b42d2a..b645f39 100644 --- a/pages/team/[team]/wrap.tsx +++ b/pages/team/[team]/wrap.tsx @@ -58,54 +58,55 @@ export const getServerSideProps: GetServerSideProps = async ( ): Promise<{ props: any }> => { const { team }: any = context.params; - const [teamMatches, totalEvents, totalAwards, totalFavourited] = await Promise.all([ - await db.match.findMany({ - where: { - event_key: { - contains: "2023", - }, - OR: [ - { - alliances: { - path: ["red", "team_keys"], - array_contains: `frc${team}`, + const [teamMatches, totalEvents, totalAwards, totalFavourited] = + await Promise.all([ + await db.match.findMany({ + where: { + event_key: { + contains: "2023", + }, + OR: [ + { + alliances: { + path: ["red", "team_keys"], + array_contains: `frc${team}`, + }, + }, + { + alliances: { + path: ["blue", "team_keys"], + array_contains: `frc${team}`, + }, }, + ], + }, + }), + await db.event.count({ + where: { + key: { + contains: "2023", }, - { - alliances: { - path: ["blue", "team_keys"], - array_contains: `frc${team}`, + teams: { + some: { + team_number: Number(team), }, }, - ], - }, - }), - await db.event.count({ - where: { - key: { - contains: "2023" }, - teams: { - some: { - team_number: Number(team), - } + }), + await db.award.count({ + where: { + recipient_list: { + array_contains: [{ awardee: null, team_key: `frc${team}` }], + }, + year: 2023, }, - }, - }), - await db.award.count({ - where: { - recipient_list: { - array_contains: [{ awardee: null, team_key: `frc${team}` }], + }), + await db.favouritedTeam.count({ + where: { + team_number: Number(team), }, - year: 2023, - }, - }), - await db.favouritedTeam.count({ - where: { - team_number: Number(team), - }, - }), - ]); + }), + ]); return { props: { diff --git a/pages/teams.tsx b/pages/teams.tsx index 30ca9c9..488ddd8 100644 --- a/pages/teams.tsx +++ b/pages/teams.tsx @@ -19,7 +19,7 @@ import { getStorage, setStorage } from "@/utils/localStorage"; import { Loading } from "@/components/Loading"; const filterOptions = [ - { name: , range: "" }, + { name: , range: "" }, { name: "999s", range: "1-999" }, { name: "1000s", range: "1000-2000" }, { name: "2000s", range: "2000-3000" }, @@ -35,7 +35,6 @@ const filterOptions = [ export default function TeamsPage({ user }: any): JSX.Element { const [teams, setTeams] = useState(); const [allTeams, setAllTeams] = useState(); - const [isClient, setIsClient] = useState(false); const [teamExistsByTime, setTeamExistsByTime] = useState({}); const [time, setTime] = useState(); const [query, setQuery] = useState(""); @@ -68,7 +67,6 @@ export default function TeamsPage({ user }: any): JSX.Element { }, []); useEffect(() => { - setIsClient(true); const handleScroll = (): void => { const scrollPosition: number = window.innerHeight + window.scrollY; const contentHeight: number = document.documentElement.scrollHeight; @@ -146,99 +144,97 @@ export default function TeamsPage({ user }: any): JSX.Element { return ( <> - {isClient && ( - <> - - + <> + + -
-
-
- - - - -
-
- {filterOptions.map( - ( - option: - | { name: JSX.Element; range: string } - | { name: string; range: string }, - index: number - ) => ( - - ) - )} -
-
- -
- - {teamExistsByTime && ( -
- - Looks like the time is{" "} - {time}. - {" "} - - Why don't ya check out {teamExistsByTime.team_number} |{" "} - {teamExistsByTime.nickname}? - -
+
+
+
+ + + + +
+
+ {filterOptions.map( + ( + option: + | { name: JSX.Element; range: string } + | { name: string; range: string }, + index: number + ) => ( + + ) )} -
+
+
+ +
-
-
- {displayedTeams.map((team: any, key: number) => { - return ( - - ); - })} + {teamExistsByTime && ( +
+ + Looks like the time is{" "} + {time}. + {" "} + + Why don't ya check out {teamExistsByTime.team_number} |{" "} + {teamExistsByTime.nickname}? +
+ )} +
+ +
+
+ {displayedTeams.map((team: any, key: number) => { + return ( + + ); + })}
+
-