Skip to content

Commit 23c59a9

Browse files
committed
add separate access restriction route hint; updated i18n
1 parent 87992af commit 23c59a9

File tree

3 files changed

+224
-207
lines changed

3 files changed

+224
-207
lines changed

src/sidebar/RoutingResults.tsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,15 @@ function RoutingResult({
9090
? new RouteInfo()
9191
: getInfoFor(path.points, path.details.mtb_rating, s => s > 1)
9292

93-
const privateOrDeliveryInfo = ApiImpl.isMotorVehicle(profile)
93+
const privateInfo = ApiImpl.isMotorVehicle(profile)
94+
? getInfoFor(path.points, path.details.road_access, s => s === 'private')
95+
: new RouteInfo()
96+
97+
const deliveryEtcInfo = ApiImpl.isMotorVehicle(profile)
9498
? getInfoFor(
9599
path.points,
96100
path.details.road_access,
97-
s => s === 'private' || s === 'customers' || s === 'delivery'
101+
s => s === 'delivery' || s === 'customers' || s === 'destination'
98102
)
99103
: new RouteInfo()
100104
const badTrackInfo = !ApiImpl.isMotorVehicle(profile)
@@ -125,7 +129,7 @@ function RoutingResult({
125129
accessCondInfo.distance > 0 ||
126130
footAccessCondInfo.distance > 0 ||
127131
bikeAccessCondInfo.distance > 0 ||
128-
privateOrDeliveryInfo.distance > 0 ||
132+
privateInfo.distance > 0 ||
129133
trunkInfo.distance > 0 ||
130134
badTrackInfo.distance > 0 ||
131135
stepsInfo.distance > 0 ||
@@ -262,13 +266,26 @@ function RoutingResult({
262266
type={'private'}
263267
child={<PrivateIcon />}
264268
value={
265-
privateOrDeliveryInfo.distance > 0 &&
266-
metersToShortText(privateOrDeliveryInfo.distance, showDistanceInMiles)
269+
privateInfo.distance > 0 && metersToShortText(privateInfo.distance, showDistanceInMiles)
267270
}
268271
selected={selectedRH}
269-
segments={privateOrDeliveryInfo.segments}
272+
segments={privateInfo.segments}
270273
values={[]}
271274
/>
275+
<RHButton
276+
setDescription={b => setDescriptionRH(b)}
277+
description={tr('way_contains', [tr('restricted_sections')])}
278+
setType={t => setSelectedRH(t)}
279+
type={'delivery_etc'}
280+
child={<PrivateIcon />}
281+
value={
282+
deliveryEtcInfo.distance > 0 &&
283+
metersToShortText(deliveryEtcInfo.distance, showDistanceInMiles)
284+
}
285+
selected={selectedRH}
286+
segments={deliveryEtcInfo.segments}
287+
values={deliveryEtcInfo.values}
288+
/>
272289
<RHButton
273290
setDescription={b => setDescriptionRH(b)}
274291
description={tr('way_contains_toll')}

src/sidebar/search/Search.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from 'react'
1+
import { useState } from 'react'
22
import Dispatcher from '@/stores/Dispatcher'
33
import styles from '@/sidebar/search/Search.module.css'
44
import { QueryPoint } from '@/stores/QueryStore'
@@ -14,7 +14,7 @@ import { MarkerComponent } from '@/map/Marker'
1414
import { tr } from '@/translation/Translation'
1515
import SettingsBox from '@/sidebar/SettingsBox'
1616
import { RoutingProfile } from '@/api/graphhopper'
17-
import { Coordinate, getBBoxFromCoord } from '@/utils'
17+
import { getBBoxFromCoord } from '@/utils'
1818

1919
export default function Search({ points, profile, map }: { points: QueryPoint[]; profile: RoutingProfile; map: Map }) {
2020
const [showSettings, setShowSettings] = useState(false)

0 commit comments

Comments
 (0)