Skip to content

Commit

Permalink
Merge branch 'dev' into cleanup-calltaker-useeffect
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Dec 13, 2024
2 parents 219f41f + b4364d3 commit 55f1f93
Show file tree
Hide file tree
Showing 20 changed files with 241 additions and 48 deletions.
3 changes: 3 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions lib/actions/field-trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
setPendingRequests,
updateOtpUrlParams
} from './api'
import { setLocation } from './map'
import { toggleCallHistory } from './call-taker'

if (typeof fetch === 'undefined') require('isomorphic-fetch')
Expand Down Expand Up @@ -534,8 +535,8 @@ function prepareQueryParams(request, outbound) {
const hasExistingLocations = currentQuery.from || currentQuery.to
const locations =
!hasExistingLocations ||
window.confirm(
'Use custom set locations? Pressing "Cancel" will use the locations you have typed in. Pressing "OK" will use the locations currently saved to the field trip'
!window.confirm(
'Use custom set locations? Pressing "OK" will use the locations you have typed in. Pressing "Cancel" will use the locations currently saved to the field trip'
)
? await planParamsToQueryAsync(locationsToGeocode, config)
: { from: currentQuery.from, to: currentQuery.to }
Expand Down Expand Up @@ -1078,6 +1079,8 @@ export function clearActiveFieldTrip() {
return function (dispatch) {
dispatch(setActiveFieldTrip(null))
dispatch(clearActiveSearch())
dispatch(setLocation({ location: null, locationType: 'from' }))
dispatch(setLocation({ location: null, locationType: 'to' }))
dispatch(setQueryParam({ numItineraries: undefined }))
dispatch(clearSaveable())
}
Expand Down
24 changes: 24 additions & 0 deletions lib/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/components/admin/field-trip-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class FieldTripList extends Component {
}

_onCloseActiveFieldTrip = () => {
this.props.setActiveFieldTrip(null)
this.props.clearActiveFieldTrip()
}

_getReportUrl = () => {
Expand Down Expand Up @@ -268,6 +268,7 @@ const mapStateToProps = (state) => {
}

const mapDispatchToProps = {
clearActiveFieldTrip: fieldTripActions.clearActiveFieldTrip,
fetchFieldTripDetails: fieldTripActions.fetchFieldTripDetails,
fetchFieldTrips: fieldTripActions.fetchFieldTrips,
setActiveFieldTrip: fieldTripActions.setActiveFieldTrip,
Expand Down
13 changes: 12 additions & 1 deletion lib/components/app/batch-routing-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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 }
Expand All @@ -167,6 +175,7 @@ class BatchRoutingPanel extends Component<Props> {
showClearButton={!mobile}
/>
<LocationField
geocoderResultsOrder={geocoderResultsOrder}
inputPlaceholder={intl.formatMessage(
{ id: 'common.searchForms.enterDestination' },
{ mapAction }
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 1 addition & 4 deletions lib/components/app/responsive-webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/form/add-place-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const AddPlaceButton = ({
const disabled = !from || !to || maxPlacesDefined
return (
<button
className="clear-button-formatting"
className="clear-button-formatting add-place-button"
disabled={disabled}
onClick={onClick}
style={{ marginBottom: '5px', marginLeft: '10px' }}
Expand Down
Loading

0 comments on commit 55f1f93

Please sign in to comment.