1- import { useCallback , useEffect , useRef , useState } from 'react'
1+ import React , { useCallback , useEffect , useRef , useState } from 'react'
22import { QueryPoint , QueryPointType , QueryStoreState , RequestState } from '@/stores/QueryStore'
33import { RouteStoreState } from '@/stores/RouteStore'
44import { ErrorStoreState } from '@/stores/ErrorStore'
@@ -13,6 +13,11 @@ import CloseInputsIcon from './unfold_less.svg'
1313import CustomModelBox from '@/sidebar/CustomModelBox'
1414import { Map } from 'ol'
1515import { Coordinate } from '@/utils'
16+ import PlainButton from '@/PlainButton'
17+ import { tr } from '@/translation/Translation'
18+ import Chevron from '@/sidebar/search/routingProfiles/chevron.svg'
19+ import { icons } from '@/sidebar/search/routingProfiles/profileIcons'
20+ import { RoutingProfile } from '@/api/graphhopper'
1621
1722type MobileSidebarProps = {
1823 query : QueryStoreState
@@ -53,7 +58,11 @@ export default function ({ query, route, error, encodedValues, drawAreas, map }:
5358 < div className = { styles . sidebar } >
5459 < div className = { styles . background } ref = { searchContainerRef } >
5560 { isSmallSearchView ? (
56- < SmallSearchView points = { query . queryPoints } onClick = { ( ) => setIsSmallSearchView ( false ) } />
61+ < SmallSearchView
62+ selectedProfile = { query . routingProfile }
63+ points = { query . queryPoints }
64+ onClick = { ( ) => setIsSmallSearchView ( false ) }
65+ />
5766 ) : (
5867 < div className = { styles . btnCloseContainer } >
5968 < div className = { styles . btnCloseInputs } onClick = { ( ) => setIsSmallSearchView ( true ) } >
@@ -88,13 +97,15 @@ function hasResult(route: RouteStoreState) {
8897 return route . routingResult . paths . length > 0
8998}
9099
91- function SmallSearchView ( props : { points : QueryPoint [ ] ; onClick : ( ) => void } ) {
100+ function SmallSearchView ( props : { points : QueryPoint [ ] ; selectedProfile : RoutingProfile ; onClick : ( ) => void } ) {
92101 const from = props . points [ 0 ]
93102 const to = props . points [ props . points . length - 1 ]
94103 const isSmallHeight = useMediaQuery ( { query : '(max-height: 36rem)' } )
104+ let icon = icons [ props . selectedProfile . name ]
95105
96106 return (
97107 < div className = { styles . btnOpenContainer } onClick = { props . onClick } >
108+ < div className = { styles . profile } > { React . createElement ( icon ) } </ div >
98109 < div className = { styles . mapView } >
99110 { ! isSmallHeight && < SmallQueryPoint text = { from . queryText } color = { from . color } position = { from . type } /> }
100111 { ! isSmallHeight && < IntermediatePoint points = { props . points } /> }
0 commit comments