Skip to content

Commit

Permalink
Merge branch 'dev' into clear-location-mobile-view
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup authored Dec 15, 2023
2 parents 4d188f3 + e2736b3 commit 233d9bf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ itinerary:
showScheduleDeviation: true
# Shows the duration of a leg below the leg in the metro itinerary summary
showLegDurations: false
# Whether to add a OTP_RR_A11Y_ROUTING_ENABLED error to all itineraries with accessibility scores
displayA11yError: false
# The sort option to use by default
# Available sort options: 'BEST', 'DURATION', 'ARRIVALTIME', 'WALKTIME', 'COST', 'DEPARTURETIME'
# defaultSort: "BEST" # Default
Expand Down
18 changes: 18 additions & 0 deletions lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,24 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
response.data?.plan?.routingErrors.filter(
(re) => re?.code !== 'NO_TRANSIT_CONNECTION'
)

// Add accessibility error, if it is turned on
const state = getState()
const { displayA11yError } = state.otp.config?.itinerary
if (displayA11yError) {
if (
response.data.plan.itineraries.find(
(itin) => !!itin?.accessibilityScore
)
) {
if (!response.data.plan?.routingErrors) {
response.data.plan.routingErrors = []
}
response.data.plan.routingErrors.push({
code: 'OTP_RR_A11Y_ROUTING_ENABLED'
})
}
}
}

return {
Expand Down
13 changes: 12 additions & 1 deletion lib/components/narrative/metro/metro-error-renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styled from 'styled-components'

import { AppReduxState } from '../../../util/state-types'
import { Icon } from '../../util/styledIcon'
import { LinkOpensNewWindow } from '../../util/externalLink'

type Error = Record<string, string[]>

Expand Down Expand Up @@ -81,7 +82,17 @@ const ErrorRenderer = ({
id={`components.OTP2ErrorRenderer.${error}.body`}
values={{
inputFields: intl.formatList(localizedInputFieldList),
inputFieldsCount: localizedInputFieldList.length
inputFieldsCount: localizedInputFieldList.length,
link: (contents: JSX.Element) => (
<LinkOpensNewWindow
contents={contents}
inline
style={{ color: 'inherit' }}
url={intl.formatMessage({
id: `components.OTP2ErrorRenderer.${error}.link`
})}
/>
)
}}
/>
</p>
Expand Down

0 comments on commit 233d9bf

Please sign in to comment.