Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use route color overrides #1029

Merged
merged 16 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/percy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Download OTP2 config file
run: curl $PERCY_OTP2_CONFIG_URL --output /tmp/otp2config.yml
env:
PERCY_OTP2_CONFIG_URL: ${{ secrets.PERCY_MOCK_OTP2_GEOCODER_CONFIG }}
PERCY_OTP2_CONFIG_URL: ${{ secrets.PERCY_MOCK_OTP2_GEOCODER_CALLTAKER_CONFIG }}
- name: Build OTP-RR Calltaker
# Calltaker has a separate config file, so another build should be produced.
run: yarn build
Expand Down
1 change: 1 addition & 0 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ components:
notificationsDisabled: "Notifications: <strong>Disabled</strong>"
TripTools:
copyLink: Copy Link
header: Trip Tools
linkCopied: Copied
reportEmailSubject: Reporting an Issue with OpenTripPlanner
reportEmailTemplate: >
Expand Down
33 changes: 21 additions & 12 deletions i18n/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ actions:
No se puede guardar el plan: este plan no se pudo guardar debido a la
falta de capacidad en uno o más vehículos. Por favor, vuelva a planificar
su viaje.
maxTripRequestsExceeded: Número de solicitudes de viaje superadas sin resultados válidos
maxTripRequestsExceeded: Número de solicitudes de viaje superadas sin resultados
válidos
saveItinerariesError: "No se pudieron guardar los itinerarios: {err}"
setDateError: "Error al establecer la fecha:"
setGroupSizeError: "No se pudo establecer el tamaño del grupo:"
Expand All @@ -52,9 +53,13 @@ actions:
authTokenError: Error al obtener un token de autorización.
confirmDeleteMonitoredTrip: ¿Desea eliminar este viaje?
confirmDeletePlace: ¿Quiere eliminar este lugar?
emailVerificationResent: El mensaje de verificación de correo electrónico ha sido reenviado.
emailVerificationResent: El mensaje de verificación de correo electrónico ha sido
reenviado.
genericError: "Se ha encontrado un error: {err}"
itineraryExistenceCheckFailed: Comprobación de errores para ver si el viaje seleccionado es posible.
itineraryExistenceCheckFailed: Comprobación de errores para ver si el viaje seleccionado
es posible.
mustBeLoggedInToSavePlace: Por favor, inicia la sesión para guardar las ubicaciones.
placeRemembered: La configuración de este lugar se ha guardado.
preferencesSaved: Sus preferencias se han guardado.
smsInvalidCode: El código introducido no es válido. Por favor, inténtelo de nuevo.
smsResendThrottled: >-
Expand All @@ -63,8 +68,6 @@ actions:
smsVerificationFailed: >-
Su teléfono no ha podido ser verificado. Quizás el código que has
introducido ha caducado. Solicita un nuevo código e inténtalo de nuevo.
mustBeLoggedInToSavePlace: Por favor, inicia la sesión para guardar las ubicaciones.
placeRemembered: La configuración de este lugar se ha guardado.
common:
coordinates: "{lat}; {lon}"
dateExpressions:
Expand Down Expand Up @@ -245,7 +248,8 @@ components:
a incluir el transporte publico en la selección de modos.
origin: origen
planTripTooltip: Planificar viaje
validationMessage: "Por favor, defina los siguientes campos para planificar un viaje: {issues}"
validationMessage: "Por favor, defina los siguientes campos para planificar un
viaje: {issues}"
BeforeSignInScreen:
mainTitle: Iniciando sesión
message: >
Expand Down Expand Up @@ -487,11 +491,11 @@ components:
tripsFound: Encontramos {count, plural, one {# opción} other {# opciones}}
waiting: Espera...
RouteDetails:
headsignTo: "{headsign} ({lastStop})"
moreDetails: Más detalles
operatedBy: Servicio operado por {agencyName}
selectADirection: Seleccione una dirección…
stopsTo: Hacia
headsignTo: '{headsign} ({lastStop})'
RouteViewer:
agencyFilter: Filtro de agencia
allAgencies: Todas las agencias
Expand Down Expand Up @@ -547,7 +551,8 @@ components:
header: ¡La sesión está a punto de terminar!
keepSession: Continuar sesión
SimpleRealtimeAnnotation:
usingRealtimeInfo: Este viaje utiliza información de tráfico y retrasos en tiempo real
usingRealtimeInfo: Este viaje utiliza información de tráfico y retrasos en tiempo
real
StackedPaneDisplay:
savePreferences: Guardar preferencias
StopScheduleTable:
Expand Down Expand Up @@ -610,16 +615,19 @@ components:
travelingAt: Viajando a {milesPerHour}
vehicleName: Vehículo {vehicleNumber}
TripBasicsPane:
checkingItineraryExistence: Comprobación de la existencia de itinerarios para cada día de la semana…
checkingItineraryExistence: Comprobación de la existencia de itinerarios para
cada día de la semana…
selectAtLeastOneDay: Por favor, seleccione al menos un día para el seguimiento.
tripDaysPrompt: ¿Qué días hace este viaje?
tripIsAvailableOnDaysIndicated: Su viaje está disponible en los días de la semana indicados anteriormente.
tripIsAvailableOnDaysIndicated: Su viaje está disponible en los días de la semana
indicados anteriormente.
tripNamePrompt: "Por favor, indique un nombre para este viaje:"
tripNotAvailableOnDay: El viaje no está disponible el {repeatedDay}
unsavedChangesExistingTrip: >-
Todavía no ha guardado su viaje. Si abandona la página, los cambios se
perderán.
unsavedChangesNewTrip: Todavía no ha guardado su nuevo viaje. Si abandona la página, se perderá.
unsavedChangesNewTrip: Todavía no ha guardado su nuevo viaje. Si abandona la página,
se perderá.
TripNotificationsPane:
advancedSettings: Configuración avanzada
altRouteRecommended: Se recomienda una ruta alternativa o un punto de transferencia
Expand Down Expand Up @@ -700,9 +708,10 @@ components:
notifications: >-
Notificaciones: <strong>{leadTimeInMinutes} minutos antes de la salida
programada</strong>
notificationsDisabled: "Notificaciones: <strong>Disabled</strong>"
notificationsDisabled: "Notificaciones: <strong>Desactivadas</strong>"
TripTools:
copyLink: Copiar enlace
header: Herramientas
linkCopied: Copiado
reportEmailSubject: Informar un problema con OpenTripPlanner
reportEmailTemplate: >
Expand Down
1 change: 1 addition & 0 deletions i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ components:
notificationsDisabled: "Notifications : <strong>Désactivées</strong>"
TripTools:
copyLink: Copier le lien
header: Outils
linkCopied: Copié
reportEmailSubject: Signaler un problème avec OpenTripPlanner
reportEmailTemplate: >
Expand Down
8 changes: 6 additions & 2 deletions i18n/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ actions:
fetchFieldTripsError: "트립을 가져오는 중에 오류가 발생했습니다: {err}"
fetchTripsForDateError: "필트 트립 날짜에 대한 트립을 가져오는 중에 오류가 발생했습니다: {err}"
incompatibleTripDateError: 계획한 트립 날짜({tripDate})가 요청한 트립 날짜({requestDate})가 아닙니다
itineraryCapacityError: "플랜을 저장할 수 없습니다: 하나 이상의 차량의 용량이 부족하여 이 플랜을 저장할 수 없습니다. 트립을 다시 계획하세요."
itineraryCapacityError: "플랜을 저장할 수 없습니다: 하나 이상의 차량의 용량이 부족하여 이 플랜을 저장할 수 없습니다.
트립을 다시 계획하세요."
maxTripRequestsExceeded: 유효한 결과없이 초과된 트립 요청의 개수
saveItinerariesError: "트립을 저장하는 데 실패했습니다: {err}"
setDateError: "날짜를 설정하는 중에 오류가 발생했습니다:"
Expand Down Expand Up @@ -504,6 +505,7 @@ components:
notifyViaChannelWhen: "다음의 경우, {channel}을 통해 알려주세요:"
oneHour: 1 시간
realtimeAlertFlagged: 내 트립 일정에 실시간 경고가 있습니다
timeBefore: '{time} 전'
TripStatus:
alerts: "{alerts, plural, one {# 경고!} other {# 경고!}}"
deleteTrip: 트립 삭제
Expand Down Expand Up @@ -561,6 +563,7 @@ components:
notificationsDisabled: "알림: <strong>비활성화됨</strong>"
TripTools:
copyLink: 링크 복사
header: 도구
linkCopied: 복사됨
reportEmailSubject: OpenTripPlanner로 문제 보고
reportEmailTemplate: |
Expand Down Expand Up @@ -640,5 +643,6 @@ util:
networkUnavailable: 현재 {network} 네트워크를 사용할 수 없습니다.
noTripFound: 트립을 찾을 수 없습니다.
noTripFoundForMode: "{modes}의 트립을 찾을 수 없습니다."
noTripFoundReason: 지정된 최대 거리 내 또는 지정된 시간에 대중 교통 서비스가 없거나, 출발지 또는 도착지가 안전하게 접근가능하지 못할 수 있습니다.
noTripFoundReason: 지정된 최대 거리 내 또는 지정된 시간에 대중 교통 서비스가 없거나, 출발지 또는 도착지가 안전하게 접근가능하지
못할 수 있습니다.
noTripFoundWithReason: "{noTripFound} {reason}"
1 change: 1 addition & 0 deletions i18n/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ components:
notificationsDisabled: "Thông báo: <strong>Đã tắt</strong>"
TripTools:
copyLink: Sao chép URL
header: Công cụ
linkCopied: Đã sao chép
reportEmailSubject: Báo cáo sự cố với OpenTripPlanner
reportEmailTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions i18n/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ components:
notifyViaChannelWhen: "通过 {channel} 通知我当:"
oneHour: 1小时
realtimeAlertFlagged: 在我的行程中有一个实时警报标志着
timeBefore: '{time} 前'
TripStatus:
alerts: "{alerts, plural, one {# 警报!} other {# 警报!}}"
deleteTrip: 删除行程
Expand Down Expand Up @@ -559,6 +560,7 @@ components:
notificationsDisabled: "通知: <strong>已禁用</strong>"
TripTools:
copyLink: 复制链接
header: 工具
linkCopied: 已复制
reportEmailSubject: 报告OpenTripPlanner的问题
reportEmailTemplate: |
Expand Down
74 changes: 48 additions & 26 deletions lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import { generateModeSettingValues } from '../util/api'
import {
getActiveItineraries,
getActiveItinerary,
getRouteOperator,
queryIsValid
} from '../util/state'
import { getRouteColorBasedOnSettings } from '../util/viewer'
import { ItineraryView } from '../util/ui'

import {
Expand Down Expand Up @@ -671,6 +673,10 @@ 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 @@ -718,29 +724,27 @@ export function findRoutes() {
const { config } = getState().otp
// To initialize the route viewer,
// convert the routes array to a dictionary indexed by route ids.
return routes.reduce(
(
result,
{ agency, color, id, longName, mode, shortName, type }
) => {
result[id] = {
agencyId: agency.id,
agencyName: agency.name,
color,
id,
longName,
mode: checkForRouteModeOverride(
{ id, mode },
config?.routeModeOverrides
),
shortName,
type,
v2: true
}
return result
},
{}
)
return routes.reduce((result, route) => {
const { agency, id, longName, mode, shortName, type } = route
result[id] = {
agencyId: agency.id,
agencyName: agency.name,
color: getRouteColorBasedOnSettings(
getRouteOperator(route, config.transitOperators),
route
).split('#')[1],
id,
longName,
mode: checkForRouteModeOverride(
{ id, mode },
config?.routeModeOverrides
),
shortName,
type,
v2: true
}
return result
}, {})
}
}
)
Expand Down Expand Up @@ -944,9 +948,27 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
const withCollapsedShortNames = filteredItineraries.map(
(itin) => ({
...itin,
legs: itin.legs?.map(convertGraphQLResponseToLegacy)
})
)
legs: itin.legs
?.map((leg) => {
return {
...leg,
route: {
...leg.route,
color: getRouteColorBasedOnSettings(
getRouteOperator(
{
agencyId: leg?.agency?.id,
id: leg?.route?.id
},
config.transitOperators
),
{ color: leg?.route?.color, mode: leg.mode }
).split('#')?.[1]
}
}
})
?.map(convertGraphQLResponseToLegacy)
}))

/* It is possible for a NO_TRANSIT_CONNECTION error to be
returned even if trips were returned, since it is on a mode-by-mode basis.
Expand Down
17 changes: 2 additions & 15 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import {
BatchResultsScreen,
BatchRoutingPanel,
BatchSearchScreen,
CallHistoryWindow,
CallTakerControls,
CallTakerPanel,
DefaultItinerary,
FieldTripWindows,
MailablesWindow,
ResponsiveWebapp
} from './index'

Expand Down Expand Up @@ -178,17 +173,9 @@ const components = {

ItineraryBody: DefaultItinerary,

MainControls: isCallTakerModuleEnabled ? CallTakerControls : null,
MainPanel: BatchRoutingPanel,

MainPanel: isCallTakerModuleEnabled ? CallTakerPanel : BatchRoutingPanel,

MapWindows: isCallTakerModuleEnabled ? (
<>
<CallHistoryWindow />
<FieldTripWindows />
<MailablesWindow />
</>
) : null,
MapWindows: isCallTakerModuleEnabled ? jsConfig.MapWindows : null,

MobileResultsScreen: BatchResultsScreen,

Expand Down
9 changes: 4 additions & 5 deletions lib/components/narrative/trip-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ LinkButton.propTypes = {

const TripTools = ({
buttonTypes,
intl,
location,
popupTarget,
reactRouterConfig,
Expand Down Expand Up @@ -224,7 +223,6 @@ const TripTools = ({
location?.search
)
buttonComponents.push(
// FIXME: The Spanish string does not fit in button width.
<LinkButton
Icon={Undo}
text={<FormattedMessage id="common.forms.startOver" />}
Expand All @@ -250,7 +248,9 @@ const TripTools = ({

return (
<div className="trip-tools-container">
<h2>Trip Tools</h2>
<h2>
<FormattedMessage id="components.TripTools.header" />
</h2>
<div className="trip-tools">
{buttonComponents.map((btn, i) => (
<div className="button-container" key={i}>
Expand All @@ -264,7 +264,6 @@ const TripTools = ({

TripTools.propTypes = {
buttonTypes: PropTypes.arrayOf(PropTypes.string),
intl: PropTypes.object,
location: PropTypes.object,
popupTarget: PropTypes.string,
reactRouterConfig: PropTypes.object,
Expand All @@ -290,5 +289,5 @@ const mapDispatchToProps = {
}

export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(injectIntl(TripTools))
connect(mapStateToProps, mapDispatchToProps)(TripTools)
)
8 changes: 6 additions & 2 deletions lib/components/user/nav-login-button-auth0.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ const NavLoginButtonAuth0 = ({
}: NavLoginButtonAuth0Props): JSX.Element => {
const { isAuthenticated, loginWithRedirect, logout, user } = useAuth0()

// For Chinese (Chinese (Simplified)), we must pass 'zh-CN' to auth0.
// Unlike 'fr', 'zh' alone is not recognized and falls back to English.
const auth0Locale = locale === 'zh' ? 'zh-CN' : locale

// On login, preserve the current trip query if any.
const handleLogin = useCallback(
() =>
loginWithRedirect({
appState: { returnTo: getCurrentRoute() },
ui_locales: locale
ui_locales: auth0Locale
}),
[locale, loginWithRedirect]
[auth0Locale, loginWithRedirect]
)
const handleLogout = useCallback(
() =>
Expand Down
Loading
Loading