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