From d018b13605d634148ee0f5843a4d3dc76729a09d Mon Sep 17 00:00:00 2001 From: Sameer Rai Date: Mon, 18 Nov 2024 16:04:27 +0545 Subject: [PATCH] fix: operational learning bug fixes --- .../AllExtractsModal/Extract/i18n.json | 2 +- .../AllExtractsModal/Extract/index.tsx | 8 ++-- .../Sources/AllExtractsModal/index.tsx | 4 +- .../Sources/Emergency/index.tsx | 4 +- .../OperationalLearning/Sources/index.tsx | 4 +- app/src/views/OperationalLearning/index.tsx | 38 +++++++++---------- .../OperationalLearning/styles.module.css | 7 +--- 7 files changed, 30 insertions(+), 37 deletions(-) diff --git a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/i18n.json b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/i18n.json index dbd2d7d18..2e51495c0 100644 --- a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/i18n.json +++ b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/i18n.json @@ -2,6 +2,6 @@ "namespace": "extracts", "strings": { "source": "Source", - "dateOfLearning": "Date of Learning" + "dateOfOperation": "Date of Operation" } } diff --git a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx index bba6abc40..db02995de 100644 --- a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx +++ b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx @@ -15,7 +15,7 @@ interface Props { emergencyName: string | null | undefined; appealDocumentURL: string; extract: string | null | undefined; - extractCreatedAt: string; + operationStartDate: string; } function Extract(props: Props) { const { @@ -24,7 +24,7 @@ function Extract(props: Props) { emergencyName, appealDocumentURL, extract, - extractCreatedAt, + operationStartDate, } = props; const strings = useTranslation(i18n); @@ -57,8 +57,8 @@ function Extract(props: Props) { )} footerContent={( diff --git a/app/src/views/OperationalLearning/Sources/AllExtractsModal/index.tsx b/app/src/views/OperationalLearning/Sources/AllExtractsModal/index.tsx index c0069bbb1..47d7e769f 100644 --- a/app/src/views/OperationalLearning/Sources/AllExtractsModal/index.tsx +++ b/app/src/views/OperationalLearning/Sources/AllExtractsModal/index.tsx @@ -75,9 +75,9 @@ function AllExtractsModal(props: Props) { countryName: countries.find((country) => country.id === learning.appeal?.country)?.name, emergencyId: learning.appeal?.event_details?.id, emergencyName: learning.appeal?.event_details?.name, - appealDocumentURL: learning.document_url, + appealDocumentURL: learning?.document_url, extract: learning.learning_validated, - extractCreatedAt: learning.created_at, + operationStartDate: learning.appeal?.start_date, }); const opsLearningCount = opsLearningResponse?.count ?? 0; diff --git a/app/src/views/OperationalLearning/Sources/Emergency/index.tsx b/app/src/views/OperationalLearning/Sources/Emergency/index.tsx index dd63b51a1..d15a8d0f2 100644 --- a/app/src/views/OperationalLearning/Sources/Emergency/index.tsx +++ b/app/src/views/OperationalLearning/Sources/Emergency/index.tsx @@ -6,9 +6,9 @@ import Link from '#components/Link'; import styles from './styles.module.css'; interface Props { - emergencyId?: number; + emergencyId: number | null | undefined; emergencyName: string | null | undefined; - appealDocumentURL?: string; + appealDocumentURL: string | null | undefined; appealDocumentName: string | null | undefined; } function Emergency(props: Props) { diff --git a/app/src/views/OperationalLearning/Sources/index.tsx b/app/src/views/OperationalLearning/Sources/index.tsx index 7e47513be..f96ecc47c 100644 --- a/app/src/views/OperationalLearning/Sources/index.tsx +++ b/app/src/views/OperationalLearning/Sources/index.tsx @@ -83,8 +83,8 @@ function Sources(props: Props) { }); const appealRendererParams = (_: number, appealDocument: AppealDocument) => ({ - emergencyId: appealDocument.appeal.event.id, - emergencyName: appealDocument.appeal.event.name, + emergencyId: appealDocument.appeal.event?.id, + emergencyName: appealDocument.appeal.event?.name, appealDocumentURL: appealDocument.document_url, appealDocumentName: appealDocument.name, }); diff --git a/app/src/views/OperationalLearning/index.tsx b/app/src/views/OperationalLearning/index.tsx index e0df28f32..52117b780 100644 --- a/app/src/views/OperationalLearning/index.tsx +++ b/app/src/views/OperationalLearning/index.tsx @@ -3,7 +3,6 @@ import { useMemo, useState, } from 'react'; -import { InfoIcon } from '@ifrc-go/icons'; import { Button, Chip, @@ -303,26 +302,23 @@ export function Component() { mainSectionClassName={styles.mainSection} infoContainerClassName={styles.oldDashboardInfo} info={( - <> - -
- {resolveToComponent( - strings.disclaimerMessage, - { - link: ( - - {strings.here} - - ), - }, - )} -
- +
+ {resolveToComponent( + strings.disclaimerMessage, + { + link: ( + + {strings.here} + + ), + }, + )} +
)} >