Skip to content

Commit

Permalink
fix(j-s): Double service not required (#16938)
Browse files Browse the repository at this point in the history
* Checkpoint

* Refactor AlertMessage

* Format date

* Cleanup

* Cleanup

* Merge

* Add key

* Refactor

* Remove console.log

* Merge

* Merge

* Remove duplicate service not required

* Revert

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Guðjón Guðjónsson <[email protected]>
Co-authored-by: unakb <[email protected]>
  • Loading branch information
4 people authored and jonnigs committed Nov 26, 2024
1 parent cc52520 commit 376c06e
Showing 1 changed file with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ export const getAppealExpirationInfo = (
const getVerdictViewDateText = (
formatMessage: IntlShape['formatMessage'],
verdictViewDate?: string | null,
serviceNotRequired?: boolean,
): string => {
if (verdictViewDate) {
return formatMessage(strings.verdictDisplayedDate, {
date: formatDate(verdictViewDate, 'PPP'),
})
} else if (serviceNotRequired) {
return formatMessage(strings.serviceNotRequired)
} else {
return formatMessage(strings.serviceRequired)
}
Expand Down Expand Up @@ -129,23 +126,19 @@ export const DefendantInfo: FC<DefendantInfoProps> = (props) => {
)}
</Box>
{displayAppealExpirationInfo && (
<Box marginTop={1}>
<Text as="span">
{formatMessage(appealExpirationInfo.message, {
appealExpirationDate: appealExpirationInfo.date,
})}
</Text>
</Box>
)}
{displayVerdictViewDate && defendant.serviceRequirement && (
<Text marginTop={1} fontWeight="semiBold">
{getVerdictViewDateText(
formatMessage,
defendant.verdictViewDate,
defendant.serviceRequirement === ServiceRequirement.NOT_REQUIRED,
)}
<Text as="p" marginTop={1} fontWeight="semiBold">
{formatMessage(appealExpirationInfo.message, {
appealExpirationDate: appealExpirationInfo.date,
})}
</Text>
)}
{displayVerdictViewDate &&
defendant.serviceRequirement &&
defendant.serviceRequirement !== ServiceRequirement.NOT_REQUIRED && (
<Text marginTop={1} fontWeight="semiBold">
{getVerdictViewDateText(formatMessage, defendant.verdictViewDate)}
</Text>
)}
</>
)
}

0 comments on commit 376c06e

Please sign in to comment.