Skip to content

Commit

Permalink
Merge branch 'main' into j-s/fix-empty-information-in-merged-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 2, 2025
2 parents 0737526 + e49258c commit ef6f2f6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
31 changes: 19 additions & 12 deletions apps/judicial-system/web/src/components/CaseInfo/CaseInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface Props {
workingCase: Case
}

export const Defendants: FC<Props> = ({ workingCase }) => {
const Defendants: FC<Props> = ({ workingCase }) => {
const { defendants, type } = workingCase
const { formatMessage } = useIntl()

Expand All @@ -82,12 +82,16 @@ export const Defendants: FC<Props> = ({ workingCase }) => {
)
}

export const Prosecutor: FC<Props> = ({ workingCase }) => {
const Prosecutor: FC<Props> = ({ workingCase }) => {
const { formatMessage } = useIntl()
if (!workingCase.prosecutorsOffice?.name) {
return null
}

return (
<Entry
label={formatMessage(core.prosecutor)}
value={workingCase.prosecutorsOffice?.name ?? ''}
value={workingCase.prosecutorsOffice.name}
/>
)
}
Expand All @@ -112,6 +116,17 @@ export const ProsecutorCaseInfo: FC<Props & { hideCourt?: boolean }> = ({
)
}

export const ProsecutorAndDefendantsEntries: FC<Props> = ({
workingCase,
}: {
workingCase: Case
}) => (
<>
<Prosecutor workingCase={workingCase} />
<Defendants workingCase={workingCase} />
</>
)

export const CourtCaseInfo: FC<Props> = ({ workingCase }) => {
const { formatMessage } = useIntl()

Expand All @@ -136,15 +151,7 @@ export const CourtCaseInfo: FC<Props> = ({ workingCase }) => {
</Text>
</Box>
) : (
<>
{workingCase.prosecutorsOffice?.name && (
<Entry
label={formatMessage(core.prosecutor)}
value={workingCase.prosecutorsOffice.name}
/>
)}
<Defendants workingCase={workingCase} />
</>
<ProsecutorAndDefendantsEntries workingCase={workingCase} />
)}
</Box>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
SectionHeading,
UserContext,
} from '@island.is/judicial-system-web/src/components'
import {
Defendants,
Prosecutor,
} from '@island.is/judicial-system-web/src/components/CaseInfo/CaseInfo'
import { ProsecutorAndDefendantsEntries } from '@island.is/judicial-system-web/src/components/CaseInfo/CaseInfo'
import {
CaseFile,
CaseFileCategory,
Expand Down Expand Up @@ -129,8 +126,7 @@ const Summary: FC = () => {
</Text>
</Box>
<Box component="section" marginBottom={2}>
<Prosecutor workingCase={workingCase} />
<Defendants workingCase={workingCase} />
<ProsecutorAndDefendantsEntries workingCase={workingCase} />
</Box>
<Box component="section" marginBottom={6}>
<InfoCardClosedIndictment />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@island.is/judicial-system/types'
import { titles } from '@island.is/judicial-system-web/messages'
import {
CourtCaseInfo,
FormContentContainer,
FormContext,
FormFooter,
Expand Down Expand Up @@ -112,6 +113,7 @@ const ReceptionAndAssignment = () => {
</Box>
)}
<PageTitle>{formatMessage(strings.title)}</PageTitle>
<CourtCaseInfo workingCase={workingCase} />
<Box component="section" marginBottom={6}>
<CourtCaseNumber />
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC, useContext, useMemo } from 'react'
import { useIntl } from 'react-intl'
import partition from 'lodash/partition'

import { AlertMessage, Box, Tag, Text } from '@island.is/island-ui/core'
import { AlertMessage, Box, Text } from '@island.is/island-ui/core'
import {
capitalize,
districtCourtAbbreviation,
Expand Down

0 comments on commit ef6f2f6

Please sign in to comment.