@@ -6,6 +6,7 @@ import { getSchedulingSeriesOptions } from "../../../../selectors/eventSelectors
6
6
import { useAppSelector } from "../../../../store" ;
7
7
import { FormikProps } from "formik" ;
8
8
import { EditedEvents } from "../../../../slices/eventSlice" ;
9
+ import { ParseKeys } from "i18next" ;
9
10
10
11
/**
11
12
* This component renders the summary page of the edit scheduled bulk action
@@ -15,6 +16,16 @@ interface RequiredFormProps {
15
16
changedEvents : string [ ] ,
16
17
}
17
18
19
+ type Change = {
20
+ eventId : string ,
21
+ title : string ,
22
+ changes : {
23
+ type : ParseKeys ,
24
+ previous : string ,
25
+ next : string
26
+ } [ ]
27
+ }
28
+
18
29
const EditScheduledEventsSummaryPage = < T extends RequiredFormProps > ( {
19
30
previousPage,
20
31
formik,
@@ -25,7 +36,7 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
25
36
const { t } = useTranslation ( ) ;
26
37
27
38
// Changes applied to events
28
- const [ changes , setChanges ] = useState < { eventId : string , title : string , changes : { type : string , previous : string , next : string } [ ] } [ ] > ( [ ] ) ;
39
+ const [ changes , setChanges ] = useState < Change [ ] > ( [ ] ) ;
29
40
30
41
const seriesOptions = useAppSelector ( state => getSchedulingSeriesOptions ( state ) ) ;
31
42
@@ -36,11 +47,11 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
36
47
} , [ ] ) ;
37
48
38
49
const checkForChanges = ( ) => {
39
- let changed : { eventId : string , title : string , changes : { type : string , previous : string , next : string } [ ] } [ ] = [ ] ;
50
+ let changed : Change [ ] = [ ] ;
40
51
41
52
// Loop through each event selected for editing and compare original values and changed values
42
53
for ( const event of formik . values . editedEvents ) {
43
- let eventChanges : { eventId : string , title : string , changes : { type : string , previous : string , next : string } [ ] } = {
54
+ let eventChanges : Change = {
44
55
eventId : event . eventId ,
45
56
title : event . title ,
46
57
changes : [ ] ,
@@ -110,8 +121,8 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
110
121
if ( isChanged ( event . weekday , event . changedWeekday ) ) {
111
122
eventChanges . changes . push ( {
112
123
type : "EVENTS.EVENTS.TABLE.WEEKDAY" ,
113
- previous : t ( " EVENTS.EVENTS.NEW.WEEKDAYSLONG." + event . weekday ) ,
114
- next : t ( " EVENTS.EVENTS.NEW.WEEKDAYSLONG." + event . changedWeekday ) ,
124
+ previous : t ( ` EVENTS.EVENTS.NEW.WEEKDAYSLONG.${ event . weekday } ` ) ,
125
+ next : t ( ` EVENTS.EVENTS.NEW.WEEKDAYSLONG.${ event . changedWeekday } ` ) ,
115
126
} ) ;
116
127
}
117
128
0 commit comments