Skip to content

Commit

Permalink
Merge branch 'dev' into field-trip-fixes-dec-24
Browse files Browse the repository at this point in the history
miles-grant-ibigroup authored Dec 13, 2024
2 parents bb5729b + 7ea6e15 commit b19e30f
Showing 18 changed files with 260 additions and 48 deletions.
5 changes: 5 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
@@ -184,6 +184,9 @@ map:
# geocoder test account can be obtained from the Pelias maintainers at geocode.earth.
geocoder:
apiKey: PELIAS_API_KEY
# Pass an array of geocoder result types to control the order in which they are displayed.
# The default order is ['STATIONS', 'STOPS', 'OTHER'].
geocoderResultsOrder: ['STATIONS', 'STOPS', 'OTHER']
boundary:
rect:
minLon: -123.2034
@@ -353,6 +356,8 @@ itinerary:
showPlanFirstLastButtons: false
# adds the 'about' and '~' prefixes to the duration of non transit legs and trip details panel
showApproximatePrefixAccessLegs: false
# Whether to show the effective date and time of alerts
showAlertEffectiveDateTimeText: true
# Show all walking legs regardless of distance
showAllWalkLegs: false
# Filters out trips returned by OTP by default, unless specifically requested.
7 changes: 6 additions & 1 deletion i18n/en-US.yml
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ actions:
confirmDeletePlace: Would you like to remove this place?
emailVerificationResent: The email verification message has been resent.
genericError: "An error was encountered: {err}"
getDependentUserInfoFailed: Error getting mobility profile information.
itineraryExistenceCheckFailed: Error checking whether your selected trip is possible.
mustAcceptTermsToSavePlace: Please accept the Terms of Use (under My Account) to save locations.
mustBeLoggedInToSavePlace: Please log in to save locations.
@@ -197,7 +198,6 @@ components:
BatchSearchScreen:
advancedHeader: Advanced Preferences
header: Plan Your Trip
modeOptions: Mode Options
modeSelectorLabel: Select a travel mode
moreOptions: More options
saveAndReturn: Save and return
@@ -339,10 +339,15 @@ components:
header: Mobility Profile
mobilityDevices: "Mobility devices: "
mobilityLimitations: "Mobility limitations: "
planTripDescription: >-
If you have a travel companion, you can choose to plan this trip
according to their mobility profile.
visionLimitations: "Vision limitations: "
dropdownLabel: "User mobility profile:"
intro: >-
Please answer a few questions to customize the trip planning experience to
your needs and preferences.
myself: Myself
title: Define Your Mobility Profile
NarrativeItinerariesHeader:
changeSortDir: Change sort direction
8 changes: 7 additions & 1 deletion i18n/fr.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ actions:
Le message de vérification de votre adresse e-mail a été envoyé de
nouveau.
genericError: "Une erreur s'est produite : {err}"
getDependentUserInfoFailed: Erreur lors de l'obtention des profils de mobilité.
itineraryExistenceCheckFailed: Erreur lors de la vérification de la validité du trajet choisi.
mustAcceptTermsToSavePlace: >-
Veuillez accepter les conditions d'utilisation (dans Mon compte) pour
@@ -208,7 +209,6 @@ components:
BatchSearchScreen:
advancedHeader: Préférences avancées
header: Votre trajet
modeOptions: Choix du mode
modeSelectorLabel: Sélectionnez un mode de déplacement
moreOptions: Plus d'options
saveAndReturn: Enregistrer et fermer
@@ -356,10 +356,16 @@ components:
header: Profil mobilité
mobilityDevices: "Appareils d'aide : "
mobilityLimitations: "Handicaps moteurs : "
planTripDescription: >-
Vous pouvez rechercher des trajets adaptés au profil mobilité des
personnes que vous accompagnez. Pour ajouter des personnes
accompagnatrices, allez dans <manageLink>Préférences</manageLink>.
visionLimitations: "Handicaps visuels : "
dropdownLabel: "Profil à utiliser :"
intro: >-
Veuillez répondre a quelques questions pour personaliser vos recherches de
trajets selon vos besoins et préférences.
myself: Moi-même
title: Spécifiez votre profil de mobilité
NarrativeItinerariesHeader:
changeSortDir: Changer l'ordre de tri
4 changes: 3 additions & 1 deletion lib/actions/apiV2.js
Original file line number Diff line number Diff line change
@@ -1027,7 +1027,9 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
numItineraries: numItineraries || getDefaultNumItineraries(config)
}
if (config.mobilityProfile) {
baseQuery.mobilityProfile = loggedInUser?.mobilityProfile?.mobilityMode
baseQuery.mobilityProfile =
currentQuery.mobilityProfile ||
loggedInUser?.mobilityProfile?.mobilityMode
}
// Generate combinations if the modes for query are not specified in the query
// FIXME: BICYCLE_RENT does not appear in this list unless TRANSIT is also enabled.
24 changes: 24 additions & 0 deletions lib/actions/user.js
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ const setCurrentUserMonitoredTrips = createAction(
const setCurrentUserTripRequests = createAction(
'SET_CURRENT_USER_TRIP_REQUESTS'
)
const setDependentUserInfo = createAction('SET_DEPENDENT_USER_INFO')
const setLastPhoneSmsRequest = createAction('SET_LAST_PHONE_SMS_REQUEST')
export const setPathBeforeSignIn = createAction('SET_PATH_BEFORE_SIGNIN')
export const clearItineraryExistence = createAction('CLEAR_ITINERARY_EXISTENCE')
@@ -693,6 +694,29 @@ export function checkItineraryExistence(trip, intl) {
}
}

export function getDependentUserInfo(userIds, intl) {
return async function (dispatch, getState) {
const state = getState()
const { accessToken, apiBaseUrl, apiKey } = getMiddlewareVariables(state)
const requestUrl = `${apiBaseUrl}${API_OTPUSER_PATH}/getdependentmobilityprofile?dependentuserids=${userIds}`

const { data, status } = await secureFetch(
requestUrl,
accessToken,
apiKey,
'GET'
)

if (status === 'success' && data) {
dispatch(setDependentUserInfo(data))
} else {
alert(
intl.formatMessage({ id: 'actions.user.getDependentUserInfoFailed' })
)
}
}
}

/**
* Plans a new trip for the current date given the query parameters in the given
* monitored trip
13 changes: 12 additions & 1 deletion lib/components/app/batch-routing-panel.tsx
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ import ViewerContainer from '../viewers/viewer-container'
interface Props {
activeSearch: any
currentQuery: any
geocoderResultsOrder?: Array<string>
intl: IntlShape
mainPanelContent: number
mobile?: boolean
@@ -89,7 +90,13 @@ class BatchRoutingPanel extends Component<Props> {
}

render() {
const { activeSearch, intl, mobile, showUserSettings } = this.props
const {
activeSearch,
geocoderResultsOrder,
intl,
mobile,
showUserSettings
} = this.props
const { planTripClicked } = this.state
const mapAction = mobile
? intl.formatMessage({
@@ -157,6 +164,7 @@ class BatchRoutingPanel extends Component<Props> {
<div ref={this._mainPanelContentRef}>
<span className="batch-routing-panel-location-fields">
<LocationField
geocoderResultsOrder={geocoderResultsOrder}
inputPlaceholder={intl.formatMessage(
{ id: 'common.searchForms.enterStartLocation' },
{ mapAction }
@@ -167,6 +175,7 @@ class BatchRoutingPanel extends Component<Props> {
showClearButton={!mobile}
/>
<LocationField
geocoderResultsOrder={geocoderResultsOrder}
inputPlaceholder={intl.formatMessage(
{ id: 'common.searchForms.enterDestination' },
{ mapAction }
@@ -236,9 +245,11 @@ const mapStateToProps = (state: any) => {
const { mainPanelContent } = state.otp.ui
const currentQuery = state.otp.currentQuery

const geocoderResultsOrder = state.otp.config?.geocoder?.geocoderResultsOrder
return {
activeSearch: getActiveSearch(state),
currentQuery,
geocoderResultsOrder,
mainPanelContent,
showUserSettings
}
5 changes: 1 addition & 4 deletions lib/components/app/responsive-webapp.js
Original file line number Diff line number Diff line change
@@ -183,10 +183,7 @@ class ResponsiveWebapp extends Component {
navigator.geolocation.watchPosition(
// On success
(position) => {
// This object cloning is required to be allowed to read the position info twice
// on webkit browsers.
// See https://github.com/opentripplanner/otp-react-redux/pull/697 for details
receivedPositionResponse({ position: { ...position } })
receivedPositionResponse({ position })
},
// On error
(error) => {
Loading

0 comments on commit b19e30f

Please sign in to comment.