@@ -6,6 +6,7 @@ import { getSchedulingSeriesOptions } from "../../../../selectors/eventSelectors
66import { useAppSelector } from "../../../../store" ;
77import { FormikProps } from "formik" ;
88import { EditedEvents } from "../../../../slices/eventSlice" ;
9+ import { ParseKeys } from "i18next" ;
910
1011/**
1112 * This component renders the summary page of the edit scheduled bulk action
@@ -15,6 +16,16 @@ interface RequiredFormProps {
1516 changedEvents : string [ ] ,
1617}
1718
19+ type Change = {
20+ eventId : string ,
21+ title : string ,
22+ changes : {
23+ type : ParseKeys ,
24+ previous : string ,
25+ next : string
26+ } [ ]
27+ }
28+
1829const EditScheduledEventsSummaryPage = < T extends RequiredFormProps > ( {
1930 previousPage,
2031 formik,
@@ -25,7 +36,7 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
2536 const { t } = useTranslation ( ) ;
2637
2738 // 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 [ ] > ( [ ] ) ;
2940
3041 const seriesOptions = useAppSelector ( state => getSchedulingSeriesOptions ( state ) ) ;
3142
@@ -36,11 +47,11 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
3647 } , [ ] ) ;
3748
3849 const checkForChanges = ( ) => {
39- let changed : { eventId : string , title : string , changes : { type : string , previous : string , next : string } [ ] } [ ] = [ ] ;
50+ let changed : Change [ ] = [ ] ;
4051
4152 // Loop through each event selected for editing and compare original values and changed values
4253 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 = {
4455 eventId : event . eventId ,
4556 title : event . title ,
4657 changes : [ ] ,
@@ -110,8 +121,8 @@ const EditScheduledEventsSummaryPage = <T extends RequiredFormProps>({
110121 if ( isChanged ( event . weekday , event . changedWeekday ) ) {
111122 eventChanges . changes . push ( {
112123 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 } ` ) ,
115126 } ) ;
116127 }
117128
0 commit comments