Skip to content

Commit 1329bca

Browse files
Merge branch 'dev' into fix-nearby-filtering
2 parents 698bd86 + 0e32792 commit 1329bca

36 files changed

+592
-407
lines changed

__tests__/reducers/__snapshots__/create-otp-reducer.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Object {
1616
"countryCode": "US",
1717
},
1818
"realtimeEffectsDisplayThreshold": 120,
19-
"routingTypes": Array [],
2019
"stopViewer": Object {
2120
"showBlockIds": false,
2221
},
@@ -76,6 +75,7 @@ Object {
7675
"rideEstimates": Object {},
7776
},
7877
"transitIndex": Object {
78+
"feeds": Array [],
7979
"routes": Object {},
8080
"routesFetchStatus": 0,
8181
"stops": Object {},

a11y/a11y.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ async function runAxeTestOnPath(otpPath) {
4242
page.waitForNavigation({ waitUntil: 'networkidle2' })
4343
])
4444

45-
await expect(page).toPassAxeTests({ disabledRules })
45+
await expect(page).toPassAxeTests({
46+
disabledRules,
47+
// FIXME: Send a PR to maplibre-gl 5.x to not populate aria-label on <div> elements.
48+
// This occurs in their source code at https://github.com/maplibre/maplibre-gl-js/blob/b450876c1707ad7fc563a86b37a472578b4545dc/src/ui/marker.ts#L319.
49+
exclude: '.maplibregl-marker'
50+
})
4651
return page
4752
}
4853

a11y/test-config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ api:
99
# host: http://localhost:8001 # For testing against a local OTP instance
1010
path: /otp/routers/default
1111

12-
# Enabled multimodal routing types (e.g. interary, profile)
13-
routingTypes:
14-
- key: ITINERARY
15-
text: Exact Time
16-
1712
# Show/hide elevation profile chart for walk/bike legs
1813
# elevationProfile: true
1914

example/example-config.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,6 @@ modes:
347347
# # NOTE: headerGraphic requires a valid URL to a png file.
348348
# headerGraphic: 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/Trimet_logo.svg/1280px-Trimet_logo.svg.png'
349349

350-
routingTypes:
351-
- key: ITINERARY
352-
text: Exact Time
353-
354350
# Itinerary options
355351
itinerary:
356352
# Provides an array of valid mode combinations that returned itineraries will be filtered against

i18n/en-US.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ actions:
6565
smsVerificationFailed: >-
6666
Your phone could not be verified. Perhaps the code you entered has
6767
expired. Please request a new code and try again.
68+
tripDeleted: Your trip has been deleted.
6869
common:
6970
coordinates: "{lat}, {lon}"
7071
currentlySelected: " (Currently selected)"
@@ -813,6 +814,9 @@ components:
813814
Please check your email inbox and follow the link in the message to verify
814815
your email address before finishing your account setup.
815816
instructions2: Once you're verified, click the button below to continue.
817+
instructions3: >-
818+
You can plan trips and return to this page anytime to continue setting up
819+
your account.
816820
resendVerification: Resend verification email
817821
ViewSwitcher:
818822
nearby: Nearby

i18n/fr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ actions:
7474
Votre numéro de téléphone n'a pas pu être vérifié. Le code que vous avez
7575
entré a peut-être expiré. Veuillez demander un nouveau code, puis
7676
réessayez.
77+
tripDeleted: Votre trajet a été supprimé
7778
common:
7879
coordinates: "{lat}; {lon}"
7980
currentlySelected: " (actuellement sélectionné)"
@@ -841,6 +842,9 @@ components:
841842
instructions2: >-
842843
Une fois votre adresse vérifiée, cliquez sur le bouton ci-dessous pour
843844
continuer.
845+
instructions3: >-
846+
Vous pouvez planifier des trajets et revenir à cet écran à tout moment
847+
pour poursuivre la creation de votre compte.
844848
resendVerification: Envoyer un nouveau message de vérification
845849
ViewSwitcher:
846850
nearby: À proximité

lib/actions/api.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ export const findingRoutes = createAction('FINDING_ROUTES')
403403
export const findRoutesResponse = createAction('FIND_ROUTES_RESPONSE')
404404
export const findRoutesError = createAction('FIND_ROUTES_ERROR')
405405

406+
// Feeds lookup query
407+
408+
export const findFeedsResponse = createAction('FIND_FEEDS_RESPONSE')
409+
export const findFeedsError = createAction('FIND_FEEDS_ERROR')
410+
411+
export function findFeeds() {
412+
return executeOTPAction('findFeeds')
413+
}
414+
406415
export function findRoutesIfNeeded(params) {
407416
return function (dispatch, getState) {
408417
if (

lib/actions/apiV2.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
fetchingStopTimesForStop,
4343
fetchNearbyError,
4444
fetchNearbyResponse,
45+
findFeedsError,
46+
findFeedsResponse,
4547
findRouteError,
4648
findRouteResponse,
4749
findRoutesError,
@@ -962,6 +964,35 @@ export function findRoutes() {
962964
}
963965
}
964966

967+
export function findFeeds() {
968+
return function (dispatch, getState) {
969+
dispatch(
970+
createGraphQLQueryAction(
971+
`query FeedsQuery {
972+
feeds {
973+
feedId
974+
publisher {
975+
name
976+
}
977+
}
978+
}`,
979+
{},
980+
findFeedsResponse,
981+
findFeedsError,
982+
{
983+
noThrottle: true,
984+
rewritePayload: (payload) => {
985+
if (payload.errors) {
986+
return dispatch(findFeedsError(payload.errors))
987+
}
988+
return payload?.data?.feeds || []
989+
}
990+
}
991+
)
992+
)
993+
}
994+
}
995+
965996
export const findPatternsForRoute = (params) =>
966997
function (dispatch, getState) {
967998
const state = getState()
@@ -1324,6 +1355,7 @@ const retrieveServiceTimeRangeIfNeeded = () =>
13241355

13251356
export default {
13261357
fetchNearby,
1358+
findFeeds,
13271359
findPatternsForRoute,
13281360
findRoute,
13291361
findRoutes,

lib/actions/user.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '../util/user'
1818
import {
1919
formattedToastSuccessMessage,
20+
toastMessageOnPlaceChanged,
2021
toastPromise
2122
} from '../components/util/toasts'
2223
import { isBlank } from '../util/ui'
@@ -581,11 +582,10 @@ export function confirmAndDeleteUserMonitoredTrip(tripId, intl) {
581582
)
582583
const requestUrl = `${apiBaseUrl}${API_MONITORED_TRIP_PATH}/${tripId}`
583584

584-
const { message, status } = await secureFetch(
585-
requestUrl,
586-
accessToken,
587-
apiKey,
588-
'DELETE'
585+
const { message, status } = await toastPromise(
586+
secureFetch(requestUrl, accessToken, apiKey, 'DELETE'),
587+
intl.formatMessage({ id: 'actions.user.tripDeleted' }),
588+
intl
589589
)
590590
if (status === 'success') {
591591
// Reload user's monitored trips after deletion.
@@ -802,7 +802,11 @@ export function saveUserPlace(placeToSave, placeIndex, intl) {
802802
loggedInUser.savedLocations[placeIndex] = placeToSave
803803
}
804804

805-
return dispatch(createOrUpdateUser(loggedInUser, intl))
805+
return toastPromise(
806+
dispatch(createOrUpdateUser(loggedInUser, intl)),
807+
toastMessageOnPlaceChanged(placeToSave, intl, 'Remembered'),
808+
intl
809+
)
806810
}
807811
}
808812

@@ -895,10 +899,8 @@ export function rememberPlace(placeTypeLocation, intl) {
895899
intl.formatMessage({ id: 'actions.user.mustBeLoggedInToSavePlace' })
896900
)
897901
}
898-
return UserActionResult.FAILURE
899902
} else if (persistenceMode.isLocalStorage) {
900903
dispatch(rememberLocalUserPlace(placeTypeLocation))
901-
return UserActionResult.SUCCESS
902904
}
903905
}
904906
}

lib/components/app/print-layout.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { connect } from 'react-redux'
22
import { FormattedMessage, injectIntl, IntlShape } from 'react-intl'
33
import { Itinerary } from '@opentripplanner/types'
4+
import coreUtils from '@opentripplanner/core-utils'
45
import React, { Component } from 'react'
56

6-
import * as apiActions from '../../actions/api'
77
import * as formActions from '../../actions/form'
8+
import * as narrativeActions from '../../actions/narrative'
89
import { AppReduxState } from '../../util/state-types'
9-
import { getActiveItinerary, getActiveSearch } from '../../util/state'
10+
import {
11+
getActiveItineraries,
12+
getActiveSearch,
13+
getVisibleItineraryIndex
14+
} from '../../util/state'
1015
import { summarizeQuery } from '../form/user-settings-i18n'
1116
import { User } from '../user/types'
1217
import DefaultMap from '../map/default-map'
@@ -19,7 +24,8 @@ type Props = {
1924
intl: IntlShape
2025
itinerary: Itinerary
2126
location?: { search?: string }
22-
parseUrlQueryString: (params?: any, source?: string) => any
27+
parseUrlQueryString: (params?: any, source?: string) => void
28+
setVisibleItinerary: (params: { index: number }) => void
2329
user: User
2430
}
2531

@@ -37,6 +43,23 @@ class PrintLayout extends Component<Props> {
3743
}
3844
}
3945

46+
componentDidUpdate() {
47+
const { activeSearch, itinerary, setVisibleItinerary } = this.props
48+
49+
// Display the desired itinerary on map.
50+
if (!itinerary) {
51+
const { ui_activeItinerary: uiActiveItinerary } =
52+
coreUtils.query.getUrlParams() || {}
53+
if (
54+
activeSearch &&
55+
uiActiveItinerary !== undefined &&
56+
uiActiveItinerary !== '-1'
57+
) {
58+
setVisibleItinerary({ index: +uiActiveItinerary })
59+
}
60+
}
61+
}
62+
4063
render() {
4164
const { activeSearch, intl, itinerary, user } = this.props
4265
const printVerb = intl.formatMessage({ id: 'common.forms.print' })
@@ -68,16 +91,17 @@ const mapStateToProps = (state: AppReduxState) => {
6891
const activeSearch = getActiveSearch(state)
6992
const { localUser, loggedInUser } = state.user
7093
const user = loggedInUser || localUser
94+
const itineraries = getActiveItineraries(state)
7195
return {
7296
activeSearch,
73-
itinerary: getActiveItinerary(state) as Itinerary,
97+
itinerary: itineraries[getVisibleItineraryIndex(state)] as Itinerary,
7498
user
7599
}
76100
}
77101

78102
const mapDispatchToProps = {
79103
parseUrlQueryString: formActions.parseUrlQueryString,
80-
routingQuery: apiActions.routingQuery
104+
setVisibleItinerary: narrativeActions.setVisibleItinerary
81105
}
82106

83107
export default connect(

0 commit comments

Comments
 (0)