Skip to content

Commit

Permalink
Merge branch 'dev' into save-trip-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup authored Apr 12, 2024
2 parents 3440d33 + 14f323e commit 51eb24d
Show file tree
Hide file tree
Showing 17 changed files with 281 additions and 357 deletions.
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
5 changes: 5 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,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
2 changes: 1 addition & 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
13 changes: 12 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 @@ -1128,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
22 changes: 5 additions & 17 deletions lib/components/app/view-switcher.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { connect } from 'react-redux'
import { FormattedMessage, useIntl } from 'react-intl'
import React from 'react'

import { AppReduxState } from '../../util/state-types'
import Link from '../util/link'

type Props = {
mainPath: string
sticky?: boolean
}
/**
* This component is a switcher between
* the main views of the application.
*/
const ViewSwitcher = ({ mainPath, sticky }: Props) => {
const ViewSwitcher = ({ sticky }: Props) => {
const intl = useIntl()
return (
<div
Expand All @@ -34,26 +31,17 @@ const ViewSwitcher = ({ mainPath, sticky }: Props) => {
: {}
}
>
<Link isActive={mainPath === '/'} to="/">
<Link to="/" tracking>
<FormattedMessage id="components.BatchRoutingPanel.shortTitle" />
</Link>
<Link isActive={mainPath === '/route'} to="/route">
<Link to="/route" tracking>
<FormattedMessage id="components.RouteViewer.shortTitle" />
</Link>
<Link isActive={mainPath === '/nearby'} to="/nearby">
<Link to="/nearby" tracking>
<FormattedMessage id="components.ViewSwitcher.nearby" />
</Link>
</div>
)
}

// connect to the redux store

const mapStateToProps = (state: AppReduxState) => {
const pathParts = state.router.location.pathname.split('/')
return {
mainPath: `/${pathParts[1]}`
}
}

export default connect(mapStateToProps)(ViewSwitcher)
export default ViewSwitcher
192 changes: 0 additions & 192 deletions lib/components/map/enhanced-stop-marker.tsx

This file was deleted.

Loading

0 comments on commit 51eb24d

Please sign in to comment.