From fe61aeea2880b00cb99285715c3de35387027847 Mon Sep 17 00:00:00 2001 From: Ryan Furrer Date: Fri, 5 Jul 2024 12:29:18 -0400 Subject: [PATCH 001/118] feat(LoadingSpinner.tsx): created first iteration of a loading spinner --- app/league/all/page.tsx | 5 ++++- components/LoadingSpinner/LoadingSpinner.tsx | 23 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 components/LoadingSpinner/LoadingSpinner.tsx diff --git a/app/league/all/page.tsx b/app/league/all/page.tsx index 03f9e1b1..e5e9f2c5 100644 --- a/app/league/all/page.tsx +++ b/app/league/all/page.tsx @@ -9,6 +9,7 @@ import { IGameWeek, ILeague } from '@/api/apiFunctions.interface'; import { getUserLeagues } from '@/utils/utils'; import { useDataStore } from '@/store/dataStore'; import { getGameWeek } from '@/api/apiFunctions'; +import LoadingSpinner from '@/components/LoadingSpinner/LoadingSpinner'; /** * Renders the leagues component. @@ -69,10 +70,12 @@ const Leagues = (): JSX.Element => { )) ) : (
-

Loading ...

+ {/*

Loading ...

*/} +
)} + ); }; diff --git a/components/LoadingSpinner/LoadingSpinner.tsx b/components/LoadingSpinner/LoadingSpinner.tsx new file mode 100644 index 00000000..be6b612c --- /dev/null +++ b/components/LoadingSpinner/LoadingSpinner.tsx @@ -0,0 +1,23 @@ +// Copyright (c) Gridiron Survivor. +// Licensed under the MIT License. + +import React from 'react'; + +/** + * asdf + * @returns asdf + */ +const LoadingSpinner = () => { + return ( +
+
+ Loading +
+
+ ); +}; + +export default LoadingSpinner; From 5d7fb40aabe612a1ec8cd2bf295c07794859f5cb Mon Sep 17 00:00:00 2001 From: Ryan Furrer Date: Sat, 13 Jul 2024 11:00:33 -0400 Subject: [PATCH 002/118] feat(LoadingSpinner.tsx): added optional height and width props to component optional props expect strings (tailwind classes) so the loader takes up the same amount of space as the element it is replacing before it loads in. --- app/league/all/page.tsx | 4 +-- components/LeagueCard/LeagueCard.tsx | 2 +- components/LoadingSpinner/LoadingSpinner.tsx | 30 ++++++++++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/league/all/page.tsx b/app/league/all/page.tsx index e5e9f2c5..156ec885 100644 --- a/app/league/all/page.tsx +++ b/app/league/all/page.tsx @@ -70,12 +70,10 @@ const Leagues = (): JSX.Element => { )) ) : (
- {/*

Loading ...

*/} - +
)} - ); }; diff --git a/components/LeagueCard/LeagueCard.tsx b/components/LeagueCard/LeagueCard.tsx index 1412f946..54be3f7a 100644 --- a/components/LeagueCard/LeagueCard.tsx +++ b/components/LeagueCard/LeagueCard.tsx @@ -23,7 +23,7 @@ const LeagueCard = React.forwardRef( data-testid="LeagueCard" href={href} className={cn( - 'LeagueCard flex max-h-32 place-items-center gap-6 rounded-lg border bg-card p-4 text-card-foreground shadow-sm dark:border-zinc-800', + 'LeagueCard flex max-h-32 h-32 place-items-center gap-6 rounded-lg border bg-card p-4 text-card-foreground shadow-sm dark:border-zinc-800', )} > { +const LoadingSpinner = ({ + height, + width, +}: ILoadingSpinnerProps): JSX.Element => { return ( -
+ - -
-); +
+ {!isEliminated && ( + +
+ + + ); +}; export { LeagueEntries }; diff --git a/utils/utils.ts b/utils/utils.ts index 6bbf7f9e..355b4917 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -3,6 +3,7 @@ import { IGameWeek, + INFLTeam, IUser, IUserPick, } from '@/api/apiFunctions.interface'; @@ -156,3 +157,13 @@ export const hasTeamBeenPicked = (teamName: string, selectedTeams: string[]): bo const currentWeek = useDataStore.getState().currentWeek; return selectedTeams.some((team, index) => index !== (currentWeek - 1) && team === teamName) ? true : false; } + +/** + * Returns the logos for picked NFL teams + * @param NFLTeams - The NFL teams + * @param teamName - The team name + * @returns {string} - The logo URL + */ +export const getNFLTeamLogo = (NFLTeams: INFLTeam[], teamName: string): string => { + return NFLTeams.find((teams) => teams.teamName === teamName)?.teamLogo as string; +} From b52a648d355e688d816fd14d12281e5419634d85 Mon Sep 17 00:00:00 2001 From: Alex Appleget Date: Thu, 12 Sep 2024 10:34:30 -0500 Subject: [PATCH 040/118] Fix: Wrote testing for the label with the {homeAway} data rendering. --- components/WeeklyPickButton/WeeklyPickButton.test.tsx | 6 +++++- components/WeeklyPickButton/WeeklyPickButton.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/WeeklyPickButton/WeeklyPickButton.test.tsx b/components/WeeklyPickButton/WeeklyPickButton.test.tsx index 6f1f46fa..05391b23 100644 --- a/components/WeeklyPickButton/WeeklyPickButton.test.tsx +++ b/components/WeeklyPickButton/WeeklyPickButton.test.tsx @@ -4,6 +4,7 @@ import { WeeklyPickButton } from './WeeklyPickButton'; import { RadioGroup } from '../RadioGroup/RadioGroup'; const weeklyPickData = { + homeAway: 'Home', team: 'Ravens', src: '/path/to/ravens.svg', height: '48', @@ -15,10 +16,13 @@ describe('WeeklyPickButton', () => { it('renders correctly', () => { render( - + , ); + const homeAwayLabel = screen.getByTestId('home-away'); + expect(homeAwayLabel).toBeInTheDocument(); + const image = screen.getByTestId('team-image'); expect(image).toBeInTheDocument(); diff --git a/components/WeeklyPickButton/WeeklyPickButton.tsx b/components/WeeklyPickButton/WeeklyPickButton.tsx index 2f0150a7..dd9fc852 100644 --- a/components/WeeklyPickButton/WeeklyPickButton.tsx +++ b/components/WeeklyPickButton/WeeklyPickButton.tsx @@ -30,7 +30,7 @@ const WeeklyPickButton: React.FC = ({ }): JSX.Element => { return ( <> -