File tree 9 files changed +32
-47
lines changed
__tests__/components/viewers/__snapshots__
9 files changed +32
-47
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,6 @@ exports[`components > viewers > stop viewer should render countdown times after
448
448
<div
449
449
className="header-text"
450
450
>
451
- <OperatorLogo />
452
451
<h1
453
452
style={
454
453
Object {
@@ -3327,7 +3326,6 @@ exports[`components > viewers > stop viewer should render countdown times for st
3327
3326
<div
3328
3327
className="header-text"
3329
3328
>
3330
- <OperatorLogo />
3331
3329
<h1
3332
3330
style={
3333
3331
Object {
@@ -5239,7 +5237,6 @@ exports[`components > viewers > stop viewer should render times after midnight w
5239
5237
<div
5240
5238
className="header-text"
5241
5239
>
5242
- <OperatorLogo />
5243
5240
<h1
5244
5241
style={
5245
5242
Object {
@@ -8507,7 +8504,6 @@ exports[`components > viewers > stop viewer should render with OTP transit index
8507
8504
<div
8508
8505
className="header-text"
8509
8506
>
8510
- <OperatorLogo />
8511
8507
<h1
8512
8508
style={
8513
8509
Object {
@@ -15582,7 +15578,6 @@ exports[`components > viewers > stop viewer should render with TriMet transit in
15582
15578
<div
15583
15579
className="header-text"
15584
15580
>
15585
- <OperatorLogo />
15586
15581
<h1
15587
15582
style={
15588
15583
Object {
Original file line number Diff line number Diff line change @@ -369,9 +369,6 @@ components:
369
369
moreDetails : " More Details"
370
370
stopsTo : " Towards"
371
371
selectADirection : " Select a direction..."
372
- RouteRow :
373
- operatorLogoAltText : " logo for {operatorName}"
374
- operatorLogoAriaLabel : " {operatorName} stop:"
375
372
# Used in both desktop and mobile
376
373
RouteViewer :
377
374
agencyFilter : Agency Filter
@@ -442,6 +439,7 @@ components:
442
439
loadingText : Loading Stop...
443
440
nextArrivals : Next Arrivals
444
441
noStopsFound : No stop times found for date.
442
+ operatorLogoAriaLabel : " {operatorName} stop:"
445
443
schedule : Schedule
446
444
timezoneWarning : " Departure times are shown in <strong>{timezoneCode}</strong>."
447
445
titleBarStopId : " Stop {stopId}"
Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ components:
261
261
header : Visor de paradas
262
262
loadingText : Cargando la parada...
263
263
noStopsFound : No se han encontrado tiempos de parada para la fecha.
264
+ operatorLogoAriaLabel : " Parada de {operatorName}:"
264
265
timezoneWarning : Las horas de salida se indican en <strong>{timezoneCode}</strong>.
265
266
titleBarStopId : Parada {stopId}
266
267
viewNextArrivals : Ver próximas llegadas
@@ -489,8 +490,6 @@ components:
489
490
noTripFound : No se encontró ningún viaje
490
491
tripsFound : Encontramos {count, plural, one {# opción} other {# opciones}}
491
492
waiting : Espera...
492
- RouteRow :
493
- operatorLogoAltText : logotipo de {operatorName}
494
493
SimpleRealtimeAnnotation :
495
494
usingRealtimeInfo : Este viaje utiliza información de tráfico y retrasos en tiempo
496
495
real
Original file line number Diff line number Diff line change @@ -360,9 +360,6 @@ components:
360
360
moreDetails : " Plus d'infos"
361
361
stopsTo : " Direction"
362
362
selectADirection : " Choisissez une direction..."
363
- RouteRow :
364
- operatorLogoAriaLabel : " {operatorName} stop:"
365
- operatorLogoAltText : " Logo de {operatorName}"
366
363
# Used in both desktop and mobile
367
364
RouteViewer :
368
365
agencyFilter : Filtrer les transporteurs
@@ -434,6 +431,7 @@ components:
434
431
loadingText : Chargement de l'arrêt...
435
432
nextArrivals : Prochains passages
436
433
noStopsFound : Aucun horaire pour la date choisie.
434
+ operatorLogoAriaLabel : " Arrêt {operatorName} :"
437
435
schedule : Horaires
438
436
timezoneWarning : " Les horaires sont affichés dans le fuseau <strong>{timezoneCode}</strong>."
439
437
titleBarStopId : " Arrêt {stopId}"
Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ components:
237
237
header : 정류장 뷰어
238
238
loadingText : 로딩 중지…
239
239
noStopsFound : 날짜에 대한 정지 시간이 없습니다.
240
+ operatorLogoAriaLabel : " 정류장 {operatorName}:"
240
241
timezoneWarning : 출발 시간은 <strong>{timezoneCode}</strong> 로 표시됩니다.
241
242
titleBarStopId : 정류장 {stopId}
242
243
viewNextArrivals : 다음 도착 정보보기
@@ -476,8 +477,6 @@ components:
476
477
RelatedPanel :
477
478
hideExtraStops : 여분의 정지를 숨 깁니다
478
479
showExtraStops : 추가 정거장 {count} 개를 보여줍니다
479
- RouteRow :
480
- operatorLogoAltText : ' {operatorName} 심벌 마크'
481
480
SimpleRealtimeAnnotation :
482
481
usingRealtimeInfo : 이 여행은 실시간 트래픽과 지연 정보를 사용합니다
483
482
StackedPaneDisplay :
Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ components:
245
245
header : Trình xem trạm dừng
246
246
loadingText : Đang tải trạm dừng…
247
247
noStopsFound : Không tìm thấy thời gian dừng cho ngày.
248
+ operatorLogoAriaLabel : " Điểm dừng của {operatorName}:"
248
249
timezoneWarning : Thời gian khởi hành được hiển thị trong <strong>{timezoneCode}</strong>.
249
250
titleBarStopId : ' Điểm dừng {stopId}'
250
251
viewNextArrivals : Xem những người đến tiếp theo
@@ -468,8 +469,6 @@ components:
468
469
RelatedPanel :
469
470
hideExtraStops : Ẩn các điểm trạm dừng thêm
470
471
showExtraStops : Hiển thị thêm {count} trạm điểm dừng
471
- RouteRow :
472
- operatorLogoAltText : logo {operatorName}
473
472
SavedTripEditor :
474
473
editSavedTrip : Chỉnh sửa chuyến đi lưu
475
474
saveNewTrip : Lưu chuyến đi mới
Original file line number Diff line number Diff line change @@ -259,6 +259,7 @@ components:
259
259
header : 车站查看器
260
260
loadingText : 加载车站信息…
261
261
noStopsFound : 未找到该日期的车站时间.
262
+ operatorLogoAriaLabel : " 公交车站 {operatorName}:"
262
263
timezoneWarning : 出发时间以 <strong>{timezoneCode}</strong> 显示.
263
264
titleBarStopId : 车站 {stopId}
264
265
viewNextArrivals : 查看下一个公共交通到达
@@ -469,8 +470,6 @@ components:
469
470
noTripFound : 没有找到旅行
470
471
tripsFound : 我们发现了 {count} 选项
471
472
waiting : 等待...
472
- RouteRow :
473
- operatorLogoAltText : ' {operatorName} 标志'
474
473
SavedTripScreen :
475
474
tripNameAlreadyUsed : 另一个保存的旅行已经使用了这个名字. 请选择一个不同的名字.
476
475
tripNameRequired : 请输入一个行程名称.
Original file line number Diff line number Diff line change 1
1
import { TransitOperator } from '@opentripplanner/types'
2
- import { useIntl } from 'react-intl'
3
2
import React from 'react'
4
3
import styled from 'styled-components'
5
4
@@ -8,31 +7,13 @@ const OperatorImg = styled.img`
8
7
`
9
8
10
9
type Props = {
10
+ alt ?: string
11
11
operator ?: TransitOperator
12
12
}
13
13
14
- const OperatorLogo = ( { operator } : Props ) : JSX . Element | null => {
15
- const intl = useIntl ( )
16
-
14
+ const OperatorLogo = ( { alt, operator } : Props ) : JSX . Element | null => {
17
15
if ( ! operator ?. logo ) return null
18
-
19
- return (
20
- < OperatorImg
21
- alt = { intl . formatMessage (
22
- {
23
- id : 'components.RouteRow.operatorLogoAltText'
24
- } ,
25
- { operatorName : operator . name }
26
- ) }
27
- aria-label = { intl . formatMessage (
28
- {
29
- id : 'components.RouteRow.operatorLogoAriaLabel'
30
- } ,
31
- { operatorName : operator . name }
32
- ) }
33
- src = { operator . logo }
34
- />
35
- )
16
+ return < OperatorImg alt = { alt || operator . name } src = { operator . logo } />
36
17
}
37
18
38
19
export default OperatorLogo
Original file line number Diff line number Diff line change @@ -191,8 +191,13 @@ class StopViewer extends Component {
191
191
}
192
192
193
193
_renderHeader = ( agencyCount ) => {
194
- const { enableFavoriteStops, hideBackButton, showUserSettings, stopData } =
195
- this . props
194
+ const {
195
+ enableFavoriteStops,
196
+ hideBackButton,
197
+ intl,
198
+ showUserSettings,
199
+ stopData
200
+ } = this . props
196
201
197
202
// We can use the first route, as this operator will only be used if there is only one operator
198
203
const stationOperator = this . getOperator ( )
@@ -213,10 +218,22 @@ class StopViewer extends Component {
213
218
{ /* Header Text */ }
214
219
< div className = "header-text" >
215
220
{ stopData ? (
216
- < >
217
- { agencyCount <= 1 && < OperatorLogo operator = { stationOperator } /> }
218
- < h1 style = { { paddingLeft : '0.5ch' } } > { stopData . name } </ h1 >
219
- </ >
221
+ < h1 style = { { paddingLeft : '0.5ch' } } >
222
+ { agencyCount <= 1 && stationOperator && (
223
+ < OperatorLogo
224
+ alt = { intl . formatMessage (
225
+ {
226
+ id : 'components.StopViewer.operatorLogoAriaLabel'
227
+ } ,
228
+ {
229
+ operatorName : stationOperator . name
230
+ }
231
+ ) }
232
+ operator = { stationOperator }
233
+ />
234
+ ) }
235
+ { stopData . name }
236
+ </ h1 >
220
237
) : (
221
238
< h1 >
222
239
< FormattedMessage id = "components.StopViewer.loadingText" />
You can’t perform that action at this time.
0 commit comments