Skip to content

Commit

Permalink
Merge branch 'dev' into a11y-error
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup authored Dec 13, 2023
2 parents 654aea4 + f27607e commit 63c2c5b
Show file tree
Hide file tree
Showing 31 changed files with 1,110 additions and 473 deletions.
5 changes: 5 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ api:
# mobile: BOTH_LOCATIONS_CHANGED
# default: ONE_LOCATION_CHANGED

### If Terms of Service is hosted at an outside link, provide it here. If translations
### are provided, host each translation by including the language code (eg. en-US, fr, es)
### in the URL and use {locale} to represent the language in the link below
# termsOfServiceLink:

### The default query parameters can be overridden be uncommenting this object.
### Note: the override values must be valid values within otp-ui's query-params.js
# defaultQueryParams:
Expand Down
35 changes: 35 additions & 0 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,40 @@ components:
timeWalking: "{time} walking"
MobileOptions:
header: Set Search Options
MobilityProfile:
DevicesPane:
devices:
cane: Cane
crutches: Crutches
electric wheelchair: Electric wheelchair
manual walker: Manual walker
manual wheelchair: Manual/traditional wheelchair
mobility scooter: Mobility scooter
none: No assistive device
service animal: Service animal
stroller: Stroller
wheeled walker: Wheeled walker
white cane: White cane
prompt: Do you regularly use a mobility assistive device? (Check all that apply)
LimitationsPane:
mobilityPrompt: >-
Do you have any mobility limitations that cause you to walk more slowly
or more carefully than other people?
visionLimitations:
legally-blind: Legally blind
low-vision: Low-vision
none: None
visionPrompt: Do you have any vision limitations?
MobilityPane:
button: Edit your mobility profile
header: Mobility Profile
mobilityDevices: "Mobility devices: "
mobilityLimitations: "Mobility limitations: "
visionLimitations: "Vision limitations: "
intro: >-
Please answer a few questions to customize the trip planning experience to
your needs and preferences.
title: Define Your Mobility Profile
NarrativeItinerariesHeader:
changeSortDir: Change sort direction
howToFindResults: To view results, see the Itineraries Found heading below.
Expand Down Expand Up @@ -513,6 +547,7 @@ components:
tripNotFoundDescription: Sorry, the requested trip was not found.
tripNotifications: Trip notifications
SavedTripList:
alertTag: "{alert, plural, one {View one alert} other {View # alerts}}"
fromTo: From {from} to {to}
myTrips: My trips
noSavedTrips: You have no saved trips
Expand Down
37 changes: 37 additions & 0 deletions i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,42 @@ components:
timeWalking: "{time} de marche"
MobileOptions:
header: Options de recherche
MobilityProfile:
DevicesPane:
devices:
cane: Canne
crutches: Béquilles
electric wheelchair: Fauteuil roulant électrique
manual walker: Déambulateur manuel
manual wheelchair: Fauteuil roulant manuel
mobility scooter: Scooter électrique
none: Aucun
service animal: Animal de service
stroller: Poussette
wheeled walker: Déambulateur à roues
white cane: Canne blanche
prompt: >-
Utilisez-vous habituellement l'aide d'un appareil pour vous déplacer ?
(Cochez tous les cas qui vous concernent)
LimitationsPane:
mobilityPrompt: >-
Avez-vous des handicaps moteurs qui vous font marcher plus lentement ou
plus prudemment que d'autres personnes ?
visionLimitations:
legally-blind: Non-voyant
low-vision: Vision basse
none: Aucune
visionPrompt: Avez-vous des handicaps visuels ?
MobilityPane:
button: Modifier votre profil mobilité
header: Profil mobilité
mobilityDevices: "Appareils d'aide : "
mobilityLimitations: "Handicaps moteurs : "
visionLimitations: "Handicaps visuels : "
intro: >-
Veuillez répondre a quelques questions pour personaliser vos recherches de
trajets selon vos besoins et préférences.
title: Spécifiez votre profil de mobilité
NarrativeItinerariesHeader:
changeSortDir: Changer l'ordre de tri
howToFindResults: Pour afficher les résultats, utilisez l'en-tête Trajets trouvés plus bas.
Expand Down Expand Up @@ -532,6 +568,7 @@ components:
tripNotFoundDescription: Le trajet recherché est introuvable.
tripNotifications: Notifications du trajet
SavedTripList:
alertTag: "{alert, plural, one {Afficher une alerte} other {Afficher # alertes}}"
fromTo: De {from} à {to}
myTrips: Mes trajets
noSavedTrips: Vous n'avez aucun trajet enregistré
Expand Down
18 changes: 18 additions & 0 deletions i18n/i18n-exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
"components.OTP2ErrorRenderer.inputFields.*": [
"FROM",
"TO"
],
"components.MobilityProfile.DevicesPane.devices.*": [
"cane",
"crutches",
"electric wheelchair",
"manual walker",
"manual wheelchair",
"mobility scooter",
"none",
"service animal",
"stroller",
"wheeled walker",
"white cane"
],
"components.MobilityProfile.LimitationsPane.visionLimitations.*": [
"none",
"low-vision",
"legally-blind"
]
}
}
16 changes: 5 additions & 11 deletions lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,9 @@ export const findRoute = (params) =>
})
})

// Fallback for if the filtering removes all patterns
// Fallback for if the filtering leaves us with a silly number of patterns
// If this happens, it is not possible to know which pattern to keep
;(filteredPatterns.length > 0
;(filteredPatterns.length > 1
? filteredPatterns
: newRoute.patterns
).forEach((pattern) => {
Expand All @@ -705,10 +705,6 @@ export const findRoute = (params) =>
newRoute.patterns = routePatterns
// TODO: avoid explicit behavior shift like this
newRoute.v2 = true
newRoute.color = getRouteColorBasedOnSettings(
getRouteOperator(route, getState().otp.config.transitOperators),
route
).split('#')[1]
newRoute.mode = checkForRouteModeOverride(
newRoute,
getState().otp.config?.routeModeOverrides
Expand Down Expand Up @@ -757,14 +753,12 @@ export function findRoutes() {
// To initialize the route viewer,
// convert the routes array to a dictionary indexed by route ids.
return routes.reduce((result, route) => {
const { agency, id, longName, mode, shortName, type } = route
const { agency, color, id, longName, mode, shortName, type } =
route
result[id] = {
agencyId: agency.id,
agencyName: agency.name,
color: getRouteColorBasedOnSettings(
getRouteOperator(route, config.transitOperators),
route
).split('#')[1],
color,
id,
longName,
mode: checkForRouteModeOverride(
Expand Down
10 changes: 7 additions & 3 deletions lib/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { isBlank } from '../util/ui'
import { secureFetch } from '../util/middleware'
import { TRIPS_PATH } from '../util/constants'

import { routeTo } from './ui'
import { routeTo, setLocale } from './ui'
import { routingQuery } from './api'
import { setQueryParam } from './form'

Expand Down Expand Up @@ -232,7 +232,8 @@ export function fetchTripRequests() {
/**
* Updates the redux state with the provided user data, including
* placing the Home and Work locations at the beginning of the list
* of saved places for rendering in several UI components.
* of saved places for rendering in several UI components,
* and applying accessibility and locale settings.
*
* Also, fetches monitored trips if requested, i.e. when
* - initializing the user state with an existing persisted user, or
Expand All @@ -248,10 +249,13 @@ function setUser(user, fetchTrips) {
dispatch(fetchTripRequests())
}

const { accessibilityRoutingByDefault } = user
const { accessibilityRoutingByDefault, preferredLocale } = user
if (accessibilityRoutingByDefault !== undefined) {
dispatch(setQueryParam({ wheelchair: accessibilityRoutingByDefault }))
}
if (!isBlank(preferredLocale)) {
dispatch(setLocale(preferredLocale))
}
}
}

Expand Down
86 changes: 86 additions & 0 deletions lib/components/map/connected-geojson-layer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {
Styled as BaseMapStyled,
MarkerWithPopup
} from '@opentripplanner/base-map'
import { connect } from 'react-redux'
import FromToLocationPicker from '@opentripplanner/from-to-location-picker'
import React, { useEffect, useState } from 'react'

import * as mapActions from '../../actions/map'
import { SetLocationHandler } from '../util/types'

type Props = {
setLocation: SetLocationHandler
url: string
}
const GeoJSONOverlay = (props: Props) => {
const { setLocation, url } = props

const [locations, setLocations] = useState([])
useEffect(() => {
async function downloadLocations() {
const json = await (await fetch(url)).json()
setLocations(json)
}
if (url) downloadLocations()
}, [url])

return (
<>
{/* @ts-expect-error TODO: geojson types */}
{locations?.features?.map((feature, k) => {
const { geometry, properties } = feature
if (!geometry || !geometry.coordinates) return null
return (
<MarkerWithPopup
key={k}
popupContents={
<BaseMapStyled.MapOverlayPopup>
{properties.Name && (
<BaseMapStyled.PopupTitle>
{properties.Name}
</BaseMapStyled.PopupTitle>
)}
<BaseMapStyled.PopupRow>
{properties.popupContent && (
<div>{properties.popupContent}</div>
)}
{properties.Address && (
<div>
{properties.Address}, {properties.Zip}, {properties.City},{' '}
{properties.State}
</div>
)}
{properties.Phone && <div>{properties.Phone}</div>}
<FromToLocationPicker
label
location={{
lat: geometry.coordinates[1],
lon: geometry.coordinates[0],
name: properties.Name
}}
setLocation={setLocation}
/>
</BaseMapStyled.PopupRow>
</BaseMapStyled.MapOverlayPopup>
}
// @ts-expect-error popup props are incorrect
popupProps={{ offset: 10 }}
position={[geometry.coordinates[1], geometry.coordinates[0]]}
>
<img
alt={properties.Name}
className={properties.className}
src={properties.icon}
/>
</MarkerWithPopup>
)
})}
</>
)
}
const mapDispatchToProps = {
setLocation: mapActions.setLocation
}

export default connect(null, mapDispatchToProps)(GeoJSONOverlay)
5 changes: 5 additions & 0 deletions lib/components/map/default-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { updateOverlayVisibility } from '../../actions/config'

import ElevationPointMarker from './elevation-point-marker'
import EndpointsOverlay from './connected-endpoints-overlay'
import GeoJsonLayer from './connected-geojson-layer'
import ParkAndRideOverlay from './connected-park-and-ride-overlay'
import PointPopup from './point-popup'
import RoutePreviewOverlay from './route-preview-overlay'
Expand Down Expand Up @@ -324,6 +325,10 @@ class DefaultMap extends Component {
name: getLayerName(overlayConfig, config, intl)
}
switch (overlayConfig.type) {
case 'geojson':
return (
<GeoJsonLayer {...namedLayerProps} url={overlayConfig.url} />
)
case 'bike-rental':
return (
<VehicleRentalOverlay
Expand Down
Loading

0 comments on commit 63c2c5b

Please sign in to comment.