@@ -2,7 +2,6 @@ import { useMemo, useState } from 'react';
2
2
3
3
import cx from 'classnames' ;
4
4
import dayjs from 'dayjs' ;
5
- import { compact } from 'lodash' ;
6
5
import { useTranslation } from 'react-i18next' ;
7
6
import { useSelector } from 'react-redux' ;
8
7
@@ -13,7 +12,6 @@ import ConflictsList from 'modules/conflict/components/ConflictsList';
13
12
import { updateSelectedTrainId } from 'reducers/simulationResults' ;
14
13
import { getTrainIdUsedForProjection } from 'reducers/simulationResults/selectors' ;
15
14
import { useAppDispatch } from 'store' ;
16
- import { distributedIntervalsFromArrayOfValues } from 'utils/numbers' ;
17
15
18
16
import TimetableToolbar from './TimetableToolbar' ;
19
17
import TimetableTrainCard from './TimetableTrainCard' ;
@@ -57,16 +55,6 @@ const Timetable = ({
57
55
const trainIdUsedForProjection = useSelector ( getTrainIdUsedForProjection ) ;
58
56
const dispatch = useAppDispatch ( ) ;
59
57
60
- const trainsDurationsIntervals = useMemo (
61
- ( ) =>
62
- displayedTrainSchedules . length > 0
63
- ? distributedIntervalsFromArrayOfValues (
64
- compact ( displayedTrainSchedules . map ( ( train ) => train . duration ) )
65
- )
66
- : [ ] ,
67
- [ displayedTrainSchedules ]
68
- ) ;
69
-
70
58
const toggleShowTrainDetails = ( ) => {
71
59
setShowTrainDetails ( ! showTrainDetails ) ;
72
60
} ;
@@ -152,30 +140,29 @@ const Timetable = ({
152
140
trainSchedules = { trainSchedules }
153
141
isInSelection = { selectedTrainIds . length > 0 }
154
142
/>
155
- { trainsDurationsIntervals &&
156
- displayedTrainSchedules . map ( ( train : TrainScheduleWithDetails , index ) => (
157
- < div key = { `timetable-train-card-${ train . id } -${ train . trainName } ` } >
158
- { showDepartureDates [ index ] && (
159
- < div className = "scenario-timetable-departure-date" >
160
- { currentDepartureDates [ index ] }
161
- </ div >
162
- ) }
163
- < TimetableTrainCard
164
- isInSelection = { selectedTrainIds . includes ( train . id ) }
165
- handleSelectTrain = { handleSelectTrain }
166
- train = { train }
167
- isSelected = { infraState === 'CACHED' && selectedTrainId === train . id }
168
- isModified = { train . id === trainIdToEdit }
169
- setDisplayTrainScheduleManagement = { setDisplayTrainScheduleManagement }
170
- upsertTrainSchedules = { upsertTrainSchedules }
171
- setTrainIdToEdit = { setTrainIdToEdit }
172
- removeTrains = { removeAndUnselectTrains }
173
- projectionPathIsUsed = {
174
- infraState === 'CACHED' && trainIdUsedForProjection === train . id
175
- }
176
- />
177
- </ div >
178
- ) ) }
143
+ { displayedTrainSchedules . map ( ( train : TrainScheduleWithDetails , index ) => (
144
+ < div key = { `timetable-train-card-${ train . id } -${ train . trainName } ` } >
145
+ { showDepartureDates [ index ] && (
146
+ < div className = "scenario-timetable-departure-date" >
147
+ { currentDepartureDates [ index ] }
148
+ </ div >
149
+ ) }
150
+ < TimetableTrainCard
151
+ isInSelection = { selectedTrainIds . includes ( train . id ) }
152
+ handleSelectTrain = { handleSelectTrain }
153
+ train = { train }
154
+ isSelected = { infraState === 'CACHED' && selectedTrainId === train . id }
155
+ isModified = { train . id === trainIdToEdit }
156
+ setDisplayTrainScheduleManagement = { setDisplayTrainScheduleManagement }
157
+ upsertTrainSchedules = { upsertTrainSchedules }
158
+ setTrainIdToEdit = { setTrainIdToEdit }
159
+ removeTrains = { removeAndUnselectTrains }
160
+ projectionPathIsUsed = {
161
+ infraState === 'CACHED' && trainIdUsedForProjection === train . id
162
+ }
163
+ />
164
+ </ div >
165
+ ) ) }
179
166
< div
180
167
className = { cx ( 'bottom-timetables-trains' , {
181
168
'empty-list' : trainSchedulesWithDetails . length === 0 ,
0 commit comments