1
- import React , { useState } from 'react' ;
1
+ import { useState } from 'react' ;
2
2
3
3
import { Checkbox } from '@osrd-project/ui-core' ;
4
- import { ChevronDown , Manchette } from '@osrd-project/ui-icons' ;
4
+ import { ChevronDown , Clock , Flame , Manchette , Moon } from '@osrd-project/ui-icons' ;
5
5
import cx from 'classnames' ;
6
6
7
+ import TimetableItemActions from '../TimetableItemActions' ;
7
8
import type { TrainScheduleWithDetails } from '../types' ;
9
+ import { Duration } from 'utils/duration' ;
10
+ import { ms2min } from 'utils/timeManipulation' ;
8
11
9
12
export type PacedTrain = TrainScheduleWithDetails & {
10
13
paced : {
@@ -31,6 +34,12 @@ const PacedTrainItem = ({
31
34
const [ isOpened , setIsOpened ] = useState ( false ) ;
32
35
33
36
const toggle = ( ) => setIsOpened ( ( open ) => ! open ) ;
37
+ const selectPathProjection = async ( ) => { } ;
38
+ const duplicatePacedTrain = async ( ) => { } ;
39
+ const editPacedTrain = ( ) => { } ;
40
+ const deletePacedTrain = async ( ) => { } ;
41
+
42
+ const stepDuration = Duration . parse ( pacedTrain . paced . step ) ;
34
43
35
44
return (
36
45
< div
@@ -66,6 +75,33 @@ const PacedTrainItem = ({
66
75
< span className = "train-name" > { pacedTrain . trainName } </ span >
67
76
</ div >
68
77
</ div >
78
+ { ! pacedTrain . invalidReason && (
79
+ < div className = "train-time" >
80
+ < div className = "status-icon after-midnight" > { true && < Moon /> } </ div >
81
+ { pacedTrain . isValid && (
82
+ < div className = "scenario-timetable-train-departure" >
83
+ { `- ${ ms2min ( stepDuration . ms ) } min` }
84
+ </ div >
85
+ ) }
86
+ < div className = "status-icon not-honored-or-too-fast" >
87
+ { pacedTrain . notHonoredReason &&
88
+ ( pacedTrain . notHonoredReason === 'scheduleNotHonored' ? < Clock /> : < Flame /> ) }
89
+ </ div >
90
+ < div
91
+ className = { cx ( 'status-dot' , {
92
+ 'not-honored-or-too-fast' :
93
+ pacedTrain . notHonoredReason === 'scheduleNotHonored' ||
94
+ pacedTrain . notHonoredReason === 'trainTooFast' ,
95
+ } ) }
96
+ />
97
+ </ div >
98
+ ) }
99
+ < TimetableItemActions
100
+ selectPathProjection = { selectPathProjection }
101
+ duplicateTimetableItem = { duplicatePacedTrain }
102
+ editTimetableItem = { editPacedTrain }
103
+ deleteTimetableItem = { deletePacedTrain }
104
+ />
69
105
</ div >
70
106
< div className = "occurancies" />
71
107
</ div >
0 commit comments