Skip to content

Commit d8af041

Browse files
feat(map-popup): pass operator images to header
1 parent ae97b4d commit d8af041

15 files changed

+440
-52
lines changed

packages/map-popup/i18n/en-US.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Available bikes: {value}"
44
availableDocks: "Available docks: {value}"
55
floatingBike: "Free-floating bike: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Car: {name}"
77
floatingEScooter: "E-scooter: {name}"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "Stop ID: {stopId}"
910
stopViewer: Stop Viewer

packages/map-popup/i18n/es.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Bicicletas disponibles: {value}"
44
availableDocks: "Estaciones de carga disponibles: {value}"
55
floatingBike: "Bicicleta flotante: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Carro: {name}"
77
floatingEScooter: Scooter eléctrico {name}
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: Parada n°{stopId}
910
stopViewer: Visor de paradas

packages/map-popup/i18n/fr.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Vélos disponibles : {value}"
44
availableDocks: "Bornes disponibles : {value}"
55
floatingBike: "Vélo flottant : {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Voiture : {name}"
77
floatingEScooter: Trottinette {name}
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: Arrêt n°{stopId}
910
stopViewer: Info arrêt

packages/map-popup/i18n/ko.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "사용 가능한 자전거: {value}"
44
availableDocks: "사용 가능한 도크: {value}"
55
floatingBike: "프리-플로팅 자전거: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "자동차: {name}"
77
floatingEScooter: "{name} 전동스쿠터"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "정류장 ID: {stopId}"
910
stopViewer: 정류장 뷰어

packages/map-popup/i18n/nb_NO.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
otpUi:
22
MapPopup:
33
availableBikes: "Tilgjengelige sykler: {value}"
4+
availableDocks: "Tilgjengelige stasjoner: {value}"
5+
floatingBike: "Stasjonsløs sykkel: {name}"
46
floatingCar: "{company} {name}"
7+
floatingEScooter: "E-scooter: {name}"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
59
stopId: "Stopp-ID: {stopId}"
610
stopViewer: Stopp-viser
7-
availableDocks: "Tilgjengelige stasjoner: {value}"
8-
floatingEScooter: "E-scooter: {name}"
9-
floatingBike: "Stasjonsløs sykkel: {name}"

packages/map-popup/i18n/ru.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Доступные велосипеды: {value}"
44
availableDocks: "Доступные станции: {value}"
55
floatingBike: "Арендный велосипед не на станции: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Авто: {name}"
77
floatingEScooter: "Электросамокат: {name}"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "Идентификатор остановки: {stopId}"
910
stopViewer: Средство просмотра остановок

packages/map-popup/i18n/tl.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Mga available na bisikleta: {value}"
44
availableDocks: "Mga available na dock: {value}"
55
floatingBike: "Free-floating na bisikleta: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Sasakyan: {name}"
77
floatingEScooter: "E-scooter: {name}"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "ID ng Hintuan: {stopId}"
910
stopViewer: Ihinto ang Viewer

packages/map-popup/i18n/tr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ otpUi:
55
floatingBike: "Serbest gezen bisiklet: {name}"
66
floatingCar: "{company} {name}"
77
floatingEScooter: "E-skuter: {name}"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "Durak ID: {stopId}"
910
stopViewer: Durak Gösterici

packages/map-popup/i18n/vi.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "Xe đạp có sẵn: {value}"
44
availableDocks: "Chỗ dựng xe đạp có sẵn: {value}"
55
floatingBike: "Xe đạp để tự do: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "Xe hơi: {name}"
77
floatingEScooter: Xe tay ga điện {name}
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: Điểm dừng số {stopId}
910
stopViewer: Xem điểm dừng

packages/map-popup/i18n/zh_Hans.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ otpUi:
33
availableBikes: "可用的自行车: {value}"
44
availableDocks: "可用的充电座: {value}"
55
floatingBike: "自由浮动的自行车: {name}"
6-
floatingCar: "{company} {name}"
6+
floatingCar: "汽车: {name}"
77
floatingEScooter: "{name} 电动滑板车"
8+
popupTitle: "{stationNetwork, select, false {{name}} other {{stationNetwork} {name}}}"
89
stopId: "车站 ID: {stopId}"
910
stopViewer: 车站查看器

packages/map-popup/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentripplanner/map-popup",
3-
"version": "3.1.1-alpha.1",
3+
"version": "5.0.0",
44
"description": "A component for displaying map popup contents",
55
"main": "lib/index.js",
66
"module": "esm/index.js",
@@ -11,16 +11,17 @@
1111
"license": "MIT",
1212
"private": false,
1313
"dependencies": {
14-
"@opentripplanner/base-map": "^3.1.0",
15-
"@opentripplanner/core-utils": "^11.4.0",
16-
"@opentripplanner/from-to-location-picker": "^2.1.12",
14+
"@opentripplanner/base-map": "^3.2.2",
15+
"@opentripplanner/building-blocks": "^1.2.2",
16+
"@opentripplanner/core-utils": "^11.4.4",
17+
"@opentripplanner/from-to-location-picker": "^2.1.14",
1718
"flat": "^5.0.2"
1819
},
1920
"devDependencies": {
20-
"@opentripplanner/types": "^6.5.0"
21+
"@opentripplanner/types": "^6.5.2"
2122
},
2223
"peerDependencies": {
23-
"react": "^16.14.0",
24+
"react": "^18.2.0",
2425
"react-intl": "^5.24.6",
2526
"styled-components": "^5.3.0"
2627
},

packages/map-popup/src/MapPopup.story.tsx

+45-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import React from "react";
22
import { action } from "@storybook/addon-actions";
3-
import MapPopupContents, { FocusTrapWrapper } from "./index";
3+
import styled from "styled-components";
4+
import { Station, Stop } from "@opentripplanner/types";
5+
import MapPopupContents from "./index";
46

57
export default {
68
title: "Map Popup"
79
};
810

911
const STOP = {
1012
flex: false,
13+
gtfsId: "9526",
1114
id: "9526",
1215
lat: 45.523009,
1316
lon: -122.672529,
@@ -40,21 +43,57 @@ const FLOATING_VEHICLE = {
4043
id: '"bike_6861"',
4144
isCarStation: false,
4245
isFloatingBike: true,
43-
name: "0541 BIKETOWN",
46+
name: "0541",
4447
networks: ["BIKETOWN"],
4548
realTimeData: true,
4649
spacesAvailable: 0,
4750
x: -122.70486,
4851
y: 45.525486666666666
4952
};
5053

54+
const FLOATING_CAR = {
55+
"stroke-width": 1,
56+
allowDropoff: false,
57+
allowPickup: true,
58+
color: "#333",
59+
id: "car_6861",
60+
isCarStation: false,
61+
isFloatingCar: true,
62+
name: "0541",
63+
networks: ["MILES"], // https://miles-mobility.com
64+
realTimeData: true,
65+
spacesAvailable: 0,
66+
x: 13.405,
67+
y: 52.52
68+
};
69+
70+
const getEntityPrefixExample = (entity: Stop | Station) => {
71+
const DemoIcon = styled.span`
72+
background-color: blue;
73+
border-radius: 50px;
74+
color: white;
75+
margin-right: 0.5ch;
76+
padding: 2px;
77+
`;
78+
79+
return <DemoIcon>{entity.name?.charAt(0)}</DemoIcon>;
80+
};
81+
5182
export const StopEntity = (): JSX.Element => (
5283
<MapPopupContents
5384
entity={STOP}
5485
setLocation={action("setLocation")}
5586
setViewedStop={action("setViewedStop")}
5687
/>
5788
);
89+
export const StopEntitywithEntityPrefix = (): JSX.Element => (
90+
<MapPopupContents
91+
entity={STOP}
92+
getEntityPrefix={getEntityPrefixExample}
93+
setLocation={action("setLocation")}
94+
setViewedStop={action("setViewedStop")}
95+
/>
96+
);
5897

5998
export const StopEntityNoHandlers = (): JSX.Element => (
6099
<MapPopupContents entity={STOP} />
@@ -68,20 +107,14 @@ export const StationEntity = (): JSX.Element => (
68107
/>
69108
);
70109

110+
export const FloatingCarEntity = (): JSX.Element => (
111+
<MapPopupContents entity={FLOATING_CAR} setLocation={action("setLocation")} />
112+
);
113+
71114
export const FloatingVehicleEntity = (): JSX.Element => (
72115
<MapPopupContents
73116
entity={FLOATING_VEHICLE}
74117
setLocation={action("setLocation")}
75118
setViewedStop={action("setViewedStop")}
76119
/>
77120
);
78-
79-
export const StopEntityWithFocusTrap = (): JSX.Element => (
80-
<FocusTrapWrapper closePopup={() => {}} id="storybook-stop">
81-
<MapPopupContents
82-
entity={STOP}
83-
setLocation={action("setLocation")}
84-
setViewedStop={action("setViewedStop")}
85-
/>
86-
</FocusTrapWrapper>
87-
);

0 commit comments

Comments
 (0)