@@ -47,18 +47,18 @@ import styles from './styles.module.css';
47
47
48
48
type DeploymentsEruTypeEnum = components < 'read' > [ 'schemas' ] [ 'DeploymentsEruTypeEnum' ] ;
49
49
50
- type GetERUDeploymentsResponse = GoApiResponse < '/api/v2/deployed_eru_by_event/' > ;
51
- type ERUDeploymentListItem = NonNullable < GetERUDeploymentsResponse [ 'results' ] > [ number ] ;
52
- type ActiveERUListItem = NonNullable < ERUDeploymentListItem [ 'active_erus' ] > [ number ] ;
50
+ type GetEruByEventResponse = GoApiResponse < '/api/v2/deployed_eru_by_event/' > ;
51
+ type EruByEvent = NonNullable < GetEruByEventResponse [ 'results' ] > [ number ] ;
52
+ type EruListItem = NonNullable < EruByEvent [ 'active_erus' ] > [ number ] ;
53
53
54
- const eruResponsesKeySelector = ( item : ERUDeploymentListItem ) => item . id ;
54
+ const deployedEruKeySelector = ( item : EruByEvent ) => item . id ;
55
55
56
56
const emergencyResponseUnitTypeKeySelector = ( item : DeploymentsEruTypeEnum ) => item . key ;
57
57
const emergencyResponseUnitTypeLabelSelector = ( item : DeploymentsEruTypeEnum ) => item . value ?? '?' ;
58
58
59
59
const PAGE_SIZE = 5 ;
60
60
61
- function OngoingERUDeployments ( ) {
61
+ function OngoingEruDeployments ( ) {
62
62
const strings = useTranslation ( i18n ) ;
63
63
64
64
const {
@@ -80,11 +80,11 @@ function OngoingERUDeployments() {
80
80
deployments_eru_type : eruTypes ,
81
81
} = useGlobalEnums ( ) ;
82
82
83
- const [ expandedRow , setExpandedRow ] = useState < ERUDeploymentListItem | undefined > ( ) ;
83
+ const [ expandedRow , setExpandedRow ] = useState < EruByEvent | undefined > ( ) ;
84
84
85
85
const {
86
- pending : deployedERUResponsePending ,
87
- response : deployedERUResponse ,
86
+ pending : deployedEruResponsePending ,
87
+ response : deployedEruResponse ,
88
88
} = useRequest ( {
89
89
url : '/api/v2/deployed_eru_by_event/' ,
90
90
preserveResponse : true ,
@@ -96,11 +96,11 @@ function OngoingERUDeployments() {
96
96
} ) ;
97
97
98
98
const eruEventDates = useMemo ( ( ) => {
99
- if ( isNotDefined ( deployedERUResponse ) ) {
99
+ if ( isNotDefined ( deployedEruResponse ) ) {
100
100
return undefined ;
101
101
}
102
- return getEruEventDates ( deployedERUResponse . results ) ;
103
- } , [ deployedERUResponse ] ) ;
102
+ return getEruEventDates ( deployedEruResponse . results ) ;
103
+ } , [ deployedEruResponse ] ) ;
104
104
105
105
const timelineDateRange = useMemo ( ( ) => {
106
106
if ( isNotDefined ( eruEventDates ) ) {
@@ -117,7 +117,7 @@ function OngoingERUDeployments() {
117
117
} , [ eruEventDates ] ) ;
118
118
119
119
const handleExpandClick = useCallback (
120
- ( row : ERUDeploymentListItem ) => {
120
+ ( row : EruByEvent ) => {
121
121
setExpandedRow (
122
122
( prevValue ) => ( prevValue ?. id === row . id ? undefined : row ) ,
123
123
) ;
@@ -127,9 +127,9 @@ function OngoingERUDeployments() {
127
127
128
128
const columns = useMemo (
129
129
( ) => ( [
130
- createLinkColumn < ERUDeploymentListItem , number > (
130
+ createLinkColumn < EruByEvent , number > (
131
131
'name' ,
132
- strings . deployedERUEmergency ,
132
+ strings . eruEmergency ,
133
133
( item ) => item . name ,
134
134
( item ) => ( {
135
135
to : 'emergenciesLayout' ,
@@ -138,13 +138,13 @@ function OngoingERUDeployments() {
138
138
} ,
139
139
} ) ,
140
140
) ,
141
- createStringColumn < ERUDeploymentListItem , number > (
141
+ createStringColumn < EruByEvent , number > (
142
142
'organisation' ,
143
- strings . deployedERUOrganisation ,
143
+ strings . eruOrganisation ,
144
144
( ) => '' ,
145
145
{ columnClassName : styles . organisation } ,
146
146
) ,
147
- createMultiTimelineColumn < ERUDeploymentListItem , number > (
147
+ createMultiTimelineColumn < EruByEvent , number > (
148
148
'timeline' ,
149
149
timelineDateRange ,
150
150
( item ) => {
@@ -154,15 +154,15 @@ function OngoingERUDeployments() {
154
154
endDate : itemDateRange ?. appealEndDate ,
155
155
highlightedStartDate : itemDateRange ?. eruStartDate ,
156
156
highlightedEndDate : itemDateRange ?. eruEndDate ,
157
- startDateLabel : strings . deployedAppealStartDate ,
158
- endDateLabel : strings . deployedAppealEndDate ,
159
- highlightedStartDateLabel : strings . deployedERUStartDate ,
160
- highlightedEndDateLabel : strings . deployedERUEndDate ,
157
+ startDateLabel : strings . ongoingEmergencyStartDate ,
158
+ endDateLabel : strings . ongoingEmergencyEndDate ,
159
+ highlightedStartDateLabel : strings . eruStartDate ,
160
+ highlightedEndDateLabel : strings . eruEndDate ,
161
161
} ;
162
162
} ,
163
163
{ columnClassName : styles . timeline } ,
164
164
) ,
165
- createExpandColumn < ERUDeploymentListItem , number > (
165
+ createExpandColumn < EruByEvent , number > (
166
166
'expandRow' ,
167
167
'' ,
168
168
( row ) => ( {
@@ -175,28 +175,28 @@ function OngoingERUDeployments() {
175
175
handleExpandClick ,
176
176
expandedRow ,
177
177
timelineDateRange ,
178
- strings . deployedERUEmergency ,
179
- strings . deployedERUOrganisation ,
180
- strings . deployedAppealStartDate ,
181
- strings . deployedAppealEndDate ,
182
- strings . deployedERUStartDate ,
183
- strings . deployedERUEndDate ,
178
+ strings . eruEmergency ,
179
+ strings . eruOrganisation ,
180
+ strings . ongoingEmergencyStartDate ,
181
+ strings . ongoingEmergencyEndDate ,
182
+ strings . eruStartDate ,
183
+ strings . eruEndDate ,
184
184
] ,
185
185
) ;
186
186
187
187
const eruColumns = useMemo (
188
188
( ) => ( [
189
- createStringColumn < ActiveERUListItem , number > (
189
+ createStringColumn < EruListItem , number > (
190
190
'name' ,
191
- strings . deployedERUName ,
191
+ strings . eruName ,
192
192
( item ) => item ?. type_display ,
193
193
) ,
194
- createStringColumn < ActiveERUListItem , number > (
194
+ createStringColumn < EruListItem , number > (
195
195
'society_name' ,
196
- strings . deployedERUOrganisation ,
196
+ strings . eruOrganisation ,
197
197
( item ) => item ?. eru_owner_details ?. national_society_country_details . society_name ,
198
198
) ,
199
- createTimelineColumn < ActiveERUListItem , number > (
199
+ createTimelineColumn < EruListItem , number > (
200
200
'timeline' ,
201
201
timelineDateRange ,
202
202
( item ) => ( {
@@ -205,17 +205,17 @@ function OngoingERUDeployments() {
205
205
} ) ,
206
206
{ columnClassName : styles . timeline } ,
207
207
) ,
208
- createEmptyColumn < ActiveERUListItem , number > ( ) ,
208
+ createEmptyColumn < EruListItem , number > ( ) ,
209
209
] ) ,
210
210
[
211
211
timelineDateRange ,
212
- strings . deployedERUOrganisation ,
213
- strings . deployedERUName ,
212
+ strings . eruOrganisation ,
213
+ strings . eruName ,
214
214
] ,
215
215
) ;
216
216
217
217
const rowModifier = useCallback (
218
- ( { row, datum } : RowOptions < ERUDeploymentListItem , number > ) => {
218
+ ( { row, datum } : RowOptions < EruByEvent , number > ) => {
219
219
if ( datum . id !== expandedRow ?. id ) {
220
220
return row ;
221
221
}
@@ -243,12 +243,12 @@ function OngoingERUDeployments() {
243
243
return (
244
244
< Container
245
245
className = { styles . ongoingEruDeployments }
246
- heading = { strings . deployedERUHeading }
246
+ heading = { strings . eruHeading }
247
247
withHeaderBorder
248
248
footerActions = { (
249
249
< Pager
250
250
activePage = { page }
251
- itemsCount = { deployedERUResponse ?. count ?? 0 }
251
+ itemsCount = { deployedEruResponse ?. count ?? 0 }
252
252
maxItemsPerPage = { limit }
253
253
onActivePageChange = { setPage }
254
254
/>
@@ -259,12 +259,12 @@ function OngoingERUDeployments() {
259
259
withLinkIcon
260
260
withUnderline
261
261
>
262
- { strings . deployedERUViewAll }
262
+ { strings . eruViewAll }
263
263
</ Link >
264
264
) }
265
265
filters = { (
266
266
< SelectInput
267
- placeholder = { strings . deployedERUTypes }
267
+ placeholder = { strings . eruTypes }
268
268
name = "type"
269
269
value = { rawFilter . type }
270
270
onChange = { setFilterField }
@@ -276,11 +276,11 @@ function OngoingERUDeployments() {
276
276
footerContent = { (
277
277
< >
278
278
< LegendItem
279
- label = { strings . deploymentsERUEmergencyTimeline }
279
+ label = { strings . eruEmergencyTimeline }
280
280
color = { COLOR_LIGHT_GREY }
281
281
/>
282
282
< LegendItem
283
- label = { strings . deploymentsERUDates }
283
+ label = { strings . eruDeploymentTimeline }
284
284
color = { COLOR_PRIMARY_RED }
285
285
/>
286
286
</ >
@@ -289,16 +289,16 @@ function OngoingERUDeployments() {
289
289
< SortContext . Provider value = { sortState } >
290
290
< Table
291
291
className = { styles . table }
292
- pending = { deployedERUResponsePending }
292
+ pending = { deployedEruResponsePending }
293
293
columns = { columns }
294
294
rowModifier = { rowModifier }
295
- keySelector = { eruResponsesKeySelector }
296
- data = { deployedERUResponse ?. results }
295
+ keySelector = { deployedEruKeySelector }
296
+ data = { deployedEruResponse ?. results }
297
297
filtered = { filtered }
298
298
/>
299
299
</ SortContext . Provider >
300
300
</ Container >
301
301
) ;
302
302
}
303
303
304
- export default OngoingERUDeployments ;
304
+ export default OngoingEruDeployments ;
0 commit comments