From 0cd31c1f0d1b982b8c3fed5a9859c20631d232fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Tue, 5 Nov 2024 15:25:01 +0000 Subject: [PATCH 01/13] Checkpoint --- .../Shared/IndictmentOverview/IndictmentOverview.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index 8f7bce9de3a6..b74fae289190 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -9,6 +9,7 @@ import { isCompletedCase, isDefenceUser, isProsecutionUser, + isSuccessfulServiceStatus, } from '@island.is/judicial-system/types' import { titles } from '@island.is/judicial-system-web/messages' import { @@ -124,6 +125,13 @@ const IndictmentOverview: FC = () => { : formatMessage(strings.inProgressTitle)} + {isDefenceUser(user) && + workingCase.defendants?.map((defendant) => + defendant.subpoenas?.map( + (subpoena) => + isSuccessfulServiceStatus(subpoena.serviceStatus) && 'sdads', + ), + )} {caseHasBeenReceivedByCourt && workingCase.court && latestDate?.date && From 96aa96fe6baf091e9ef2ecc0a70c2ae5e74c8f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Tue, 5 Nov 2024 22:49:39 +0000 Subject: [PATCH 02/13] Refactor AlertMessage --- .../web/src/components/index.ts | 1 + .../IndictmentOverview/IndictmentOverview.tsx | 66 ++++++++++++++++--- .../src/lib/AlertMessage/AlertMessage.tsx | 62 ++++++++--------- libs/island-ui/core/src/lib/Box/Box.tsx | 2 + .../core/src/lib/Box/useBoxStyles.css.ts | 40 +++++++++++ .../core/src/lib/Box/useBoxStyles.ts | 11 ++++ 6 files changed, 138 insertions(+), 44 deletions(-) diff --git a/apps/judicial-system/web/src/components/index.ts b/apps/judicial-system/web/src/components/index.ts index 85c50b4f5967..2a230dffdd67 100644 --- a/apps/judicial-system/web/src/components/index.ts +++ b/apps/judicial-system/web/src/components/index.ts @@ -63,6 +63,7 @@ export { default as RulingAccordionItem } from './AccordionItems/RulingAccordion export { default as RulingInput } from './RulingInput/RulingInput' export { default as SectionHeading } from './SectionHeading/SectionHeading' export { default as ServiceAnnouncement } from './ServiceAnnouncement/ServiceAnnouncement' +export { strings as serviceAnnouncementStrings } from './ServiceAnnouncement/ServiceAnnouncement.strings' export { default as ServiceInterruptionBanner } from './ServiceInterruptionBanner/ServiceInterruptionBanner' export { default as SignedDocument } from './SignedDocument/SignedDocument' export { default as OverviewHeader } from './OverviewHeader/OverviewHeader' diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index b74fae289190..f71b7c779fba 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -2,7 +2,7 @@ import { FC, useCallback, useContext, useState } from 'react' import { useIntl } from 'react-intl' import { useRouter } from 'next/router' -import { Accordion, Box, Button } from '@island.is/island-ui/core' +import { Accordion, AlertMessage, Box, Button } from '@island.is/island-ui/core' import * as constants from '@island.is/judicial-system/consts' import { normalizeAndFormatNationalId } from '@island.is/judicial-system/formatters' import { @@ -28,24 +28,63 @@ import { PageTitle, useIndictmentsLawsBroken, UserContext, + serviceAnnouncementStrings, } from '@island.is/judicial-system-web/src/components' import { CaseIndictmentRulingDecision, CaseState, + Defendant, IndictmentDecision, + ServiceStatus, + Subpoena, UserRole, } from '@island.is/judicial-system-web/src/graphql/schema' import { ReviewDecision } from '../../PublicProsecutor/components/ReviewDecision/ReviewDecision' import { strings } from './IndictmentOverview.strings' +interface ServiceAnnouncementProps { + defendant: Defendant + subpoena: Subpoena +} + +const ServiceAnnouncement: FC = (props) => { + const { defendant, subpoena } = props + const { formatMessage } = useIntl() + + const getTitle = (defendantName?: string | null) => { + const successMessage = formatMessage( + serviceAnnouncementStrings.serviceStatusSuccess, + ) + + return defendantName + ? `${successMessage} - ${defendantName}` + : successMessage + } + + const getMessage = ( + servedBy?: string | null, + serviceDate?: string | null, + ) => { + return [servedBy, serviceDate].filter(Boolean).join(', ') + } + + return ( + + ) +} + const IndictmentOverview: FC = () => { - const router = useRouter() const { workingCase, isLoadingWorkingCase, caseNotFound } = useContext(FormContext) - const { user } = useContext(UserContext) + const { user } = useContext(UserContext) const { formatMessage } = useIntl() + const router = useRouter() const lawsBroken = useIndictmentsLawsBroken(workingCase) const caseHasBeenReceivedByCourt = workingCase.state === CaseState.RECEIVED const latestDate = workingCase.courtDate ?? workingCase.arraignmentDate @@ -54,10 +93,16 @@ const IndictmentOverview: FC = () => { const [modalVisible, setModalVisible] = useState(false) const [isReviewDecisionSelected, setIsReviewDecisionSelected] = useState(false) + + const hasLawsBroken = lawsBroken.size > 0 + const hasMergeCases = + workingCase.mergedCases && workingCase.mergedCases.length > 0 + const shouldDisplayReviewDecision = isCompletedCase(workingCase.state) && workingCase.indictmentReviewer?.id === user?.id && Boolean(!workingCase.indictmentReviewDecision) + const canAddFiles = !isCompletedCase(workingCase.state) && isDefenceUser(user) && @@ -70,6 +115,7 @@ const IndictmentOverview: FC = () => { ) && workingCase.indictmentDecision !== IndictmentDecision.POSTPONING_UNTIL_VERDICT + const shouldDisplayGeneratedPdfFiles = isProsecutionUser(user) || workingCase.defendants?.some( @@ -97,10 +143,6 @@ const IndictmentOverview: FC = () => { [router, workingCase.id], ) - const hasLawsBroken = lawsBroken.size > 0 - const hasMergeCases = - workingCase.mergedCases && workingCase.mergedCases.length > 0 - return ( { workingCase.defendants?.map((defendant) => defendant.subpoenas?.map( (subpoena) => - isSuccessfulServiceStatus(subpoena.serviceStatus) && 'sdads', + isSuccessfulServiceStatus(subpoena.serviceStatus) && ( + + + + ), ), )} {caseHasBeenReceivedByCourt && diff --git a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx index 22d5db4d8683..85b8458f4134 100644 --- a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx +++ b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx @@ -1,10 +1,9 @@ -import * as React from 'react' +import { FC, PropsWithChildren, ReactNode, isValidElement } from 'react' import { Text } from '../Text/Text' import { Icon } from '../IconRC/Icon' import { Icon as IconType } from '../IconRC/iconMap' import { Colors } from '@island.is/island-ui/theme' import { Box } from '../Box/Box' -import { Stack } from '../Stack/Stack' export type AlertMessageType = | 'error' @@ -55,33 +54,30 @@ const variantStyles: VariantStyles = { }, } -export interface AlertMessageProps { +interface AlertMessageProps { type: AlertMessageType testid?: string - action?: React.ReactNode } type TitleAndOrMessage = | { title: string - message: string | React.ReactNode + message: string | ReactNode } | { title?: never - message: string | React.ReactNode + message: string | ReactNode } | { title: string message?: never } -export const AlertMessage: React.FC< - React.PropsWithChildren -> = ({ type, title, message, action, testid }) => { +export const AlertMessage: FC< + PropsWithChildren +> = ({ type, title, message, testid }) => { const variant = variantStyles[type] - const onlyMessage = !title && !!message - return ( - + {variant.icon && ( )} - - - {!!title && ( - - {title} - - )} + + {title && ( + + {title} + + )} + {message && ( - {message && - (React.isValidElement(message) ? ( - message - ) : ( - - {message} - - ))} - {action && ( - - {action} + {isValidElement(message) ? ( + message + ) : ( + + {message} )} - + )} diff --git a/libs/island-ui/core/src/lib/Box/Box.tsx b/libs/island-ui/core/src/lib/Box/Box.tsx index b141c83d6172..6612c3f96115 100644 --- a/libs/island-ui/core/src/lib/Box/Box.tsx +++ b/libs/island-ui/core/src/lib/Box/Box.tsx @@ -30,6 +30,7 @@ export const Box = forwardRef( columnGap, rowGap, alignItems, + alignSelf, justifyContent, textAlign, border, @@ -93,6 +94,7 @@ export const Box = forwardRef( columnGap, rowGap, alignItems, + alignSelf, justifyContent, textAlign, border, diff --git a/libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts b/libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts index 55f863041994..12039340fcce 100644 --- a/libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts +++ b/libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts @@ -326,6 +326,46 @@ export const alignItemsXl = styleVariants( ), ) +const alignSelfRules = { + flexStart: 'flex-start', + center: 'center', + flexEnd: 'flex-end', + baseline: 'baseline', + stretch: 'stretch', +} +export const alignSelf = styleVariants( + mapToStyleProperty(alignSelfRules, 'alignSelf'), +) + +export const alignSelfSm = styleVariants( + mapToStyleProperty(alignSelfRules, 'alignSelf', (value, propertyName) => + themeUtils.responsiveStyle({ + sm: { [propertyName]: value }, + }), + ), +) +export const alignSelfMd = styleVariants( + mapToStyleProperty(alignSelfRules, 'alignSelf', (value, propertyName) => + themeUtils.responsiveStyle({ + md: { [propertyName]: value }, + }), + ), +) +export const alignSelfLg = styleVariants( + mapToStyleProperty(alignSelfRules, 'alignSelf', (value, propertyName) => + themeUtils.responsiveStyle({ + lg: { [propertyName]: value }, + }), + ), +) +export const alignSelfXl = styleVariants( + mapToStyleProperty(alignSelfRules, 'alignSelf', (value, propertyName) => + themeUtils.responsiveStyle({ + xl: { [propertyName]: value }, + }), + ), +) + const justifyContentRules = { flexStart: 'flex-start', center: 'center', diff --git a/libs/island-ui/core/src/lib/Box/useBoxStyles.ts b/libs/island-ui/core/src/lib/Box/useBoxStyles.ts index c659d986e98f..9ac4a5e91435 100644 --- a/libs/island-ui/core/src/lib/Box/useBoxStyles.ts +++ b/libs/island-ui/core/src/lib/Box/useBoxStyles.ts @@ -35,6 +35,7 @@ export interface UseBoxStylesProps { flexShrink?: keyof typeof styleRefs.flexShrink flexGrow?: keyof typeof styleRefs.flexGrow alignItems?: ResponsiveProp + alignSelf?: ResponsiveProp justifyContent?: ResponsiveProp textAlign?: ResponsiveProp columnGap?: ResponsiveSpace @@ -98,6 +99,7 @@ export const useBoxStyles = ({ rowGap, columnGap, alignItems, + alignSelf, justifyContent, textAlign, border, @@ -346,6 +348,15 @@ export const useBoxStyles = ({ styles.alignItemsLg, styles.alignItemsXl, ), + alignSelf !== undefined && + resolveResponsiveProp( + alignSelf, + styles.alignSelf, + styles.alignSelfSm, + styles.alignSelfMd, + styles.alignSelfLg, + styles.alignSelfXl, + ), justifyContent !== undefined && resolveResponsiveProp( justifyContent, From d717322bc89475f096204e4a8ee2d6fb54efec86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 6 Nov 2024 10:15:00 +0000 Subject: [PATCH 03/13] Format date --- .../Shared/IndictmentOverview/IndictmentOverview.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index f71b7c779fba..04a0743d2e00 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -4,7 +4,10 @@ import { useRouter } from 'next/router' import { Accordion, AlertMessage, Box, Button } from '@island.is/island-ui/core' import * as constants from '@island.is/judicial-system/consts' -import { normalizeAndFormatNationalId } from '@island.is/judicial-system/formatters' +import { + formatDate, + normalizeAndFormatNationalId, +} from '@island.is/judicial-system/formatters' import { isCompletedCase, isDefenceUser, @@ -66,7 +69,7 @@ const ServiceAnnouncement: FC = (props) => { servedBy?: string | null, serviceDate?: string | null, ) => { - return [servedBy, serviceDate].filter(Boolean).join(', ') + return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ') } return ( From 80e2958ecc559a0b946ad3ee738d6ab559289ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 6 Nov 2024 10:36:16 +0000 Subject: [PATCH 04/13] Cleanup --- .../routes/Shared/IndictmentOverview/IndictmentOverview.tsx | 4 ++-- libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index 04a0743d2e00..c890e178fb81 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -55,7 +55,7 @@ const ServiceAnnouncement: FC = (props) => { const { defendant, subpoena } = props const { formatMessage } = useIntl() - const getTitle = (defendantName?: string | null) => { + const getTitle = (defendantName?: string | null): string => { const successMessage = formatMessage( serviceAnnouncementStrings.serviceStatusSuccess, ) @@ -68,7 +68,7 @@ const ServiceAnnouncement: FC = (props) => { const getMessage = ( servedBy?: string | null, serviceDate?: string | null, - ) => { + ): string => { return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ') } diff --git a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx index 85b8458f4134..409937de226b 100644 --- a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx +++ b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx @@ -105,7 +105,7 @@ export const AlertMessage: FC< alignSelf="center" > {title && ( - + {title} )} From 4c4c23e891175e93c9574f41ee7b4d7d110eb9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 6 Nov 2024 10:37:22 +0000 Subject: [PATCH 05/13] Cleanup --- .../src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index c890e178fb81..5cb3310daa11 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -175,7 +175,7 @@ const IndictmentOverview: FC = () => { defendant.subpoenas?.map( (subpoena) => isSuccessfulServiceStatus(subpoena.serviceStatus) && ( - + Date: Thu, 7 Nov 2024 14:54:16 +0000 Subject: [PATCH 06/13] Merge --- .../routes/Shared/IndictmentOverview/IndictmentOverview.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index 5cb3310daa11..3874902c5df6 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -29,16 +29,15 @@ import { PageHeader, PageLayout, PageTitle, + serviceAnnouncementStrings, useIndictmentsLawsBroken, UserContext, - serviceAnnouncementStrings, } from '@island.is/judicial-system-web/src/components' import { CaseIndictmentRulingDecision, CaseState, Defendant, IndictmentDecision, - ServiceStatus, Subpoena, UserRole, } from '@island.is/judicial-system-web/src/graphql/schema' From 2deeef3e2baac115a5b904b1d6575b63b7ad78d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Fri, 8 Nov 2024 09:27:48 +0000 Subject: [PATCH 07/13] Add key --- .../routes/Shared/IndictmentOverview/IndictmentOverview.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index 3874902c5df6..a721658c2961 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -174,9 +174,8 @@ const IndictmentOverview: FC = () => { defendant.subpoenas?.map( (subpoena) => isSuccessfulServiceStatus(subpoena.serviceStatus) && ( - + From a0133c19919607b8f8a720ac1084f704792c97cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Fri, 8 Nov 2024 09:49:26 +0000 Subject: [PATCH 08/13] Refactor --- .../IndictmentOverview/IndictmentOverview.tsx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index a721658c2961..1e0fb589b153 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -145,6 +145,7 @@ const IndictmentOverview: FC = () => { [router, workingCase.id], ) + console.log('asdasd') return ( { {isDefenceUser(user) && workingCase.defendants?.map((defendant) => - defendant.subpoenas?.map( - (subpoena) => - isSuccessfulServiceStatus(subpoena.serviceStatus) && ( - - - - ), - ), + (defendant.subpoenas ?? []) + .filter((subpoena) => + isSuccessfulServiceStatus(subpoena.serviceStatus), + ) + .map((subpoena) => ( + + + + )), )} {caseHasBeenReceivedByCourt && workingCase.court && From 9079a4c905a0f1c71c24d9fe39e5cce68bdca70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Fri, 8 Nov 2024 10:00:55 +0000 Subject: [PATCH 09/13] Remove console.log --- .../src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx index 1e0fb589b153..d41198200eab 100644 --- a/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx +++ b/apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx @@ -145,7 +145,6 @@ const IndictmentOverview: FC = () => { [router, workingCase.id], ) - console.log('asdasd') return ( Date: Tue, 12 Nov 2024 21:39:39 +0000 Subject: [PATCH 10/13] Refactoring --- .../InfoCard/DefendantInfo/DefendantInfo.tsx | 45 ++++++++++--------- .../Indictments/Overview/Overview.tsx | 2 +- 2 files changed, 26 insertions(+), 21 deletions(-) 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/routes/Prosecutor/Indictments/Overview/Overview.tsx b/apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx index 16b42ebf02e1..e017f10e4aa3 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) && ( From 4f283d9a5a3626a455723e736c42b5b796df80b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 13 Nov 2024 09:06:09 +0000 Subject: [PATCH 11/13] Merge --- libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx index 8652ed40b1e1..bcacc79afd0e 100644 --- a/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx +++ b/libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx @@ -54,7 +54,7 @@ const variantStyles: VariantStyles = { }, } -interface AlertMessageProps { +export interface AlertMessageProps { type: AlertMessageType testid?: string action?: ReactNode From 6081f151f0bdb6f51f8584c5f8a7e311fcd594c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 13 Nov 2024 09:22:55 +0000 Subject: [PATCH 12/13] Show to prosecutors --- .../web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e017f10e4aa3..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) && ( From 92e8e194b8ba06c0fee1aa6a6a1234ae5ae7134e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dvar=20Oddsson?= Date: Wed, 13 Nov 2024 09:52:11 +0000 Subject: [PATCH 13/13] Fix tests --- .../web/src/components/InfoCard/InfoCard.spec.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() }) })