Skip to content

Commit 10be0d4

Browse files
committed
show profile in collapsed view too, fixes #431
1 parent 333ccf2 commit 10be0d4

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/sidebar/MobileSidebar.module.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,19 @@
9595
border-radius: 0.2rem;
9696
}
9797

98+
/* address often too wide and we need to truncate */
9899
.btnOpenContainer .mapView {
99-
width: calc(100% - 34px);
100+
width: calc(100% - 34px - 34px);
100101
}
101102

102103
.btnOpenInputs svg {
103104
color: #adadad;
104105
}
105106

106-
.btnOpenInputs {
107+
.btnOpenInputs,
108+
.profile {
109+
display: flex;
110+
flex-direction: column;
111+
justify-content: center;
107112
width: 34px;
108113
}

src/sidebar/MobileSidebar.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, useEffect, useRef, useState } from 'react'
1+
import React, { useCallback, useEffect, useRef, useState } from 'react'
22
import { QueryPoint, QueryPointType, QueryStoreState, RequestState } from '@/stores/QueryStore'
33
import { RouteStoreState } from '@/stores/RouteStore'
44
import { ErrorStoreState } from '@/stores/ErrorStore'
@@ -13,6 +13,11 @@ import CloseInputsIcon from './unfold_less.svg'
1313
import CustomModelBox from '@/sidebar/CustomModelBox'
1414
import { Map } from 'ol'
1515
import { 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

1722
type 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

Comments
 (0)