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 18, 2024
1 parent 3c6f331 commit d018b13
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 37 deletions.
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 d018b13

Please sign in to comment.