Skip to content

Commit

Permalink
Merge branch 'dev' into import-building-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup authored Apr 19, 2024
2 parents 3c74530 + 700d36e commit d01ef0a
Show file tree
Hide file tree
Showing 49 changed files with 34,307 additions and 15,517 deletions.
47,874 changes: 33,362 additions & 14,512 deletions __tests__/components/viewers/__snapshots__/nearby-view.js.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ exports[`components > viewers > stop viewer should render with initial stop id a
"wrapRichTextChunksInFragment": undefined,
}
}
setLocation={[Function]}
showBlockIds={false}
stopId="TriMet:13170"
transitOperators={Array []}
Expand Down Expand Up @@ -266,24 +265,32 @@ exports[`components > viewers > stop viewer should render with initial stop id a
</button>
</Button>
</div>
<div
className="header-text"
>
<h1>
<FormattedMessage
id="components.StopViewer.loadingText"
>
components.StopViewer.loadingText
</FormattedMessage>
</h1>
<Connect(FavoriteStopToggle)>
<FavoriteStopToggle
forgetStop={[Function]}
isFavoriteStop={false}
rememberStop={[Function]}
/>
</Connect(FavoriteStopToggle)>
</div>
<styled.div>
<div
className="sc-cjHJky bihPUp"
>
<styled.div>
<div
className="sc-edoYdd ipgOiu"
>
<h1>
<FormattedMessage
id="components.StopViewer.loadingText"
>
components.StopViewer.loadingText
</FormattedMessage>
</h1>
</div>
</styled.div>
</div>
</styled.div>
<Connect(FavoriteStopToggle)>
<FavoriteStopToggle
forgetStop={[Function]}
isFavoriteStop={false}
rememberStop={[Function]}
/>
</Connect(FavoriteStopToggle)>
<div
style={
Object {
Expand Down
8 changes: 6 additions & 2 deletions __tests__/components/viewers/nearby-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import nearbyScootersInvalidDates from './nearby-mocks/nearby-scooters-invalid-d
describe('components > viewers > nearby view', () => {
it('renders nothing on a blank page', () => {
const mockState = getMockInitialState()
mockState.otp.transitIndex.nearby = []
mockState.otp.transitIndex.nearby = {
data: []
}
mockState.router.location = { query: {} }
expect(
mockWithProvider(NearbyView, {}, mockState).snapshot()
Expand All @@ -19,7 +21,9 @@ describe('components > viewers > nearby view', () => {

it('renders proper scooter dates', () => {
const mockState = getMockInitialState()
mockState.otp.transitIndex.nearby = nearbyScootersInvalidDates
mockState.otp.transitIndex.nearby = {
data: nearbyScootersInvalidDates
}
mockState.router.location = { query: {} }
expect(
mockWithProvider(NearbyView, {}, mockState).snapshot()
Expand Down
7 changes: 7 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ itinerary:
renderRouteNamesInBlocks: true
# Whether the mode icons should be colored as well
fillModeIcons: true
# Allow user to collapse alerts in itinerary body
allowUserAlertCollapsing: true
# If multiple fares are returned by OTP, assign names to the fare keys here
#fareKeyNameMap:
# regular: "Transit Fare"
Expand All @@ -359,6 +361,11 @@ itinerary:
# mutedErrors:
# - NO_TRANSIT_CONNECTION_IN_SEARCH_WINDOW

# List of OTP2 errors that should only be displayed alone, alongside no
# other errors.
# exclusiveErrors:
# - NO_TRANSIT_CONNECTION

# The following settings must be set to these values to use the new
# "Metro" UI. The settings can be used without the Metro UI, but
# this may have unexpected effects.
Expand Down
5 changes: 4 additions & 1 deletion i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ components:
body: >-
No transit connection was found between your origin and destination on
the selected day of service, using the vehicle types you selected.
header: No transit connections
header: No itineraries found
NO_TRANSIT_CONNECTION_IN_SEARCH_WINDOW:
body: >-
A transit connection was found, but it was outside the search window,
Expand Down Expand Up @@ -431,6 +431,9 @@ components:
minutes).
verified: Verified
verify: Verify
verifySms: >-
Please complete the verification process in order to set up SMS
notifications.
Place:
deleteThisPlace: Delete this place
enterAlert: >
Expand Down
5 changes: 4 additions & 1 deletion i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ components:
requestNewCode: Envoyer un nouveau code
sendVerificationText: Envoyer le SMS de vérification
smsConsent: >
En donnant votre numéro téléphone, vous acceptez de recevoir des SMS de
En donnant votre numéro de téléphone, vous acceptez de recevoir des SMS de
vérification et de suivi de vos trajets. Frais applicables selon votre
opérateur téléphonique.
verificationCode: "Code de vérification :"
Expand All @@ -453,6 +453,9 @@ components:
code ci-dessous (le code expire après 10 minutes).
verified: Vérifié
verify: Vérifier
verifySms: >-
Veuillez effectuer la vérification de votre numéro de téléphone afin de
recevoir des notifications par SMS.
Place:
deleteThisPlace: Supprimer ce lieu
enterAlert: >
Expand Down
16 changes: 15 additions & 1 deletion lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,10 @@ export const fetchNearby = (position, radius) => {
error.cause = payload.errors
throw error
}
return mergeSameStops(payload.data?.nearest?.edges)
return {
coords: { lat, lon },
data: mergeSameStops(payload.data?.nearest?.edges)
}
}
}
)
Expand Down Expand Up @@ -533,6 +536,9 @@ export const findStopTimesForStop = (params) =>
headsign
id: code
route {
agency {
gtfsId
}
gtfsId
}
stops {
Expand Down Expand Up @@ -1125,6 +1131,14 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
}
}

// If there are no itineraries, generate an error
// so we're not left with an empty results container.
if (withCollapsedShortNames.length === 0) {
response.data.plan.routingErrors.push({
code: 'NO_TRANSIT_CONNECTION'
})
}

return {
index,
response: {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function setMapCenter(map /* MapRef */, location) {
*/
export function zoomToPlace(map /* MapRef */, place, zoom) {
return function () {
if (place && map) {
if (place && place.lat !== undefined && place.lon !== undefined && map) {
map.flyTo({ center: [place.lon, place.lat], zoom: zoom || 17 })
}
}
Expand Down
26 changes: 19 additions & 7 deletions lib/actions/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ export function matchContentToUrl(map, location) {
if (lat && lon) {
dispatch(setViewedNearbyCoords({ lat, lon }))
} else {
const { from, to } = getState().otp.currentQuery
if (from) {
dispatch(setViewedNearbyCoords(from))
} else if (to) {
dispatch(setViewedNearbyCoords(to))
}

dispatch(setMainPanelContent(MainPanelContent.NEARBY_VIEW))
}
break
Expand Down Expand Up @@ -368,15 +375,20 @@ export function handleBackButtonPress(e) {
*/
export function setItineraryView(value) {
return function (dispatch, getState) {
const urlParams = coreUtils.query.getUrlParams()
if (coreUtils.ui.isMobile()) {
const urlParams = coreUtils.query.getUrlParams()

// If the itinerary value is changed,
// set the desired ui query param (even if LIST, so it replaces the current value)
// and store the current view as previousItineraryView.
if (value !== getItineraryView(urlParams)) {
urlParams.ui_itineraryView = value
// If the itinerary value is changed,
// set the desired ui query param (even if LIST, so it replaces the current value)
// and store the current view as previousItineraryView.
if (value !== getItineraryView(urlParams)) {
urlParams.ui_itineraryView = value

dispatch(setUrlSearch(urlParams))
dispatch(setUrlSearch(urlParams))
dispatch(settingItineraryView(value))
}
} else {
// Don't set/use the ui_itineraryView in desktop mode.
dispatch(settingItineraryView(value))
}
}
Expand Down
18 changes: 9 additions & 9 deletions lib/components/admin/field-trip-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,16 @@ class FieldTripList extends Component {
<IconWithText Icon={GraduationCap}>
Field Trip Requests
</IconWithText>{' '}
<button
className="clear-button-formatting"
onClick={this._onClickRefresh}
style={{ marginRight: '5px', verticalAlign: 'bottom' }}
>
<StyledIconWrapper>
<RedoAlt />
</StyledIconWrapper>
</button>
<span className="pull-right">
<button
className="clear-button-formatting"
onClick={this._onClickRefresh}
style={{ marginRight: '5px', verticalAlign: 'bottom' }}
>
<StyledIconWrapper>
<RedoAlt />
</StyledIconWrapper>
</button>
<input
defaultValue={search}
onKeyUp={this._handleSearchKeyUp}
Expand Down
5 changes: 4 additions & 1 deletion lib/components/app/app-menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { ChevronUp } from '@styled-icons/fa-solid/ChevronUp'
import AnimateHeight from 'react-animate-height'
import React, { Component, HTMLAttributes, KeyboardEvent } from 'react'

import Link from '../util/link'

interface Props extends HTMLAttributes<HTMLElement> {
href?: string
icon?: JSX.Element
onClick?: () => void
subItems?: JSX.Element[]
text: JSX.Element | string
to?: string
}

interface State {
Expand Down Expand Up @@ -70,7 +73,7 @@ export default class AppMenuItem extends Component<Props, State> {
const { isExpanded } = this.state
const hasHref = !!otherProps.href
const isAbsolute = otherProps.href?.startsWith('http')
const Element = hasHref ? 'a' : 'button'
const Element = hasHref ? 'a' : otherProps.to ? Link : 'button'
const containerId = `${id}-container`
return (
<>
Expand Down
Loading

0 comments on commit d01ef0a

Please sign in to comment.