diff --git a/api/apiFunctions.interface.ts b/api/apiFunctions.interface.ts index 8685e2f9..516c9bf8 100644 --- a/api/apiFunctions.interface.ts +++ b/api/apiFunctions.interface.ts @@ -46,8 +46,10 @@ export interface INFLTeam { teamLogo: string; teamName: string; } -export interface IEntryHistoryTeam extends Omit {} +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 ca9b32ba..d9a28a8b 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -22,7 +22,7 @@ import { getGameWeek, } from '@/api/apiFunctions'; import { ILeague } from '@/api/apiFunctions.interface'; -import { IEntryHistoryTeam } from '@/api/apiFunctions.interface'; +import { IPickHistoryTeam } from '@/api/apiFunctions.interface'; import WeekTeams from './WeekTeams'; import GlobalSpinner from '@/components/GlobalSpinner/GlobalSpinner'; import { onWeeklyPickChange } from './WeekHelper'; @@ -44,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([]); @@ -162,17 +162,15 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { setEntryName(currentEntry.name); const entryHistory = currentEntry?.selectedTeams || []; - - let entryHistoryObject: IEntryHistoryTeam[] = []; - if (entryHistory.length > 0) { - entryHistoryObject = entryHistory.map((teamName) => ({ + if (currentEntry?.selectedTeams.length > 0) { + const entryHistoryObject = entryHistory.map((teamName) => ({ teamName: teamName, teamLogo: getNFLTeamLogo(NFLTeams, teamName), })); + setPickHistory(entryHistoryObject); } - setPickHistory(entryHistoryObject); } catch (error) { throw new Error("Error fetching user's pick history"); } finally { diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/WeekTeams.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/WeekTeams.tsx index 274ca8db..756bbae4 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/WeekTeams.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/WeekTeams.tsx @@ -104,12 +104,11 @@ const WeekTeams = ({ homeAway={competition.homeAway} team={competition.team.name} src={competition.team.logo} - isDisabled={false} - // isDisabled={ - // disableGame || - // Boolean(loadingTeamName) || - // hasTeamBeenPicked(competition.team.name, selectedTeams) - // } + isDisabled={ + disableGame || + Boolean(loadingTeamName) || + hasTeamBeenPicked(competition.team.name, selectedTeams) + } />