Skip to content

Commit a3c2797

Browse files
committed
fix(html-output): add maxWidth for img elements
1 parent 6c0f351 commit a3c2797

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

app/src/components/domain/EmergencyLessonsLearnedFromPreviousOperations/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useState } from 'react';
12
import { Container } from '@ifrc-go/ui';
23
import { useTranslation } from '@ifrc-go/ui/hooks';
34
import { isNotDefined } from '@togglecorp/fujs';
@@ -10,10 +11,15 @@ import {
1011
SUMMARY_STATUS_PENDING,
1112
SUMMARY_STATUS_SUCCESS,
1213
} from '#utils/domain/opsLearning';
13-
import { useRequest } from '#utils/restRequest';
14+
import {
15+
type GoApiResponse,
16+
useRequest,
17+
} from '#utils/restRequest';
1418

1519
import i18n from './i18n.json';
1620

21+
type OpsLearningSummaryResponse = GoApiResponse<'/api/v2/ops-learning/summary/'>;
22+
1723
interface Props {
1824
disasterType: number;
1925
country: number;
@@ -27,8 +33,12 @@ function EmergencyLessonsLearnedFromPreviousOperations(props: Props) {
2733

2834
const strings = useTranslation(i18n);
2935

36+
const [tmpResponse, setTmpResponse] = useState<OpsLearningSummaryResponse | undefined>(
37+
undefined,
38+
);
39+
3040
const {
31-
response: summaryResponse,
41+
response: summaryResponse = tmpResponse,
3242
pending: summaryPending,
3343
} = useRequest({
3444
url: '/api/v2/ops-learning/summary/',
@@ -46,11 +56,13 @@ function EmergencyLessonsLearnedFromPreviousOperations(props: Props) {
4656
|| value?.status === SUMMARY_NO_EXTRACT_AVAILABLE;
4757

4858
if (stopPolling) {
59+
setTmpResponse(value as OpsLearningSummaryResponse);
4960
return -1;
5061
}
5162

5263
return 5000;
5364
},
65+
preserveResponse: true,
5466
});
5567

5668
return (

app/src/views/EmergencyOverview/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ export function Component() {
150150

151151
const timelineEvents = useMemo(
152152
() => {
153+
if (emergencyStage === 'field-report') {
154+
return undefined;
155+
}
156+
153157
const events: EventTimelineItem[] = [];
154158

155159
if (isDefined(firstFieldReport)

packages/ui/src/components/HtmlOutput/styles.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
margin: var(--go-ui-spacing-xs);
44
}
55

6+
img {
7+
max-width: 100%;
8+
}
9+
610
iframe {
711
width: 100%;
812
}

0 commit comments

Comments
 (0)