1
- import { ChevronLeft , Eye , EyeClosed , Pencil } from '@osrd-project/ui-icons' ;
1
+ import { ChevronLeft , Pencil } from '@osrd-project/ui-icons' ;
2
2
import { useTranslation } from 'react-i18next' ;
3
- import { GiElectric } from 'react-icons/gi' ;
4
3
5
4
import InfraLoadingState from 'applications/operationalStudies/components/Scenario/InfraLoadingState' ;
6
- import infraLogo from 'assets/pictures/components/tracks.svg' ;
7
5
import type { InfraWithState , ScenarioResponse } from 'common/api/osrdEditoastApi' ;
8
6
import { useModal } from 'common/BootstrapSNCF/ModalSNCF' ;
9
7
import AddAndEditScenarioModal from 'modules/scenario/components/AddOrEditScenarioModal' ;
@@ -12,31 +10,43 @@ type ScenarioDescriptionProps = {
12
10
scenario : ScenarioResponse ;
13
11
infra ?: InfraWithState ;
14
12
infraReloadCount : number ;
15
- showTrainDetails : boolean ;
16
- toggleTrainDetails : ( ) => void ;
17
13
collapseTimetable : ( ) => void ;
18
14
} ;
19
15
20
16
const ScenarioDescription = ( {
21
17
scenario,
22
18
infra,
23
19
infraReloadCount,
24
- showTrainDetails,
25
- toggleTrainDetails,
26
20
collapseTimetable,
27
21
} : ScenarioDescriptionProps ) => {
28
22
const { t } = useTranslation ( 'operationalStudies/scenario' ) ;
29
23
const { openModal } = useModal ( ) ;
30
24
31
25
return (
32
- < div className = "scenario-details" >
26
+ < div >
33
27
< div className = "scenario-details-name" >
34
28
< span className = "flex-grow-1 scenario-name text-truncate" title = { scenario . name } >
35
29
{ scenario . name }
36
30
</ span >
31
+ </ div >
32
+
33
+ < div className = "scenario-description" >
34
+ { scenario . description && (
35
+ < div className = "scenario-details-description" > { scenario . description } </ div >
36
+ ) }
37
+ < div className = "flex justify-end" >
38
+ < button
39
+ type = "button"
40
+ className = "scenario-collapse-button"
41
+ aria-label = { t ( 'toggleTimetable' ) }
42
+ onClick = { ( ) => collapseTimetable ( ) }
43
+ >
44
+ < ChevronLeft />
45
+ </ button >
46
+ </ div >
37
47
< button
38
48
data-testid = "editScenario"
39
- className = "scenario-details-modify-button "
49
+ className = "update-scenario "
40
50
type = "button"
41
51
aria-label = { t ( 'editScenario' ) }
42
52
onClick = { ( ) =>
@@ -50,42 +60,16 @@ const ScenarioDescription = ({
50
60
>
51
61
< Pencil />
52
62
</ button >
53
- < button
54
- type = "button"
55
- className = "scenario-details-modify-button"
56
- onClick = { toggleTrainDetails }
57
- title = { t ( 'displayTrainsWithDetails' ) }
58
- >
59
- { showTrainDetails ? < EyeClosed /> : < Eye /> }
60
- </ button >
61
- < button
62
- type = "button"
63
- className = "scenario-details-modify-button"
64
- aria-label = { t ( 'toggleTimetable' ) }
65
- onClick = { ( ) => collapseTimetable ( ) }
66
- >
67
- < ChevronLeft />
68
- </ button >
69
63
</ div >
70
- < div className = "row" >
71
- < div className = "col-md-6" >
72
- < div className = "scenario-details-infra-name" >
73
- < img src = { infraLogo } alt = "Infra logo" className = "infra-logo mr-2" />
74
- { infra && < InfraLoadingState infra = { infra } /> }
75
- < span className = "scenario-infra-name" > { scenario . infra_name } </ span >
76
- < small className = "ml-auto text-muted" > ID { scenario . infra_id } </ small >
77
- </ div >
78
- </ div >
79
- < div className = "col-md-6" >
80
- < div className = "scenario-details-electrical-profile-set" >
81
- < span className = "mr-2" >
82
- < GiElectric />
83
- </ span >
84
- { scenario . electrical_profile_set_id
85
- ? scenario . electrical_profile_set_id
86
- : t ( 'noElectricalProfileSet' ) }
87
- </ div >
88
- </ div >
64
+ < div className = "scenario-details-electrical-profile-set" >
65
+ { scenario . electrical_profile_set_id
66
+ ? scenario . electrical_profile_set_id
67
+ : t ( 'noElectricalProfileSet' ) }
68
+ </ div >
69
+
70
+ < div className = "scenario-details-infra-name" >
71
+ { t ( 'infrastructure' ) } : { infra && < InfraLoadingState infra = { infra } /> }
72
+ { scenario . infra_name } | ID { scenario . infra_id }
89
73
</ div >
90
74
{ infra &&
91
75
infra . state === 'TRANSIENT_ERROR' &&
@@ -101,7 +85,6 @@ const ScenarioDescription = ({
101
85
{ infra && infra . state === 'ERROR' && (
102
86
< div className = "scenario-details-infra-error mt-1" > { t ( 'errorMessages.hardErrorInfra' ) } </ div >
103
87
) }
104
- < div className = "scenario-details-description" > { scenario . description } </ div >
105
88
</ div >
106
89
) ;
107
90
} ;
0 commit comments