@@ -29,11 +29,13 @@ type RenderPopupProps = {
29
29
} ;
30
30
31
31
function RenderPopup ( { pathProperties } : RenderPopupProps ) {
32
- const { getFeatureInfoClick, getInfraID } = useOsrdConfSelectors ( ) ;
32
+ const { getFeatureInfoClick, getInfraID, getOriginV2 , getDestinationV2 } = useOsrdConfSelectors ( ) ;
33
33
const osrdConfActions = useOsrdConfActions ( ) ;
34
34
const { t } = useTranslation ( [ 'operationalStudies/manageTrainSchedule' ] ) ;
35
35
const featureInfoClick : FeatureInfoClickType = useSelector ( getFeatureInfoClick ) ;
36
36
const infraId = useSelector ( getInfraID ) ;
37
+ const origin = useSelector ( getOriginV2 ) ;
38
+ const destination = useSelector ( getDestinationV2 ) ;
37
39
38
40
const [ trackOffset , setTrackOffset ] = useState ( 0 ) ;
39
41
@@ -127,14 +129,18 @@ function RenderPopup({ pathProperties }: RenderPopupProps) {
127
129
< RiMapPin2Fill />
128
130
< span className = "d-none" > { t ( 'origin' ) } </ span >
129
131
</ button >
130
- < button
131
- className = "btn btn-sm btn-info"
132
- type = "button"
133
- onClick = { ( ) => setPointItiV2 ( 'via' , pathStepProperties , osrdConfActions , pathProperties ) }
134
- >
135
- < RiMapPin3Fill />
136
- < span className = "d-none" > { t ( 'via' ) } </ span >
137
- </ button >
132
+ { origin && destination && (
133
+ < button
134
+ className = "btn btn-sm btn-info"
135
+ type = "button"
136
+ onClick = { ( ) =>
137
+ setPointItiV2 ( 'via' , pathStepProperties , osrdConfActions , pathProperties )
138
+ }
139
+ >
140
+ < RiMapPin3Fill />
141
+ < span className = "d-none" > { t ( 'via' ) } </ span >
142
+ </ button >
143
+ ) }
138
144
< button
139
145
data-testid = "map-destination-button"
140
146
className = "btn btn-sm btn-warning"
0 commit comments