Skip to content

Commit

Permalink
fix: operational learning bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Nov 20, 2024
1 parent 3c6f331 commit 3f9aa4f
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 44 deletions.
4 changes: 2 additions & 2 deletions app/src/components/domain/ExportButton/i18n.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"namespace": "common",
"strings": {
"exportTableButtonLabel": "Export",
"exportTableDownloadingButtonLabel": "Downloading... ({progress}%)",
"exportButtonLabel": "Export",
"exportDownloadingButtonLabel": "Downloading... ({progress}%)",
"pendingExportLabel": "Downloading..."
}
}
8 changes: 4 additions & 4 deletions app/src/components/domain/ExportButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
<NumberOutput
Expand All @@ -46,8 +46,8 @@ function ExportButton(props: Props) {
}
return strings.pendingExportLabel;
}, [
strings.exportTableButtonLabel,
strings.exportTableDownloadingButtonLabel,
strings.exportButtonLabel,
strings.exportDownloadingButtonLabel,
strings.pendingExportLabel,
progress,
pendingExport,
Expand Down
2 changes: 1 addition & 1 deletion app/src/views/OperationalLearning/Filters/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"filterDisasterTypePlaceholder": "All Disaster Types",
"filterSectorLabel": "Sector",
"filterSectorPlaceholder": "All Sectors",
"filterComponentLabel": "Component",
"filterComponentLabel": "PER Component",
"filterComponentPlaceholder": "All Components",
"filterOpsLearningSearchLabel": "Search",
"filterOpsLearningSearchPlaceholder": "Search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"namespace": "extracts",
"strings": {
"source": "Source",
"dateOfLearning": "Date of Learning"
"dateOfOperation": "Date of Operation"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,7 +24,7 @@ function Extract(props: Props) {
emergencyName,
appealDocumentURL,
extract,
extractCreatedAt,
operationStartDate,
} = props;

const strings = useTranslation(i18n);
Expand Down Expand Up @@ -57,8 +57,8 @@ function Extract(props: Props) {
)}
footerContent={(
<TextOutput
label={strings.dateOfLearning}
value={extractCreatedAt}
label={strings.dateOfOperation}
value={operationStartDate}
strongValue
valueType="date"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions app/src/views/OperationalLearning/Sources/Emergency/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/views/OperationalLearning/Sources/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
38 changes: 17 additions & 21 deletions app/src/views/OperationalLearning/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
useMemo,
useState,
} from 'react';
import { InfoIcon } from '@ifrc-go/icons';
import {
Button,
Chip,
Expand Down Expand Up @@ -303,26 +302,23 @@ export function Component() {
mainSectionClassName={styles.mainSection}
infoContainerClassName={styles.oldDashboardInfo}
info={(
<>
<InfoIcon className={styles.icon} />
<div className={styles.infoText}>
{resolveToComponent(
strings.disclaimerMessage,
{
link: (
<Link
href={opsLearningDashboardURL}
external
variant="tertiary"
withLinkIcon
>
{strings.here}
</Link>
),
},
)}
</div>
</>
<div className={styles.infoText}>
{resolveToComponent(
strings.disclaimerMessage,
{
link: (
<Link
href={opsLearningDashboardURL}
external
variant="tertiary"
withLinkIcon
>
{strings.here}
</Link>
),
},
)}
</div>
)}
>
<Container
Expand Down
7 changes: 2 additions & 5 deletions app/src/views/OperationalLearning/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@
color: var(--go-ui-color-text-light);
gap: var(--go-ui-spacing-xs);

.icon {
flex-shrink: 0;
font-size: var(--go-ui-height-icon-multiplier);
}

.info-text {
display: inline;
font-size: var(--go-ui-font-size-sm);
font-style: italic;
}
}
}
Expand Down

0 comments on commit 3f9aa4f

Please sign in to comment.