diff --git a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx index 8eee7afd64d5..00c1846b6cad 100644 --- a/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx @@ -75,6 +75,16 @@ export const DefendantInfo: FC = (props) => { defender, } = props const { formatMessage } = useIntl() + const hasDefender = defendant.defenderName || defender?.name + const defenderLabel = + defender?.sessionArrangement === + SessionArrangements.ALL_PRESENT_SPOKESPERSON + ? formatMessage(strings.spokesperson) + : formatMessage(strings.defender) + const defenderName = defendant.defenderName || defender?.name + const defenderEmail = defendant.defenderEmail || defender?.email + const defenderPhoneNumber = + defendant.defenderPhoneNumber || defender?.phoneNumber const appealExpirationInfo = getAppealExpirationInfo( defendant.verdictAppealDeadline, @@ -103,26 +113,21 @@ export const DefendantInfo: FC = (props) => { {defendant.address ? defendant.address : 'Ekki skráð'} - {defendant.defenderName || defender?.name ? ( - - - {defender?.sessionArrangement === - SessionArrangements.ALL_PRESENT_SPOKESPERSON - ? `${formatMessage(strings.spokesperson)}: ` - : `${formatMessage(strings.defender)}: `} - - {RenderPersonalData( - defendant.defenderName || defender?.name, - defendant.defenderEmail || defender?.email, - defendant.defenderPhoneNumber || defender?.phoneNumber, + + + {`${defenderLabel}: `} + + {hasDefender ? ( + RenderPersonalData( + defenderName, + defenderEmail, + defenderPhoneNumber, false, - )} - - ) : ( - {`${formatMessage(strings.defender)}: ${formatMessage( - strings.noDefender, - )}`} - )} + ) + ) : ( + {formatMessage(strings.noDefender)} + )} + {displayAppealExpirationInfo && ( @@ -132,7 +137,7 @@ export const DefendantInfo: FC = (props) => { )} - {displayVerdictViewDate && ( + {displayVerdictViewDate && defendant.serviceRequirement && ( {getVerdictViewDateText( formatMessage, diff --git a/apps/judicial-system/web/src/components/InfoCard/InfoCard.spec.tsx b/apps/judicial-system/web/src/components/InfoCard/InfoCard.spec.tsx index 4555f3428f19..610460078a24 100644 --- a/apps/judicial-system/web/src/components/InfoCard/InfoCard.spec.tsx +++ b/apps/judicial-system/web/src/components/InfoCard/InfoCard.spec.tsx @@ -149,7 +149,10 @@ describe('InfoCard', () => { // Act and Assert expect( - await screen.findByText('Verjandi: Hefur ekki verið skráður'), + await screen.findByText( + (_, element) => + element?.textContent === 'Verjandi: Hefur ekki verið skráður', + ), ).toBeTruthy() }) }) diff --git a/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx b/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx index 16b42ebf02e1..464eee6cdaa2 100644 --- a/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx +++ b/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx @@ -225,7 +225,7 @@ const Overview: FC = () => { )} - + {(hasLawsBroken || hasMergeCases) && (