Skip to content

Commit

Permalink
fix(service-portal): fix defender info and alert (#16275)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
disaerna and kodiakhq[bot] authored Oct 4, 2024
1 parent d86d920 commit 47df0c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class LawAndOrderService {
const subpoena: SubpoenaResponse | undefined | null =
await this.api.getSubpoena(id, user, locale)

const defenderChoice = subpoena?.defenderInfo.defenderChoice
const defenderChoice = subpoena?.defenderInfo?.defenderChoice
const message = defenderChoice
? formatMessage(
DefenseChoices[subpoena?.defenderInfo.defenderChoice].message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const DocumentLineV3: FC<Props> = ({
const displayPdf = (
content?: DocumentV2Content,
actions?: Array<DocumentV2Action>,
alertMessageData?: DocumentV2Action,
) => {
setActiveDocument({
document: {
Expand All @@ -121,7 +122,7 @@ export const DocumentLineV3: FC<Props> = ({
img,
categoryId: documentLine.categoryId ?? undefined,
actions: actions,
alert: documentLine.alert ?? undefined,
alert: alertMessageData ?? undefined,
})
window.scrollTo({
top: 0,
Expand Down Expand Up @@ -155,8 +156,9 @@ export const DocumentLineV3: FC<Props> = ({
} else {
const docContent = data?.documentV2?.content
const actions = data?.documentV2?.actions ?? undefined
const alert = data?.documentV2?.alert ?? undefined
if (docContent) {
displayPdf(docContent, actions)
displayPdf(docContent, actions, alert)
setDocumentDisplayError(undefined)
setLocalRead([...localRead, documentLine.id])
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const Subpoena = () => {

const subpoena = data?.lawAndOrderSubpoena
const [defenderPopUp, setDefenderPopUp] = useState<boolean>(false)

if (
subpoena?.data &&
(!isDefined(subpoena.data.hasBeenServed) ||
Expand Down Expand Up @@ -121,7 +120,7 @@ const Subpoena = () => {
action: () => {
setDefenderPopUp(true)
},
disabled: !subpoena.data.canEditDefenderChoice,
disabled: subpoena.data.canEditDefenderChoice === false,
tooltip: subpoena.data.canEditDefenderChoice
? undefined
: subpoena.data.courtContactInfo ?? '',
Expand All @@ -138,7 +137,7 @@ const Subpoena = () => {
<Text>{formatMessage(messages.subpoenaInfoText2)}</Text>
</Box>

{!loading && !subpoena?.data.defenderChoice && (
{!loading && subpoena.data.canEditDefenderChoice === null && (
<DefenderChoices id={id} refetch={refetch} />
)}

Expand Down

0 comments on commit 47df0c0

Please sign in to comment.