diff --git a/api/apiFunctions.interface.ts b/api/apiFunctions.interface.ts index e5d1f6fb..516c9bf8 100644 --- a/api/apiFunctions.interface.ts +++ b/api/apiFunctions.interface.ts @@ -46,7 +46,10 @@ export interface INFLTeam { teamLogo: string; teamName: string; } +export interface IPickHistoryTeam extends Omit {} + export interface IUserPicksData extends IUserPick {} + export interface ILeague { leagueId: string; leagueName: string; diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index 6edab010..d9a28a8b 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -22,6 +22,7 @@ import { getGameWeek, } from '@/api/apiFunctions'; import { ILeague } from '@/api/apiFunctions.interface'; +import { IPickHistoryTeam } from '@/api/apiFunctions.interface'; import WeekTeams from './WeekTeams'; import GlobalSpinner from '@/components/GlobalSpinner/GlobalSpinner'; import { onWeeklyPickChange } from './WeekHelper'; @@ -43,7 +44,7 @@ import Heading from '@/components/Heading/Heading'; */ // eslint-disable-next-line no-unused-vars const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { - const [pickHistory, setPickHistory] = useState([]); + const [pickHistory, setPickHistory] = useState([]); const [entryName, setEntryName] = useState(''); const [error, setError] = useState(null); const [schedule, setSchedule] = useState([]); @@ -160,15 +161,16 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { } setEntryName(currentEntry.name); - let entryHistory = currentEntry?.selectedTeams || []; + const entryHistory = currentEntry?.selectedTeams || []; if (currentEntry?.selectedTeams.length > 0) { - entryHistory = entryHistory.map((teamName) => - getNFLTeamLogo(NFLTeams, teamName), - ); + const entryHistoryObject = entryHistory.map((teamName) => ({ + teamName: teamName, + teamLogo: getNFLTeamLogo(NFLTeams, teamName), + })); + setPickHistory(entryHistoryObject); } - setPickHistory(entryHistory); } catch (error) { throw new Error("Error fetching user's pick history"); } finally { @@ -291,14 +293,14 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { className="flex flex-wrap w-[90%] gap-4 overflow-x-scroll justify-center pb-10 items-center" data-testid="user-pick-history" > - {pickHistory?.map((logoURL, index) => { + {pickHistory?.map((team, index) => { const isCurrentWeek = index === pickHistory.length - 1; const hasCurrentWeekPick = pickHistory.length === Number(week); return (
{ ? 'CURRENT' : `WEEK ${index + 1}`} - {logoURL ? ( - teamLogo + {team.teamLogo ? ( + <> + {team.teamName} + ) : ( ( - onWeeklyPickChange(value as NFLTeams)} - defaultValue={userPick} - value={userPick} - onChange={field.onChange} - > + <> {schedule.map((scheduledGame) => { const disableGame = checkCurrentGameTime(scheduledGame.date); return (
-
+

{formatDateTime(scheduledGame.date)}

- {scheduledGame.competitions[0].competitors.map( - (competition, index) => ( - <> + + onWeeklyPickChange(value as NFLTeams)} + > + {scheduledGame.competitions[0].competitors.map((competition, index) => ( + {index > 0 && (
@
)} - + - - ), - )} +
+ ))} +
); })} - + ); + export default WeekTeams; + \ No newline at end of file diff --git a/components/Label/Label.tsx b/components/Label/Label.tsx index 2a93646e..240bd470 100644 --- a/components/Label/Label.tsx +++ b/components/Label/Label.tsx @@ -14,7 +14,7 @@ const labelVariants = cva( variants: { disabled: { true: 'opacity-50 cursor-not-allowed', - false: 'peer-aria-checked:border-accent peer-hover:border-white' + false: 'peer-aria-checked:border-accent peer-hover:border-white peer-focus:outline-none peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-white peer-focus-visible:rounded-xl peer-focus-visible:outline-offset-4' }, }, } diff --git a/components/WeeklyPickButton/WeeklyPickButton.test.tsx b/components/WeeklyPickButton/WeeklyPickButton.test.tsx index 408470b2..155bf77e 100644 --- a/components/WeeklyPickButton/WeeklyPickButton.test.tsx +++ b/components/WeeklyPickButton/WeeklyPickButton.test.tsx @@ -8,7 +8,7 @@ const weeklyPickData = { src: '/path/to/ravens.svg', height: '48', width: '48', - alt: 'Ravens', + alt: '', }; describe('WeeklyPickButton', () => { diff --git a/components/WeeklyPickButton/WeeklyPickButton.tsx b/components/WeeklyPickButton/WeeklyPickButton.tsx index 382c43f8..362d5b47 100644 --- a/components/WeeklyPickButton/WeeklyPickButton.tsx +++ b/components/WeeklyPickButton/WeeklyPickButton.tsx @@ -37,7 +37,7 @@ const WeeklyPickButton: React.FC = ({ }): JSX.Element => { return ( <> -