File tree Expand file tree Collapse file tree
components/domain/EmergencyLessonsLearnedFromPreviousOperations
packages/ui/src/components/HtmlOutput Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useState } from 'react' ;
12import { Container } from '@ifrc-go/ui' ;
23import { useTranslation } from '@ifrc-go/ui/hooks' ;
34import { 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
1519import i18n from './i18n.json' ;
1620
21+ type OpsLearningSummaryResponse = GoApiResponse < '/api/v2/ops-learning/summary/' > ;
22+
1723interface 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 (
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 33 margin : var (--go-ui-spacing-xs );
44 }
55
6+ img {
7+ max-width : 100% ;
8+ }
9+
610 iframe {
711 width : 100% ;
812 }
You can’t perform that action at this time.
0 commit comments