diff --git a/__tests__/Unit/Components/Tasks/ProgressUpdateCard/ProgressUpdateCard.test.tsx b/__tests__/Unit/Components/Tasks/ProgressUpdateCard/ProgressUpdateCard.test.tsx index 2ec000fcd..5caad7ad8 100644 --- a/__tests__/Unit/Components/Tasks/ProgressUpdateCard/ProgressUpdateCard.test.tsx +++ b/__tests__/Unit/Components/Tasks/ProgressUpdateCard/ProgressUpdateCard.test.tsx @@ -89,7 +89,7 @@ describe('ProgressUpdateCard Component', () => { ); const readMoreButton = screen.getByTestId( - 'progress-update-card-read-more-completed' + 'progress-update-read-more-toggle-button' ); expect(readMoreButton).toBeInTheDocument(); expect(readMoreButton).toHaveTextContent('More'); diff --git a/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardOverview.tsx b/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardOverview.tsx new file mode 100644 index 000000000..72c252814 --- /dev/null +++ b/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardOverview.tsx @@ -0,0 +1,92 @@ +import React from 'react'; +import { FaAngleRight, FaRegClock } from 'react-icons/fa6'; +import Tooltip from '@/components/common/Tooltip/Tooltip'; +import styles from './progress-update-card.module.scss'; +import { USER_MANAGEMENT_URL } from '@/constants/url'; +import { ProgressUpdateCardOverviewProps } from './progressUpdateCard.types'; +import { UserAvatar } from '@/components/common/UserAvatar/UserAvatar'; + +export default function ProgressUpdateCardOverview({ + titleToShow, + dateInAgoFormat, + username, + userProfileImageUrl, + tooltipString, + isDevMode, + isExpanded, +}: ProgressUpdateCardOverviewProps) { + return ( +
+

+ {titleToShow} +

+
+ + event.stopPropagation()} + data-testid="progress-update-card-date" + > + + + {dateInAgoFormat} + + + + + {isDevMode && + (username === '' ? ( + + ) : ( + + event.stopPropagation()} + > + + + + ))} + + +
+
+ ); +} diff --git a/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardPresentation.tsx b/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardPresentation.tsx index ed56f7892..dcc468dfe 100644 --- a/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardPresentation.tsx +++ b/src/components/taskDetails/ProgressUpdateCard/ProgressUpdateCardPresentation.tsx @@ -1,14 +1,11 @@ import React from 'react'; import { useRouter } from 'next/router'; -import { FaAngleRight, FaRegClock } from 'react-icons/fa6'; -import Tooltip from '@/components/common/Tooltip/Tooltip'; import styles from './progress-update-card.module.scss'; -import { USER_MANAGEMENT_URL } from '@/constants/url'; import { ProgressUpdateCardPresentationProps, ProgressUpdateDataToShow, } from './progressUpdateCard.types'; -import { UserAvatar } from '@/components/common/UserAvatar/UserAvatar'; +import ProgressUpdateCardOverview from './ProgressUpdateCardOverview'; export default function ProgressUpdateCardPresentation({ titleToShow, @@ -22,7 +19,6 @@ export default function ProgressUpdateCardPresentation({ isExpanded, }: ProgressUpdateCardPresentationProps) { const router = useRouter(); - console.log(isExpanded); const isDevMode = router.query.dev === 'true'; const progressInfoMapping = dataToShowState.map( (datum: ProgressUpdateDataToShow) => ( @@ -45,7 +41,7 @@ export default function ProgressUpdateCardPresentation({ className={ styles['progress-update-card__more-less-button'] } - data-testid="progress-update-card-read-more-completed" + data-testid="progress-update-read-more-toggle-button" > {datum.isReadMoreEnabled ? 'Less' : 'More'} @@ -64,94 +60,15 @@ export default function ProgressUpdateCardPresentation({ data-testid="progress-update-card-container" onClick={onCardClick} > -
-

- {titleToShow} -

-
- - event.stopPropagation()} - data-testid="progress-update-card-date" - > - - - {dateInAgoFormat} - - - - - {isDevMode && - (username === '' ? ( - - ) : ( - - - event.stopPropagation() - } - > - - - - ))} - - -
-
+