Skip to content

Commit

Permalink
Merge pull request #498 from opentripplanner/master-merge-fix
Browse files Browse the repository at this point in the history
OTP-RR Release (November 10, 2021)
  • Loading branch information
miles-grant-ibigroup authored Nov 12, 2021
2 parents e2ddaec + f46dd6c commit d1ecb80
Show file tree
Hide file tree
Showing 25 changed files with 535 additions and 157 deletions.
8 changes: 4 additions & 4 deletions __tests__/actions/__snapshots__/api.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Array [
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1239",
"searchId": "abcd1234",
"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",
"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",
},
"type": "ROUTING_ERROR",
},
Expand Down Expand Up @@ -67,7 +67,7 @@ Array [
"error": [Error: Received error from server],
"requestId": "abcd1240",
"searchId": "abcd1237",
"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",
"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",
},
"type": "ROUTING_ERROR",
},
Expand Down Expand Up @@ -113,12 +113,12 @@ Array [
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1236",
"searchId": "abcd1234",
"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",
"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",
},
"type": "ROUTING_ERROR",
},
],
]
`;

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"`;
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"`;
29 changes: 26 additions & 3 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ modes:
transitModes:
- mode: BUS
label: Bus
# A mode color can be added, used throughout the application,
# most notably in the enhanced stop viewer bubble
color: blue
- mode: TRAM
label: MAX & Streetcar
- mode: RAIL
Expand Down Expand Up @@ -243,6 +246,13 @@ itinerary:
# Whether the plan first/previous/next/last buttons should be shown along with
# plan trip itineraries.
showPlanFirstLastButtons: false
# If multiple fares are returned by OTP, assign names to the fare keys here
#fareKeyNameMap:
# regular: "Transit Fare"
# electronicRegular: "SmartCard Fare"
# student: "Student Fare"
# One fare will always be shown by default
#defaultFareKey: electronicRegular

# The transitOperators key is a list of transit operators that can be used to
# order transit agencies when sorting by route. Also, this can optionally
Expand Down Expand Up @@ -294,6 +304,15 @@ itinerary:
# defaultRouteTextColor: '000000'
# longNameSplitter: ' - '
# order: 2
# Use this config to overwrite the accessibility score gradation
# map that ships with otp-ui
#accessibilityScore:
# gradationMap:
# 0.0:
# color: "#ffb5b9"
# # The text can be overridden in the language section
# text: 'Not Accessible'
# icon: thumbs-down

### Use this config for the standard mode selector
# modeGroups:
Expand All @@ -319,9 +338,13 @@ itinerary:
# common:
# accessModes:
# bikeshare: Blue Bike
# config:
# menuItems:
# demo-item: Demo Item
# config:
# acessibilityScore:
# gradationMap:
# 0.0: 'Not Accessible'
# 0.9: 'Mostly Accessible'
# menuItems:
# demo-item: Demo Item

### Localization section to provide language/locale settings
#localization:
Expand Down
7 changes: 4 additions & 3 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ components:
stopsTo: "Towards"
selectADirection: "Select a direction..."
RouteRow:
operatorLogoAltText: '{operatorName} logo'
operatorLogoAltText: "{operatorName} logo"
RouteViewer:
agencyFilter: Agency Filter
allAgencies: All Agencies
Expand Down Expand Up @@ -295,6 +295,9 @@ components:
termsOfStorageStatement: >
Optional: I consent to the Trip Planner storing my historical planned trips in order to
improve transit services in my area. <termsOfStorageLink>More info...</termsOfStorageLink>
confirmDeletionPrompt: >
Removing your consent to storage of historical trips will cause your trip history to be deleted.
Are you sure you want to continue?
TransitVehicleOverlay:
# keys designed to match API output
incoming_at: "approaching {stop}"
Expand Down Expand Up @@ -404,7 +407,6 @@ components:
to verify your email address before finishing your account setup.
instructions2: Once you're verified, click the button below to continue.
resendVerification: Resend verification email


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

3 changes: 3 additions & 0 deletions i18n/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ components:
termsOfStorageStatement: >
Facultatif: Je consens à ce que le Planificateur de trajets sauvegarde mes recherches
afin d'améliorer les transports publics dans ma region. <termsOfStorageLink>Plus d'informations...</termsOfStorageLink>
confirmDeletionPrompt: >
En révoquant votre accord sur l'enregistrement de vos recherches de trajets, tout l'historique de vos de trajets sera supprimé.
Voulez-vous continuer ?
TransitVehicleOverlay:
# keys designed to match API output
incoming_at: "Approchant {stop}"
Expand Down
7 changes: 4 additions & 3 deletions lib/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import qs from 'qs'
import { getStopViewerConfig, queryIsValid } from '../util/state'
import { getSecureFetchOptions } from '../util/middleware'

import { rememberPlace } from './map'
import { rememberPlace, zoomToStop } from './map'
import { ItineraryView, setItineraryView } from './ui'

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

const nonRealtimeFetch = fetch(
constructRoutingQuery(state, true),
constructRoutingQuery(state, true, { batchId: searchId, ...injectedParams }),
getOtpFetchOptions(state, storeTripHistory)
)
.then(getJsonAndCheckResponse)
Expand Down Expand Up @@ -379,6 +379,7 @@ export function fetchStopInfo (stop) {
)
)
dispatch(findNearbyAmenities({lat, lon, radius}, stop.stopId))
dispatch(zoomToStop(fetchedStop))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export function clearLocation (payload) {
export function zoomToStop (stop) {
return function (dispatch, getState) {
if (!stop) return
dispatch(setMapZoom({ zoom: 17 }))
dispatch(setMapCenter({ lat: stop.lat, lon: stop.lon }))
dispatch(setMapZoom({ zoom: 18 }))
}
}

Expand Down
8 changes: 7 additions & 1 deletion lib/components/form/connect-location-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ export default function connectLocationField (StyledLocationField, options = {})
const activeSearch = getActiveSearch(state)
const query = activeSearch ? activeSearch.query : currentQuery

const geocoderConfig = config.geocoder
if (currentPosition?.coords) {
const {latitude: lat, longitude: lon} = currentPosition.coords
geocoderConfig.focusPoint = {lat, lon}
}

const stateToProps = {
currentPosition,
geocoderConfig: config.geocoder,
geocoderConfig,
layerColorMap: config.geocoder?.resultsColors || {},
nearbyStops,
sessionSearches,
Expand Down
8 changes: 6 additions & 2 deletions lib/components/map/connected-stop-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import { setViewedStop } from '../../actions/ui'
// connect to the redux store

const mapStateToProps = (state, ownProps) => {
const { highlightedStop, viewedRoute } = state.otp.ui
const { highlightedStop, viewedRoute, viewedStop } = state.otp.ui
const routeData = viewedRoute && state.otp.transitIndex.routes?.[viewedRoute.routeId]
const hoverColor = routeData?.routeColor || '#333'
let fillColor = highlightedStop === ownProps.entity.id ? hoverColor : '#FFF'
if (viewedStop?.stopId === ownProps.entity.id) {
fillColor = 'cyan'
}

return {
languageConfig: state.otp.config.language,
leafletPath: {
color: '#000',
fillColor: highlightedStop === ownProps.entity.id ? hoverColor : '#FFF',
fillColor,
fillOpacity: 1,
weight: 1
},
Expand Down
17 changes: 14 additions & 3 deletions lib/components/map/connected-stop-viewer-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import * as mapActions from '../../actions/map'

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

// Minimum zoom to show stop-viewer overlay content
const MIN_ZOOM = 17

/**
* An overlay to view a collection of stops.
*/
Expand All @@ -21,6 +24,14 @@ class StopViewerOverlay extends MapLayer {

updateLeafletElement () {}

componentDidUpdate (prevProps) {
const {leaflet, stopData} = this.props
// If a new stop is clicked, close the stop viewer popup
if (stopData?.id !== prevProps?.stopData?.id) {
leaflet.map && leaflet.map.closePopup()
}
}

render () {
const {
configCompanies,
Expand All @@ -39,7 +50,7 @@ class StopViewerOverlay extends MapLayer {
}
const stopSymbols = [
{
minZoom: 18,
minZoom: MIN_ZOOM,
symbol: EnhancedStopMarker
}
]
Expand All @@ -62,7 +73,7 @@ class StopViewerOverlay extends MapLayer {
{...overlayConfig}
configCompanies={configCompanies}
stations={bikeRental && bikeRental.stations}
visible
visible={zoom >= MIN_ZOOM - 1}
/>
)
case 'micromobility-rental': return (
Expand All @@ -71,7 +82,7 @@ class StopViewerOverlay extends MapLayer {
{...overlayConfig}
configCompanies={configCompanies}
stations={vehicleRental?.stations}
visible
visible={zoom >= MIN_ZOOM - 1}
/>
)
default: return null
Expand Down
Loading

0 comments on commit d1ecb80

Please sign in to comment.