@opentripplanner/map-popup 3.1.1-alpha.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.js +17 -6
- package/esm/index.js.map +1 -1
- package/esm/styled.js +21 -0
- package/esm/styled.js.map +1 -1
- package/esm/util.js +4 -2
- package/esm/util.js.map +1 -1
- package/i18n/en-US.yml +2 -1
- package/i18n/es.yml +2 -1
- package/i18n/fr.yml +2 -1
- package/i18n/ko.yml +2 -1
- package/i18n/nb_NO.yml +4 -3
- package/i18n/ru.yml +2 -1
- package/i18n/tl.yml +2 -1
- package/i18n/tr.yml +1 -0
- package/i18n/vi.yml +2 -1
- package/i18n/zh_Hans.yml +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -6
- package/lib/index.js.map +1 -1
- package/lib/styled.d.ts +8 -0
- package/lib/styled.d.ts.map +1 -1
- package/lib/styled.js +33 -1
- package/lib/styled.js.map +1 -1
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +4 -2
- package/lib/util.js.map +1 -1
- package/package.json +3 -4
- package/src/MapPopup.story.tsx +21 -1
- package/src/__snapshots__/MapPopup.story.tsx.snap +302 -0
- package/src/index.tsx +19 -11
- package/src/styled.ts +29 -0
- package/src/util.ts +4 -2
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/map-popup",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "A component for displaying map popup contents",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"private": false,
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@opentripplanner/
|
|
15
|
-
"@opentripplanner/core-utils": "^11.4.0",
|
|
14
|
+
"@opentripplanner/core-utils": "^11.4.1",
|
|
16
15
|
"@opentripplanner/from-to-location-picker": "^2.1.12",
|
|
17
16
|
"flat": "^5.0.2"
|
|
18
17
|
},
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"@opentripplanner/types": "^6.5.0"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
|
-
"react": "^
|
|
22
|
+
"react": "^18.2.0",
|
|
24
23
|
"react-intl": "^5.24.6",
|
|
25
24
|
"styled-components": "^5.3.0"
|
|
26
25
|
},
|
package/src/MapPopup.story.tsx
CHANGED
|
@@ -40,7 +40,7 @@ const FLOATING_VEHICLE = {
|
|
|
40
40
|
id: '"bike_6861"',
|
|
41
41
|
isCarStation: false,
|
|
42
42
|
isFloatingBike: true,
|
|
43
|
-
name: "0541
|
|
43
|
+
name: "0541",
|
|
44
44
|
networks: ["BIKETOWN"],
|
|
45
45
|
realTimeData: true,
|
|
46
46
|
spacesAvailable: 0,
|
|
@@ -48,6 +48,22 @@ const FLOATING_VEHICLE = {
|
|
|
48
48
|
y: 45.525486666666666
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
const FLOATING_CAR = {
|
|
52
|
+
"stroke-width": 1,
|
|
53
|
+
allowDropoff: false,
|
|
54
|
+
allowPickup: true,
|
|
55
|
+
color: "#333",
|
|
56
|
+
id: "car_6861",
|
|
57
|
+
isCarStation: false,
|
|
58
|
+
isFloatingCar: true,
|
|
59
|
+
name: "0541",
|
|
60
|
+
networks: ["MILES"], // https://miles-mobility.com
|
|
61
|
+
realTimeData: true,
|
|
62
|
+
spacesAvailable: 0,
|
|
63
|
+
x: 13.405,
|
|
64
|
+
y: 52.52
|
|
65
|
+
};
|
|
66
|
+
|
|
51
67
|
export const StopEntity = (): JSX.Element => (
|
|
52
68
|
<MapPopupContents
|
|
53
69
|
entity={STOP}
|
|
@@ -68,6 +84,10 @@ export const StationEntity = (): JSX.Element => (
|
|
|
68
84
|
/>
|
|
69
85
|
);
|
|
70
86
|
|
|
87
|
+
export const FloatingCarEntity = (): JSX.Element => (
|
|
88
|
+
<MapPopupContents entity={FLOATING_CAR} setLocation={action("setLocation")} />
|
|
89
|
+
);
|
|
90
|
+
|
|
71
91
|
export const FloatingVehicleEntity = (): JSX.Element => (
|
|
72
92
|
<MapPopupContents
|
|
73
93
|
entity={FLOATING_VEHICLE}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Map Popup FloatingCarEntity smoke-test 1`] = `
|
|
4
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
5
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
6
|
+
MILES Car: 0541
|
|
7
|
+
</header>
|
|
8
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
9
|
+
<strong>
|
|
10
|
+
Plan a trip:
|
|
11
|
+
</strong>
|
|
12
|
+
<span class="styled__FromToPickerSpan-sc-vb4790-1 hmUShj">
|
|
13
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
14
|
+
<svg viewbox="0 0 512 512"
|
|
15
|
+
height="0.9em"
|
|
16
|
+
width="0.9em"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
focusable="false"
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__FromIcon-sc-n5xcvc-0 jTjMOf"
|
|
22
|
+
>
|
|
23
|
+
<path fill="currentColor"
|
|
24
|
+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
|
|
25
|
+
>
|
|
26
|
+
</path>
|
|
27
|
+
</svg>
|
|
28
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
29
|
+
From here
|
|
30
|
+
</button>
|
|
31
|
+
</span>
|
|
32
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
33
|
+
<svg viewbox="0 0 384 512"
|
|
34
|
+
height="0.9em"
|
|
35
|
+
width="0.9em"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
focusable="false"
|
|
38
|
+
fill="currentColor"
|
|
39
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
40
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__ToIcon-sc-n5xcvc-2 ipFnZE"
|
|
41
|
+
>
|
|
42
|
+
<path fill="currentColor"
|
|
43
|
+
d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"
|
|
44
|
+
>
|
|
45
|
+
</path>
|
|
46
|
+
</svg>
|
|
47
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
48
|
+
To here
|
|
49
|
+
</button>
|
|
50
|
+
</span>
|
|
51
|
+
</span>
|
|
52
|
+
</p>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
exports[`Map Popup FloatingVehicleEntity smoke-test 1`] = `
|
|
57
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
58
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
59
|
+
BIKETOWN Free-floating bike: 0541
|
|
60
|
+
</header>
|
|
61
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
62
|
+
<strong>
|
|
63
|
+
Plan a trip:
|
|
64
|
+
</strong>
|
|
65
|
+
<span class="styled__FromToPickerSpan-sc-vb4790-1 hmUShj">
|
|
66
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
67
|
+
<svg viewbox="0 0 512 512"
|
|
68
|
+
height="0.9em"
|
|
69
|
+
width="0.9em"
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
focusable="false"
|
|
72
|
+
fill="currentColor"
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__FromIcon-sc-n5xcvc-0 jTjMOf"
|
|
75
|
+
>
|
|
76
|
+
<path fill="currentColor"
|
|
77
|
+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
|
|
78
|
+
>
|
|
79
|
+
</path>
|
|
80
|
+
</svg>
|
|
81
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
82
|
+
From here
|
|
83
|
+
</button>
|
|
84
|
+
</span>
|
|
85
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
86
|
+
<svg viewbox="0 0 384 512"
|
|
87
|
+
height="0.9em"
|
|
88
|
+
width="0.9em"
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
focusable="false"
|
|
91
|
+
fill="currentColor"
|
|
92
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
93
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__ToIcon-sc-n5xcvc-2 ipFnZE"
|
|
94
|
+
>
|
|
95
|
+
<path fill="currentColor"
|
|
96
|
+
d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"
|
|
97
|
+
>
|
|
98
|
+
</path>
|
|
99
|
+
</svg>
|
|
100
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
101
|
+
To here
|
|
102
|
+
</button>
|
|
103
|
+
</span>
|
|
104
|
+
</span>
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
exports[`Map Popup StationEntity smoke-test 1`] = `
|
|
110
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
111
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
112
|
+
BIKETOWN SW Morrison at 18th
|
|
113
|
+
</header>
|
|
114
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
115
|
+
<div>
|
|
116
|
+
Available bikes: 6
|
|
117
|
+
</div>
|
|
118
|
+
<div>
|
|
119
|
+
Available docks: 11
|
|
120
|
+
</div>
|
|
121
|
+
</p>
|
|
122
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
123
|
+
<strong>
|
|
124
|
+
Plan a trip:
|
|
125
|
+
</strong>
|
|
126
|
+
<span class="styled__FromToPickerSpan-sc-vb4790-1 hmUShj">
|
|
127
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
128
|
+
<svg viewbox="0 0 512 512"
|
|
129
|
+
height="0.9em"
|
|
130
|
+
width="0.9em"
|
|
131
|
+
aria-hidden="true"
|
|
132
|
+
focusable="false"
|
|
133
|
+
fill="currentColor"
|
|
134
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
135
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__FromIcon-sc-n5xcvc-0 jTjMOf"
|
|
136
|
+
>
|
|
137
|
+
<path fill="currentColor"
|
|
138
|
+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
|
|
139
|
+
>
|
|
140
|
+
</path>
|
|
141
|
+
</svg>
|
|
142
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
143
|
+
From here
|
|
144
|
+
</button>
|
|
145
|
+
</span>
|
|
146
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
147
|
+
<svg viewbox="0 0 384 512"
|
|
148
|
+
height="0.9em"
|
|
149
|
+
width="0.9em"
|
|
150
|
+
aria-hidden="true"
|
|
151
|
+
focusable="false"
|
|
152
|
+
fill="currentColor"
|
|
153
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
154
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__ToIcon-sc-n5xcvc-2 ipFnZE"
|
|
155
|
+
>
|
|
156
|
+
<path fill="currentColor"
|
|
157
|
+
d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"
|
|
158
|
+
>
|
|
159
|
+
</path>
|
|
160
|
+
</svg>
|
|
161
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
162
|
+
To here
|
|
163
|
+
</button>
|
|
164
|
+
</span>
|
|
165
|
+
</span>
|
|
166
|
+
</p>
|
|
167
|
+
</div>
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
exports[`Map Popup StopEntity smoke-test 1`] = `
|
|
171
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
172
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
173
|
+
W Burnside & SW 2nd
|
|
174
|
+
</header>
|
|
175
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
176
|
+
<strong>
|
|
177
|
+
Stop ID: 9526
|
|
178
|
+
</strong>
|
|
179
|
+
<button class="styled__ViewStopButton-sc-12v7ov3-0 jdXQjY">
|
|
180
|
+
Stop Viewer
|
|
181
|
+
</button>
|
|
182
|
+
</p>
|
|
183
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
184
|
+
<strong>
|
|
185
|
+
Plan a trip:
|
|
186
|
+
</strong>
|
|
187
|
+
<span class="styled__FromToPickerSpan-sc-vb4790-1 hmUShj">
|
|
188
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
189
|
+
<svg viewbox="0 0 512 512"
|
|
190
|
+
height="0.9em"
|
|
191
|
+
width="0.9em"
|
|
192
|
+
aria-hidden="true"
|
|
193
|
+
focusable="false"
|
|
194
|
+
fill="currentColor"
|
|
195
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
196
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__FromIcon-sc-n5xcvc-0 jTjMOf"
|
|
197
|
+
>
|
|
198
|
+
<path fill="currentColor"
|
|
199
|
+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
|
|
200
|
+
>
|
|
201
|
+
</path>
|
|
202
|
+
</svg>
|
|
203
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
204
|
+
From here
|
|
205
|
+
</button>
|
|
206
|
+
</span>
|
|
207
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
208
|
+
<svg viewbox="0 0 384 512"
|
|
209
|
+
height="0.9em"
|
|
210
|
+
width="0.9em"
|
|
211
|
+
aria-hidden="true"
|
|
212
|
+
focusable="false"
|
|
213
|
+
fill="currentColor"
|
|
214
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
215
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__ToIcon-sc-n5xcvc-2 ipFnZE"
|
|
216
|
+
>
|
|
217
|
+
<path fill="currentColor"
|
|
218
|
+
d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"
|
|
219
|
+
>
|
|
220
|
+
</path>
|
|
221
|
+
</svg>
|
|
222
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
223
|
+
To here
|
|
224
|
+
</button>
|
|
225
|
+
</span>
|
|
226
|
+
</span>
|
|
227
|
+
</p>
|
|
228
|
+
</div>
|
|
229
|
+
`;
|
|
230
|
+
|
|
231
|
+
exports[`Map Popup StopEntityNoHandlers smoke-test 1`] = `
|
|
232
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
233
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
234
|
+
W Burnside & SW 2nd
|
|
235
|
+
</header>
|
|
236
|
+
</div>
|
|
237
|
+
`;
|
|
238
|
+
|
|
239
|
+
exports[`Map Popup StopEntityWithFocusTrap smoke-test 1`] = `
|
|
240
|
+
<div id="storybook-stop-popup-focus-trap"
|
|
241
|
+
role="presentation"
|
|
242
|
+
>
|
|
243
|
+
<div class="styled__MapOverlayPopup-sc-12v7ov3-2 hLIcgt">
|
|
244
|
+
<header class="styled__PopupTitle-sc-12v7ov3-4 jMeCoZ">
|
|
245
|
+
W Burnside & SW 2nd
|
|
246
|
+
</header>
|
|
247
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
248
|
+
<strong>
|
|
249
|
+
Stop ID: 9526
|
|
250
|
+
</strong>
|
|
251
|
+
<button class="styled__ViewStopButton-sc-12v7ov3-0 jdXQjY">
|
|
252
|
+
Stop Viewer
|
|
253
|
+
</button>
|
|
254
|
+
</p>
|
|
255
|
+
<p class="styled__PopupRow-sc-12v7ov3-3 bGmFCM">
|
|
256
|
+
<strong>
|
|
257
|
+
Plan a trip:
|
|
258
|
+
</strong>
|
|
259
|
+
<span class="styled__FromToPickerSpan-sc-vb4790-1 hmUShj">
|
|
260
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
261
|
+
<svg viewbox="0 0 512 512"
|
|
262
|
+
height="0.9em"
|
|
263
|
+
width="0.9em"
|
|
264
|
+
aria-hidden="true"
|
|
265
|
+
focusable="false"
|
|
266
|
+
fill="currentColor"
|
|
267
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
268
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__FromIcon-sc-n5xcvc-0 jTjMOf"
|
|
269
|
+
>
|
|
270
|
+
<path fill="currentColor"
|
|
271
|
+
d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
|
|
272
|
+
>
|
|
273
|
+
</path>
|
|
274
|
+
</svg>
|
|
275
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
276
|
+
From here
|
|
277
|
+
</button>
|
|
278
|
+
</span>
|
|
279
|
+
<span class="styled__LocationPickerSpan-sc-vb4790-0 gwsIFy">
|
|
280
|
+
<svg viewbox="0 0 384 512"
|
|
281
|
+
height="0.9em"
|
|
282
|
+
width="0.9em"
|
|
283
|
+
aria-hidden="true"
|
|
284
|
+
focusable="false"
|
|
285
|
+
fill="currentColor"
|
|
286
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
287
|
+
class="StyledIconBase-ea9ulj-0 hPhvO styled__ToIcon-sc-n5xcvc-2 ipFnZE"
|
|
288
|
+
>
|
|
289
|
+
<path fill="currentColor"
|
|
290
|
+
d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"
|
|
291
|
+
>
|
|
292
|
+
</path>
|
|
293
|
+
</svg>
|
|
294
|
+
<button class="styled__Button-sc-vb4790-2 hNNoVB">
|
|
295
|
+
To here
|
|
296
|
+
</button>
|
|
297
|
+
</span>
|
|
298
|
+
</span>
|
|
299
|
+
</p>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
`;
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
|
|
3
|
-
import { Styled as BaseMapStyled } from "@opentripplanner/base-map";
|
|
4
2
|
import FromToLocationPicker from "@opentripplanner/from-to-location-picker";
|
|
3
|
+
import coreUtils from "@opentripplanner/core-utils";
|
|
4
|
+
|
|
5
5
|
// eslint-disable-next-line prettier/prettier
|
|
6
6
|
import type { Company, ConfiguredCompany, Location, Station, Stop, StopEventHandler } from "@opentripplanner/types";
|
|
7
7
|
|
|
@@ -33,7 +33,7 @@ const generateLocation = (entity: Entity, name: string) => {
|
|
|
33
33
|
|
|
34
34
|
const StationHubDetails = ({ station }: { station: Station }) => {
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<S.PopupRow>
|
|
37
37
|
<div>
|
|
38
38
|
<FormattedMessage
|
|
39
39
|
defaultMessage={
|
|
@@ -54,13 +54,13 @@ const StationHubDetails = ({ station }: { station: Station }) => {
|
|
|
54
54
|
values={{ value: station.spacesAvailable }}
|
|
55
55
|
/>
|
|
56
56
|
</div>
|
|
57
|
-
</
|
|
57
|
+
</S.PopupRow>
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const StopDetails = ({ id, setViewedStop }: { id: string, setViewedStop: () => void; }) => {
|
|
62
62
|
return (
|
|
63
|
-
<
|
|
63
|
+
<S.PopupRow>
|
|
64
64
|
<strong>
|
|
65
65
|
<FormattedMessage
|
|
66
66
|
defaultMessage={defaultMessages["otpUi.MapPopup.stopId"]}
|
|
@@ -78,7 +78,7 @@ const StopDetails = ({ id, setViewedStop }: { id: string, setViewedStop: () => v
|
|
|
78
78
|
id="otpUi.MapPopup.stopViewer"
|
|
79
79
|
/>
|
|
80
80
|
</S.ViewStopButton>
|
|
81
|
-
</
|
|
81
|
+
</S.PopupRow>
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -105,14 +105,22 @@ export function MapPopup({ configCompanies, entity, getEntityName, setLocation,
|
|
|
105
105
|
const getNameFunc = getEntityName || makeDefaultGetEntityName(intl, defaultMessages);
|
|
106
106
|
const name = getNameFunc(entity, configCompanies);
|
|
107
107
|
|
|
108
|
+
const stationNetwork = "networks" in entity && (coreUtils.itinerary.getCompaniesLabelFromNetworks(entity?.networks || [], configCompanies) || entity?.networks?.[0]);
|
|
108
109
|
|
|
109
110
|
const bikesAvailablePresent = entityIsStation(entity)
|
|
110
111
|
const entityIsStationHub = bikesAvailablePresent && entity?.bikesAvailable !== undefined && !entity?.isFloatingBike;
|
|
111
112
|
const stopId = !bikesAvailablePresent && entity?.code || entity.id.split(":")[1] || entity.id
|
|
112
113
|
|
|
113
114
|
return (
|
|
114
|
-
<
|
|
115
|
-
<
|
|
115
|
+
<S.MapOverlayPopup>
|
|
116
|
+
<S.PopupTitle>
|
|
117
|
+
<FormattedMessage
|
|
118
|
+
defaultMessage={defaultMessages["otpUi.MapPopup.popupTitle"]}
|
|
119
|
+
description="Text for title of the popup, contains an optional company name"
|
|
120
|
+
id="otpUi.MapPopup.popupTitle"
|
|
121
|
+
values={{ name, stationNetwork }}
|
|
122
|
+
/>
|
|
123
|
+
</S.PopupTitle>
|
|
116
124
|
{/* render dock info if it is available */}
|
|
117
125
|
{entityIsStationHub && <StationHubDetails station={entity} />}
|
|
118
126
|
|
|
@@ -126,15 +134,15 @@ export function MapPopup({ configCompanies, entity, getEntityName, setLocation,
|
|
|
126
134
|
|
|
127
135
|
{/* The "Set as [from/to]" ButtonGroup */}
|
|
128
136
|
{setLocation && (
|
|
129
|
-
<
|
|
137
|
+
<S.PopupRow>
|
|
130
138
|
<FromToLocationPicker
|
|
131
139
|
label
|
|
132
140
|
location={generateLocation(entity, name)}
|
|
133
141
|
setLocation={setLocation}
|
|
134
142
|
/>
|
|
135
|
-
</
|
|
143
|
+
</S.PopupRow>
|
|
136
144
|
)}
|
|
137
|
-
</
|
|
145
|
+
</S.MapOverlayPopup>
|
|
138
146
|
);
|
|
139
147
|
}
|
|
140
148
|
|
package/src/styled.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
|
|
3
|
+
import { Popup as MapGlPopup } from "react-map-gl";
|
|
4
|
+
|
|
3
5
|
/* eslint-disable-next-line import/prefer-default-export */
|
|
4
6
|
export const ViewStopButton = styled.button`
|
|
5
7
|
background: none;
|
|
@@ -12,3 +14,30 @@ export const ViewStopButton = styled.button`
|
|
|
12
14
|
margin-left: 5px;
|
|
13
15
|
padding-top: 0;
|
|
14
16
|
`;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Adds a box shadow and tweaks border radius to make popups easier to read.
|
|
20
|
+
*/
|
|
21
|
+
export const Popup = styled(MapGlPopup)`
|
|
22
|
+
& > .maplibregl-popup-content,
|
|
23
|
+
& > .mapboxgl-popup-content {
|
|
24
|
+
border-radius: 10px;
|
|
25
|
+
box-shadow: 0 3px 14px 4px rgb(0 0 0 / 20%);
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const MapOverlayPopup = styled.div`
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
line-height: 1.5;
|
|
32
|
+
min-width: 250px;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export const PopupRow = styled.p`
|
|
36
|
+
margin-top: 6px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const PopupTitle = styled.header`
|
|
40
|
+
font-size: 18px;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
margin-bottom: 6px;
|
|
43
|
+
`;
|
package/src/util.ts
CHANGED
|
@@ -11,6 +11,8 @@ export function makeDefaultGetEntityName(
|
|
|
11
11
|
entity: Station | Stop,
|
|
12
12
|
configCompanies: Company[]
|
|
13
13
|
): string | null {
|
|
14
|
+
// TODO: Stop generating this / passing it to the car string? Is it needed?
|
|
15
|
+
// In English we say "Car: " instead
|
|
14
16
|
const stationNetworks =
|
|
15
17
|
"networks" in entity &&
|
|
16
18
|
(coreUtils.itinerary.getCompaniesLabelFromNetworks(
|
|
@@ -36,7 +38,7 @@ export function makeDefaultGetEntityName(
|
|
|
36
38
|
description: "Popup title for a free-floating bike",
|
|
37
39
|
id: "otpUi.MapPopup.floatingBike"
|
|
38
40
|
},
|
|
39
|
-
{ name: stationName
|
|
41
|
+
{ name: stationName }
|
|
40
42
|
);
|
|
41
43
|
} else if ("isFloatingCar" in entity && entity.isFloatingCar) {
|
|
42
44
|
stationName = intl.formatMessage(
|
|
@@ -59,7 +61,7 @@ export function makeDefaultGetEntityName(
|
|
|
59
61
|
description: "Popup title for a free-floating e-scooter",
|
|
60
62
|
id: "otpUi.MapPopup.floatingEScooter"
|
|
61
63
|
},
|
|
62
|
-
{ name: stationName
|
|
64
|
+
{ name: stationName }
|
|
63
65
|
);
|
|
64
66
|
}
|
|
65
67
|
return stationName;
|