Skip to content

Commit

Permalink
Merge branch 'dev' into add-toast-notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Sep 19, 2023
2 parents 6301edc + 801178b commit c7cc07a
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 119 deletions.
55 changes: 52 additions & 3 deletions i18n/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ actions:
setPaymentError: "Error al configurar la información de pago:"
setRequestStatusError: "Error al establecer el estado de la solicitud:"
location:
deniedAccessAlert: >
El acceso a tu ubicación está bloqueado.
Para utilizar tu ubicación actual, activa los permisos de ubicación desde
tu navegador y vuelve a cargar la página.
geolocationNotSupportedError: Su navegador no admite la geolocalización
unknownPositionError: Error desconocido al obtener la posición
userDeniedPermission: Usuario sin permiso
map:
currentLocation: (Ubicación actual)
user:
Expand Down Expand Up @@ -105,6 +111,7 @@ common:
"yes":
itineraryDescriptions:
calories: "{calories, number} kcal"
fareUnknown: No hay información de las tarifas
noItineraryToDisplay: No hay itinerario que mostrar.
relativeCo2: >
{co2} de CO₂ en {isMore, select, true {más} other {menos} } que conducir
Expand Down Expand Up @@ -170,7 +177,9 @@ components:
tooManyPlaces: Se alcanzó el máximo de lugares intermedios
AdvancedOptions:
bannedRoutes: Seleccionar rutas prohibidas…
bikeTolerance: Tolerancia de las bicicletas
preferredRoutes: Seleccionar rutas preferidas…
walkTolerance: Tolerancia al andar
AfterSignInScreen:
mainTitle: Redirigiendo…
message: >-
Expand Down Expand Up @@ -226,6 +235,7 @@ components:
shortTitle: Planificar viaje
BatchSearchScreen:
header: Planifique su viaje
modeSelectorLabel: Seleccione un modo de transporte
BatchSettings:
destination: destino
origin: origen
Expand Down Expand Up @@ -359,11 +369,50 @@ components:
description: El contenido que ha solicitado no está disponible.
header: No se encontró el contenido
NotificationPrefsPane:
description: Puede recibir notificaciones sobre los viajes que realiza con frecuencia.
noDeviceForPush: Regístrese con la aplicación móvil para acceder a esta configuración.
noneSelect: No enviar notificaciones
notificationChannelPrompt: "Recibir notificaciones para sus viajes guardados por:"
notificationEmailDetail: "Los correos electrónicos de notificación se enviarán a:"
OTP2ErrorRenderer:
LOCATION_NOT_FOUND:
body: >-
{inputFieldsCount, plural, =0 {} one {localización es} other
{localizaciones son}} no están cerca de ninguna calle.
header: No se puede acceder a la ubicación
NO_STOPS_IN_RANGE:
body: >-
{inputFieldsCount, plural, =0 {} one {ubicación es} other {ubicaciones
son}} no están cerca de ninguna parada del transporte.
header: Sin paradas cerca
NO_TRANSIT_CONNECTION:
body: >-
No se encontró ninguna conexión entre tu origen y destino en el día
seleccionado, utilizando los tipos de vehículos que seleccionaste.
header: Sin conexiones
NO_TRANSIT_CONNECTION_IN_SEARCH_WINDOW:
body: >-
Se encontró una conexión, pero estaba fuera de las opciones de la
búsqueda, intenta ajustar las opciones de la búsqueda, usando los tipos
de vehículos que seleccionaste.
header: Sin conexiones por el criterio de la búsqueda
OUTSIDE_BOUNDS:
body: >-
{inputFieldsCount, plural, =0 {} one {localización es} other
{localizaciones son}} no están en los límites del planificador de
viajes.
header: Ubicación fuera de los límites
OUTSIDE_SERVICE_PERIOD:
body: >-
La fecha específicada está fuera del rango de los datos disponibles para
la búsqueda de los viajes.
header: Fuera de plazo
SYSTEM_ERROR:
body: Se ha producido un error desconocido en la búsqueda.
header: Error en el planificador de los viajes
WALKING_BETTER_THAN_TRANSIT:
body: Puede completar esta ruta más rápido caminando.
header: El transporte público no es la forma más rápida de hacer este viaje
inputFields:
FROM: Procedencia
TO: Destino
PhoneNumberEditor:
changeNumber: Cambiar número de teléfono
invalidCode: Introduzca 6 dígitos para el código de validación.
Expand Down
4 changes: 2 additions & 2 deletions i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ components:
header: Echec de la recherche
WALKING_BETTER_THAN_TRANSIT:
body: >-
Vous pouvez effectuer ce trajet plus rapidement en évitant les
Vous pouvez effectuer ce trajet plus rapidement sans prendre les
transports.
header: Transports moins rapides
header: Moins rapide en transports
inputFields:
FROM: point de départ
TO: destination
Expand Down
8 changes: 4 additions & 4 deletions lib/components/narrative/default/default-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
getAccessibilityScoreForItinerary,
itineraryHasAccessibilityScores
} from '../../../util/accessibility-routing'
import { getFare, getTotalFare } from '../../../util/state'
import { getFirstLegStartTime } from '../../../util/itinerary'
import { getTotalFare } from '../../../util/state'
import { Icon, StyledIconWrapperTextAlign } from '../../util/styledIcon'
import { localizeGradationMap } from '../utils'
import FieldTripGroupSize from '../../admin/field-trip-itinerary-group-size'
Expand Down Expand Up @@ -121,7 +121,7 @@ const ITINERARY_ATTRIBUTES = [
id: 'cost',
order: 2,
render: (itinerary, options, defaultFareType) => {
const fare = getTotalFare(itinerary, options.configCosts, defaultFareType)
const fare = getFare(itinerary, defaultFareType)
const currency = getItineraryCost(
itinerary.legs,
defaultFareType.mediumId,
Expand All @@ -142,11 +142,11 @@ const ITINERARY_ATTRIBUTES = [
return (
<FormattedNumber
// Currency from itinerary fare or from config.
currency={currency.code}
currency={fare.fareCurrency}
currencyDisplay="narrowSymbol"
// eslint-disable-next-line react/style-prop-object
style="currency"
value={fare}
value={fare.transitFare + fare.maxTNCFare}
/>
)
}
Expand Down
30 changes: 15 additions & 15 deletions lib/components/viewers/trip-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ class TripViewer extends Component {
timeZone: homeTimezone
})

const fromIndex = tripData?.stops?.findIndex(
(stop) => stop.stopId === viewedTrip?.fromStopId
)
const toIndex = tripData?.stops?.findIndex(
(stop) => stop.stopId === viewedTrip?.toStopId
)

return (
<div className="trip-viewer">
<PageTitle title={this.getTitle()} />
Expand Down Expand Up @@ -133,20 +140,16 @@ class TripViewer extends Component {
screenreader or keyboard nav, the departure, arrival, and stop viewer links
are all accessible without having to go through all the stops not on the trip. */}

{viewedTrip?.fromIndex && (
{fromIndex > -1 && (
<Alert>
<FormattedMessage
id="components.TripViewer.tripDescription"
values={{
boardAtStop: (
<strong>
{tripData.stops?.[viewedTrip?.fromIndex]?.name}
</strong>
<strong>{tripData.stops?.[fromIndex]?.name}</strong>
),
disembarkAtStop: (
<strong>
{tripData.stops?.[viewedTrip?.toIndex]?.name}
</strong>
<strong>{tripData.stops?.[toIndex]?.name}</strong>
)
}}
/>
Expand Down Expand Up @@ -197,27 +200,24 @@ class TripViewer extends Component {
}

let stopLabel = null
if (viewedTrip?.fromIndex === i) {
if (fromIndex === i) {
stopLabel = (
<FormattedMessage id="components.TripViewer.startOfTrip" />
)
}
if (viewedTrip?.toIndex === i) {
if (toIndex === i) {
stopLabel = (
<FormattedMessage id="components.TripViewer.endOfTrip" />
)
}

// determine whether to show highlight in strip map
let highlightClass
if (i === viewedTrip?.fromIndex) {
if (i === fromIndex) {
highlightClass = 'strip-map-highlight-first'
} else if (
i > viewedTrip?.fromIndex &&
i < viewedTrip.toIndex
) {
} else if (i > fromIndex && i < toIndex) {
highlightClass = 'strip-map-highlight'
} else if (i === viewedTrip?.toIndex) {
} else if (i === toIndex) {
highlightClass = 'strip-map-highlight-last'
}

Expand Down
56 changes: 0 additions & 56 deletions lib/components/viewers/view-trip-button.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import NavLoginButton from './components/user/nav-login-button'
import NavLoginButtonAuth0 from './components/user/nav-login-button-auth0'
import StopViewer from './components/viewers/stop-viewer'
import ViewStopButton from './components/viewers/view-stop-button'
import ViewTripButton from './components/viewers/view-trip-button'
import ViewerContainer from './components/viewers/viewer-container'
import ResponsiveWebapp from './components/app/responsive-webapp'
import AppMenu from './components/app/app-menu'
Expand Down Expand Up @@ -89,7 +88,6 @@ export {
StopViewer,
ViewerContainer,
ViewStopButton,
ViewTripButton,

// user-related components
NavLoginButton,
Expand Down
6 changes: 4 additions & 2 deletions lib/util/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ export function getTotalFare(
let drivingCost = 0
let hasBikeshare = false
let transitFareNotProvided = false
let rideHailTrip = false
itinerary.legs.forEach((leg) => {
if (leg.mode === 'CAR') {
rideHailTrip = rideHailTrip || leg?.rideHailingEstimate
if (leg.mode === 'CAR' && !rideHailTrip) {
// Convert meters to miles and multiple by cost per mile.
drivingCost += leg.distance * 0.000621371 * costs.drivingCentsPerMile
}
Expand All @@ -121,7 +123,7 @@ export function getTotalFare(
if (transitFareNotProvided) return null
const bikeshareCost = hasBikeshare ? costs.bikeshareTripCostCents : 0
// If some leg uses driving, add parking cost to the total.
if (drivingCost > 0) drivingCost += costs.carParkingCostCents
if (drivingCost > 0 && !rideHailTrip) drivingCost += costs.carParkingCostCents
return bikeshareCost + drivingCost + transitFare + maxTNCFare * 100
}

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
"@opentripplanner/geocoder": "^1.4.2",
"@opentripplanner/humanize-distance": "^1.2.0",
"@opentripplanner/icons": "^2.0.5",
"@opentripplanner/itinerary-body": "^5.0.5",
"@opentripplanner/location-field": "^2.0.7",
"@opentripplanner/itinerary-body": "^5.0.6",
"@opentripplanner/location-field": "^2.0.8",
"@opentripplanner/location-icon": "^1.4.1",
"@opentripplanner/map-popup": "^2.0.5",
"@opentripplanner/otp2-tile-overlay": "^1.0.5",
"@opentripplanner/park-and-ride-overlay": "^2.0.6",
"@opentripplanner/printable-itinerary": "2.0.10-alpha.4",
"@opentripplanner/printable-itinerary": "2.0.12",
"@opentripplanner/route-viewer-overlay": "^2.0.13",
"@opentripplanner/stop-viewer-overlay": "^2.0.6",
"@opentripplanner/stops-overlay": "^5.1.1",
Expand Down Expand Up @@ -241,4 +241,4 @@
"percy-css": ".percy-hide { opacity: 0!important; } "
}
}
}
}
Loading

0 comments on commit c7cc07a

Please sign in to comment.