From 8d5e534fe4c1b6dca493e696d2cabd13c53b5a1a Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Thu, 17 Oct 2024 19:09:32 -0600 Subject: [PATCH 01/12] fix: replace h1 with Heading component --- .../league/[leagueId]/entry/[entryId]/week/Week.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index cfbbf965..cbd148ef 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -34,6 +34,7 @@ import Image from 'next/image'; import { useRouter } from 'next/navigation'; import LinkCustom from '@/components/LinkCustom/LinkCustom'; import { ChevronLeft } from 'lucide-react'; +import Heading from '@/components/Heading/Heading'; /** * Renders the weekly picks page. @@ -271,10 +272,11 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { className="flex flex-col items-center w-full pt-8" data-testid="weekly-picks" > -

- Week {week} pick -

- + {pickHistory.length > 0 && (
Date: Thu, 17 Oct 2024 19:11:05 -0600 Subject: [PATCH 02/12] feat: retrieve and save entry name if user is signed in --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index cbd148ef..7653d6c6 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -44,6 +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 [entryName, setEntryName] = useState(''); const [error, setError] = useState(null); const [schedule, setSchedule] = useState([]); const [selectedLeague, setSelectedLeague] = useState(); @@ -157,7 +158,8 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { if (!currentEntry) { throw new Error('Entry not found'); } - + + setEntryName(currentEntry.name); let entryHistory = currentEntry?.selectedTeams || []; if (currentEntry?.selectedTeams.length > 0) { From 5d70e71ad362982a3fe9ff0906f0a4c9bdf28c19 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Thu, 17 Oct 2024 19:11:34 -0600 Subject: [PATCH 03/12] feat: add second Heading component with entry name --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index 7653d6c6..fa7f3aae 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -279,6 +279,11 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { children={`Week ${week} pick`} className='pb-8' /> + {pickHistory.length > 0 && (
Date: Thu, 17 Oct 2024 19:26:51 -0600 Subject: [PATCH 04/12] refactor: added indentation for Heading component props --- .../league/[leagueId]/entry/[entryId]/week/Week.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index fa7f3aae..455dd6be 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -275,14 +275,14 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { data-testid="weekly-picks" > {pickHistory.length > 0 && (
Date: Thu, 17 Oct 2024 19:47:03 -0600 Subject: [PATCH 05/12] refactor: replace with correct opening and closing tag syntax with children in the middle --- .../league/[leagueId]/entry/[entryId]/week/Week.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index 455dd6be..db581d42 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -276,14 +276,14 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { > + >{`Week ${week} pick`} + + >{`Entry ${entryName}`} + {pickHistory.length > 0 && (
Date: Mon, 21 Oct 2024 08:07:42 -0600 Subject: [PATCH 06/12] style: update color of h2 entry number to muted foreground on advise of designer --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index db581d42..640c3f53 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -281,7 +281,8 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { {`Entry ${entryName}`} {pickHistory.length > 0 && ( From bfe5b5005af9c829985a0f70ca2cf830596c3161 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Mon, 21 Oct 2024 08:14:15 -0600 Subject: [PATCH 07/12] fix: create test to check that new h2 element renders correct content on screen --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx index 78b69c1d..be9dccad 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx @@ -186,6 +186,7 @@ describe('League Week Picks', () => { // Wait for the main content to be displayed await waitFor(() => { expect(screen.getByTestId('weekly-picks')).toBeInTheDocument(); + expect(screen.getByTestId('entry-name')).toHaveTextContent('Entry Entry 1'); }); expect(screen.queryByTestId('global-spinner')).not.toBeInTheDocument(); From 1fd9e8e7018e1f46f500df561e538eb9c6fc0fb3 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Mon, 21 Oct 2024 08:47:50 -0600 Subject: [PATCH 08/12] fix: adjust entry name content - remove unneeded text "Entry X" --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index 640c3f53..f15d6685 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -283,7 +283,7 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { as='h2' className='pb-8 text-muted-foreground' data-testid='entry-name' - >{`Entry ${entryName}`} + >{entryName} {pickHistory.length > 0 && (
Date: Mon, 21 Oct 2024 08:49:53 -0600 Subject: [PATCH 09/12] fix: update testid to follow BEM naming conventions --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index f15d6685..eb164aa1 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -282,7 +282,7 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { {entryName} {pickHistory.length > 0 && ( From 20f6e2943c670cb9712d7119cca873a9eec3e9a2 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Mon, 21 Oct 2024 08:50:33 -0600 Subject: [PATCH 10/12] fix: update testid to follow BEM naming conventions --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx index be9dccad..e1980166 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx @@ -186,7 +186,7 @@ describe('League Week Picks', () => { // Wait for the main content to be displayed await waitFor(() => { expect(screen.getByTestId('weekly-picks')).toBeInTheDocument(); - expect(screen.getByTestId('entry-name')).toHaveTextContent('Entry Entry 1'); + expect(screen.getByTestId('week__entry-name')).toHaveTextContent('Entry Entry 1'); }); expect(screen.queryByTestId('global-spinner')).not.toBeInTheDocument(); From efc93b070ee3e7df4fc4c651ee26c5da48962a27 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Mon, 21 Oct 2024 08:51:00 -0600 Subject: [PATCH 11/12] fix: update expected text content of h2 entry name element --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx index e1980166..0329b73b 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx @@ -186,7 +186,7 @@ describe('League Week Picks', () => { // Wait for the main content to be displayed await waitFor(() => { expect(screen.getByTestId('weekly-picks')).toBeInTheDocument(); - expect(screen.getByTestId('week__entry-name')).toHaveTextContent('Entry Entry 1'); + expect(screen.getByTestId('week__entry-name')).toHaveTextContent('Entry 1'); }); expect(screen.queryByTestId('global-spinner')).not.toBeInTheDocument(); From d8823c8606fc65fc1f6a33aab0d13fec62231119 Mon Sep 17 00:00:00 2001 From: Danielle Lindblom Date: Mon, 21 Oct 2024 08:52:01 -0600 Subject: [PATCH 12/12] fix: test proper text content of new h1 week number element --- app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx | 1 + app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx index 0329b73b..516631f6 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.test.tsx @@ -186,6 +186,7 @@ describe('League Week Picks', () => { // Wait for the main content to be displayed await waitFor(() => { expect(screen.getByTestId('weekly-picks')).toBeInTheDocument(); + expect(screen.getByTestId('week__week-number')).toHaveTextContent('Week 1'); expect(screen.getByTestId('week__entry-name')).toHaveTextContent('Entry 1'); }); diff --git a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx index eb164aa1..6edab010 100644 --- a/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx +++ b/app/(main)/league/[leagueId]/entry/[entryId]/week/Week.tsx @@ -277,6 +277,7 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => { {`Week ${week} pick`}