1
- import Select from 'react-select' ;
2
- import React , { FC , useContext , useMemo } from 'react' ;
1
+ import React , { FC , useContext } from 'react' ;
3
2
import { BsArrowBarRight , BsBoxArrowInRight } from 'react-icons/bs' ;
4
3
import { HiSwitchVertical } from 'react-icons/hi' ;
5
4
import { FaFlagCheckered } from 'react-icons/fa' ;
6
5
import { useTranslation } from 'react-i18next' ;
7
6
import { useDispatch , useSelector } from 'react-redux' ;
8
7
9
8
import { getInfraID } from 'reducers/osrdconf/selectors' ;
10
- import { BufferStopEntity , DetectorEntity , DIRECTIONS , WayPoint , WayPointEntity } from 'types' ;
9
+ import { BufferStopEntity , DetectorEntity , WayPoint , WayPointEntity } from 'types' ;
11
10
import EditorContext from 'applications/editor/context' ;
12
11
import { getEntity } from 'applications/editor/data/api' ;
13
12
import EntitySumUp from 'applications/editor/components/EntitySumUp' ;
@@ -20,20 +19,7 @@ export const EditEndpoints: FC<{ state: RouteState; onChange: (newState: RouteSt
20
19
onChange,
21
20
} ) => {
22
21
const { t } = useTranslation ( ) ;
23
- const { entryPoint, exitPoint, entryPointDirection } = state ;
24
-
25
- const options = useMemo (
26
- ( ) =>
27
- DIRECTIONS . map ( ( s ) => ( {
28
- value : s ,
29
- label : t ( `Editor.tools.routes-edition.directions.${ s } ` ) ,
30
- } ) ) ,
31
- [ t ]
32
- ) ;
33
- const option = useMemo (
34
- ( ) => options . find ( ( o ) => o . value === entryPointDirection ) || options [ 0 ] ,
35
- [ options , entryPointDirection ]
36
- ) ;
22
+ const { entryPoint, exitPoint } = state ;
37
23
38
24
return (
39
25
< >
@@ -45,22 +31,6 @@ export const EditEndpoints: FC<{ state: RouteState; onChange: (newState: RouteSt
45
31
wayPoint = { entryPoint }
46
32
onChange = { ( wayPoint ) => onChange ( { ...state , entryPoint : wayPoint } ) }
47
33
/>
48
- { entryPoint && (
49
- < div className = "d-flex flex-row align-items-baseline justify-content-center mb-2" >
50
- < span className = "mr-2" > { t ( 'Editor.tools.routes-edition.start_direction' ) } </ span >
51
- < Select
52
- value = { option }
53
- options = { options }
54
- onChange = { ( o ) => {
55
- if ( o )
56
- onChange ( {
57
- ...state ,
58
- entryPointDirection : o . value ,
59
- } ) ;
60
- } }
61
- />
62
- </ div >
63
- ) }
64
34
< div className = "text-center" >
65
35
< button
66
36
type = "button"
0 commit comments