From 3f9aa4f4d45a26398ed7a02c2b202302f4b7b122 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 --- .../components/domain/ExportButton/i18n.json | 4 +- .../components/domain/ExportButton/index.tsx | 8 ++-- .../OperationalLearning/Filters/i18n.json | 2 +- .../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 +--- 10 files changed, 37 insertions(+), 44 deletions(-) diff --git a/app/src/components/domain/ExportButton/i18n.json b/app/src/components/domain/ExportButton/i18n.json index 59505eeee..10f101de8 100644 --- a/app/src/components/domain/ExportButton/i18n.json +++ b/app/src/components/domain/ExportButton/i18n.json @@ -1,8 +1,8 @@ { "namespace": "common", "strings": { - "exportTableButtonLabel": "Export", - "exportTableDownloadingButtonLabel": "Downloading... ({progress}%)", + "exportButtonLabel": "Export", + "exportDownloadingButtonLabel": "Downloading... ({progress}%)", "pendingExportLabel": "Downloading..." } } diff --git a/app/src/components/domain/ExportButton/index.tsx b/app/src/components/domain/ExportButton/index.tsx index 5d21be37f..8f845f4ce 100644 --- a/app/src/components/domain/ExportButton/index.tsx +++ b/app/src/components/domain/ExportButton/index.tsx @@ -29,11 +29,11 @@ function ExportButton(props: Props) { const exportButtonLabel = useMemo(() => { if (!pendingExport) { - return strings.exportTableButtonLabel; + return strings.exportButtonLabel; } if (progress) { return resolveToComponent( - strings.exportTableDownloadingButtonLabel, + strings.exportDownloadingButtonLabel, { progress: ( 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} + + ), + }, + )} +
)} >