Skip to content

Commit d1ecb80

Browse files
Merge pull request #498 from opentripplanner/master-merge-fix
OTP-RR Release (November 10, 2021)
2 parents e2ddaec + f46dd6c commit d1ecb80

25 files changed

+535
-157
lines changed

__tests__/actions/__snapshots__/api.js.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Array [
3838
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
3939
"requestId": "abcd1239",
4040
"searchId": "abcd1234",
41-
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
41+
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234",
4242
},
4343
"type": "ROUTING_ERROR",
4444
},
@@ -67,7 +67,7 @@ Array [
6767
"error": [Error: Received error from server],
6868
"requestId": "abcd1240",
6969
"searchId": "abcd1237",
70-
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
70+
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1237",
7171
},
7272
"type": "ROUTING_ERROR",
7373
},
@@ -113,12 +113,12 @@ Array [
113113
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
114114
"requestId": "abcd1236",
115115
"searchId": "abcd1234",
116-
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
116+
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234",
117117
},
118118
"type": "ROUTING_ERROR",
119119
},
120120
],
121121
]
122122
`;
123123

124-
exports[`actions > api routingQuery should make a query to OTP: OTP Query Path 1`] = `"/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false"`;
124+
exports[`actions > api routingQuery should make a query to OTP: OTP Query Path 1`] = `"/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234"`;

example-config.yml

+26-3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ modes:
173173
transitModes:
174174
- mode: BUS
175175
label: Bus
176+
# A mode color can be added, used throughout the application,
177+
# most notably in the enhanced stop viewer bubble
178+
color: blue
176179
- mode: TRAM
177180
label: MAX & Streetcar
178181
- mode: RAIL
@@ -243,6 +246,13 @@ itinerary:
243246
# Whether the plan first/previous/next/last buttons should be shown along with
244247
# plan trip itineraries.
245248
showPlanFirstLastButtons: false
249+
# If multiple fares are returned by OTP, assign names to the fare keys here
250+
#fareKeyNameMap:
251+
# regular: "Transit Fare"
252+
# electronicRegular: "SmartCard Fare"
253+
# student: "Student Fare"
254+
# One fare will always be shown by default
255+
#defaultFareKey: electronicRegular
246256

247257
# The transitOperators key is a list of transit operators that can be used to
248258
# order transit agencies when sorting by route. Also, this can optionally
@@ -294,6 +304,15 @@ itinerary:
294304
# defaultRouteTextColor: '000000'
295305
# longNameSplitter: ' - '
296306
# order: 2
307+
# Use this config to overwrite the accessibility score gradation
308+
# map that ships with otp-ui
309+
#accessibilityScore:
310+
# gradationMap:
311+
# 0.0:
312+
# color: "#ffb5b9"
313+
# # The text can be overridden in the language section
314+
# text: 'Not Accessible'
315+
# icon: thumbs-down
297316

298317
### Use this config for the standard mode selector
299318
# modeGroups:
@@ -319,9 +338,13 @@ itinerary:
319338
# common:
320339
# accessModes:
321340
# bikeshare: Blue Bike
322-
# config:
323-
# menuItems:
324-
# demo-item: Demo Item
341+
# config:
342+
# acessibilityScore:
343+
# gradationMap:
344+
# 0.0: 'Not Accessible'
345+
# 0.9: 'Mostly Accessible'
346+
# menuItems:
347+
# demo-item: Demo Item
325348

326349
### Localization section to provide language/locale settings
327350
#localization:

i18n/en-US.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ components:
233233
stopsTo: "Towards"
234234
selectADirection: "Select a direction..."
235235
RouteRow:
236-
operatorLogoAltText: '{operatorName} logo'
236+
operatorLogoAltText: "{operatorName} logo"
237237
RouteViewer:
238238
agencyFilter: Agency Filter
239239
allAgencies: All Agencies
@@ -295,6 +295,9 @@ components:
295295
termsOfStorageStatement: >
296296
Optional: I consent to the Trip Planner storing my historical planned trips in order to
297297
improve transit services in my area. <termsOfStorageLink>More info...</termsOfStorageLink>
298+
confirmDeletionPrompt: >
299+
Removing your consent to storage of historical trips will cause your trip history to be deleted.
300+
Are you sure you want to continue?
298301
TransitVehicleOverlay:
299302
# keys designed to match API output
300303
incoming_at: "approaching {stop}"
@@ -404,7 +407,6 @@ components:
404407
to verify your email address before finishing your account setup.
405408
instructions2: Once you're verified, click the button below to continue.
406409
resendVerification: Resend verification email
407-
408410

409411
# Common messages that appear in multiple components and modules
410412
# are grouped below by topic.
@@ -491,4 +493,3 @@ common:
491493
other {{hours, number} hr {minutes, number} min}}
492494
# If trip is less than one hour only display the minutes.
493495
tripDurationFormatZeroHours: "{minutes, number} min"
494-

i18n/fr-FR.yml

+3
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ components:
228228
termsOfStorageStatement: >
229229
Facultatif: Je consens à ce que le Planificateur de trajets sauvegarde mes recherches
230230
afin d'améliorer les transports publics dans ma region. <termsOfStorageLink>Plus d'informations...</termsOfStorageLink>
231+
confirmDeletionPrompt: >
232+
En révoquant votre accord sur l'enregistrement de vos recherches de trajets, tout l'historique de vos de trajets sera supprimé.
233+
Voulez-vous continuer ?
231234
TransitVehicleOverlay:
232235
# keys designed to match API output
233236
incoming_at: "Approchant {stop}"

lib/actions/api.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import qs from 'qs'
1010
import { getStopViewerConfig, queryIsValid } from '../util/state'
1111
import { getSecureFetchOptions } from '../util/middleware'
1212

13-
import { rememberPlace } from './map'
13+
import { rememberPlace, zoomToStop } from './map'
1414
import { ItineraryView, setItineraryView } from './ui'
1515

1616
if (typeof (fetch) === 'undefined') require('isomorphic-fetch')
@@ -125,7 +125,7 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
125125
return Promise.all(iterations.map((injectedParams, i) => {
126126
const requestId = randId()
127127
// fetch a realtime route
128-
const url = constructRoutingQuery(state, false, injectedParams)
128+
const url = constructRoutingQuery(state, false, { batchId: searchId, ...injectedParams })
129129
const realTimeFetch = fetch(url, getOtpFetchOptions(state))
130130
.then(getJsonAndCheckResponse)
131131
.then(json => {
@@ -185,7 +185,7 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
185185
user.loggedInUser.storeTripHistory
186186

187187
const nonRealtimeFetch = fetch(
188-
constructRoutingQuery(state, true),
188+
constructRoutingQuery(state, true, { batchId: searchId, ...injectedParams }),
189189
getOtpFetchOptions(state, storeTripHistory)
190190
)
191191
.then(getJsonAndCheckResponse)
@@ -379,6 +379,7 @@ export function fetchStopInfo (stop) {
379379
)
380380
)
381381
dispatch(findNearbyAmenities({lat, lon, radius}, stop.stopId))
382+
dispatch(zoomToStop(fetchedStop))
382383
}
383384
}
384385
}

lib/actions/map.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export function clearLocation (payload) {
4040
export function zoomToStop (stop) {
4141
return function (dispatch, getState) {
4242
if (!stop) return
43+
dispatch(setMapZoom({ zoom: 17 }))
4344
dispatch(setMapCenter({ lat: stop.lat, lon: stop.lon }))
44-
dispatch(setMapZoom({ zoom: 18 }))
4545
}
4646
}
4747

lib/components/form/connect-location-field.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ export default function connectLocationField (StyledLocationField, options = {})
2323
const activeSearch = getActiveSearch(state)
2424
const query = activeSearch ? activeSearch.query : currentQuery
2525

26+
const geocoderConfig = config.geocoder
27+
if (currentPosition?.coords) {
28+
const {latitude: lat, longitude: lon} = currentPosition.coords
29+
geocoderConfig.focusPoint = {lat, lon}
30+
}
31+
2632
const stateToProps = {
2733
currentPosition,
28-
geocoderConfig: config.geocoder,
34+
geocoderConfig,
2935
layerColorMap: config.geocoder?.resultsColors || {},
3036
nearbyStops,
3137
sessionSearches,

lib/components/map/connected-stop-marker.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ import { setViewedStop } from '../../actions/ui'
77
// connect to the redux store
88

99
const mapStateToProps = (state, ownProps) => {
10-
const { highlightedStop, viewedRoute } = state.otp.ui
10+
const { highlightedStop, viewedRoute, viewedStop } = state.otp.ui
1111
const routeData = viewedRoute && state.otp.transitIndex.routes?.[viewedRoute.routeId]
1212
const hoverColor = routeData?.routeColor || '#333'
13+
let fillColor = highlightedStop === ownProps.entity.id ? hoverColor : '#FFF'
14+
if (viewedStop?.stopId === ownProps.entity.id) {
15+
fillColor = 'cyan'
16+
}
1317

1418
return {
1519
languageConfig: state.otp.config.language,
1620
leafletPath: {
1721
color: '#000',
18-
fillColor: highlightedStop === ownProps.entity.id ? hoverColor : '#FFF',
22+
fillColor,
1923
fillOpacity: 1,
2024
weight: 1
2125
},

lib/components/map/connected-stop-viewer-overlay.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import * as mapActions from '../../actions/map'
99

1010
import EnhancedStopMarker from './enhanced-stop-marker'
1111

12+
// Minimum zoom to show stop-viewer overlay content
13+
const MIN_ZOOM = 17
14+
1215
/**
1316
* An overlay to view a collection of stops.
1417
*/
@@ -21,6 +24,14 @@ class StopViewerOverlay extends MapLayer {
2124

2225
updateLeafletElement () {}
2326

27+
componentDidUpdate (prevProps) {
28+
const {leaflet, stopData} = this.props
29+
// If a new stop is clicked, close the stop viewer popup
30+
if (stopData?.id !== prevProps?.stopData?.id) {
31+
leaflet.map && leaflet.map.closePopup()
32+
}
33+
}
34+
2435
render () {
2536
const {
2637
configCompanies,
@@ -39,7 +50,7 @@ class StopViewerOverlay extends MapLayer {
3950
}
4051
const stopSymbols = [
4152
{
42-
minZoom: 18,
53+
minZoom: MIN_ZOOM,
4354
symbol: EnhancedStopMarker
4455
}
4556
]
@@ -62,7 +73,7 @@ class StopViewerOverlay extends MapLayer {
6273
{...overlayConfig}
6374
configCompanies={configCompanies}
6475
stations={bikeRental && bikeRental.stations}
65-
visible
76+
visible={zoom >= MIN_ZOOM - 1}
6677
/>
6778
)
6879
case 'micromobility-rental': return (
@@ -71,7 +82,7 @@ class StopViewerOverlay extends MapLayer {
7182
{...overlayConfig}
7283
configCompanies={configCompanies}
7384
stations={vehicleRental?.stations}
74-
visible
85+
visible={zoom >= MIN_ZOOM - 1}
7586
/>
7687
)
7788
default: return null

0 commit comments

Comments
 (0)