react-spatial 1.2.2 → 1.2.3-beta.1
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/components/BaseLayerSwitcher/BaseLayerSwitcher.js +163 -221
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -1
- package/components/BaseLayerSwitcher/index.js +1 -3
- package/components/BaseLayerSwitcher/index.js.map +7 -1
- package/components/BasicMap/BasicMap.js +147 -285
- package/components/BasicMap/BasicMap.js.map +7 -1
- package/components/BasicMap/index.js +1 -3
- package/components/BasicMap/index.js.map +7 -1
- package/components/CanvasSaveButton/CanvasSaveButton.js +165 -419
- package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -1
- package/components/CanvasSaveButton/index.js +1 -3
- package/components/CanvasSaveButton/index.js.map +7 -1
- package/components/Copyright/Copyright.js +29 -70
- package/components/Copyright/Copyright.js.map +7 -1
- package/components/Copyright/index.js +1 -3
- package/components/Copyright/index.js.map +7 -1
- package/components/FeatureExportButton/FeatureExportButton.js +40 -106
- package/components/FeatureExportButton/FeatureExportButton.js.map +7 -1
- package/components/FeatureExportButton/index.js +1 -3
- package/components/FeatureExportButton/index.js.map +7 -1
- package/components/FilterButton/FilterButton.js +41 -106
- package/components/FilterButton/FilterButton.js.map +7 -1
- package/components/FilterButton/index.js +1 -3
- package/components/FilterButton/index.js.map +7 -1
- package/components/FitExtent/FitExtent.js +17 -50
- package/components/FitExtent/FitExtent.js.map +7 -1
- package/components/FitExtent/index.js +1 -3
- package/components/FitExtent/index.js.map +7 -1
- package/components/FollowButton/FollowButton.js +41 -111
- package/components/FollowButton/FollowButton.js.map +7 -1
- package/components/FollowButton/index.js +1 -3
- package/components/FollowButton/index.js.map +7 -1
- package/components/Geolocation/Geolocation.js +104 -213
- package/components/Geolocation/Geolocation.js.map +7 -1
- package/components/Geolocation/index.js +1 -3
- package/components/Geolocation/index.js.map +7 -1
- package/components/LayerTree/LayerTree.js +204 -410
- package/components/LayerTree/LayerTree.js.map +7 -1
- package/components/LayerTree/index.js +1 -3
- package/components/LayerTree/index.js.map +7 -1
- package/components/MousePosition/MousePosition.js +61 -130
- package/components/MousePosition/MousePosition.js.map +7 -1
- package/components/MousePosition/index.js +1 -3
- package/components/MousePosition/index.js.map +7 -1
- package/components/NorthArrow/NorthArrow.js +22 -62
- package/components/NorthArrow/NorthArrow.js.map +7 -1
- package/components/NorthArrow/index.js +1 -3
- package/components/NorthArrow/index.js.map +7 -1
- package/components/Overlay/Overlay.js +83 -130
- package/components/Overlay/Overlay.js.map +7 -1
- package/components/Overlay/index.js +1 -3
- package/components/Overlay/index.js.map +7 -1
- package/components/Permalink/Permalink.js +150 -244
- package/components/Permalink/Permalink.js.map +7 -1
- package/components/Permalink/index.js +1 -3
- package/components/Permalink/index.js.map +7 -1
- package/components/Popup/Popup.js +106 -233
- package/components/Popup/Popup.js.map +7 -1
- package/components/Popup/index.js +1 -3
- package/components/Popup/index.js.map +7 -1
- package/components/ResizeHandler/ResizeHandler.js +58 -113
- package/components/ResizeHandler/ResizeHandler.js.map +7 -1
- package/components/ResizeHandler/index.js +1 -3
- package/components/ResizeHandler/index.js.map +7 -1
- package/components/RouteSchedule/RouteSchedule.js +150 -283
- package/components/RouteSchedule/RouteSchedule.js.map +7 -1
- package/components/RouteSchedule/index.js +1 -3
- package/components/RouteSchedule/index.js.map +7 -1
- package/components/ScaleLine/ScaleLine.js +21 -45
- package/components/ScaleLine/ScaleLine.js.map +7 -1
- package/components/ScaleLine/index.js +1 -3
- package/components/ScaleLine/index.js.map +7 -1
- package/components/Search/Search.js +122 -186
- package/components/Search/Search.js.map +7 -1
- package/components/Search/SearchService.js +45 -69
- package/components/Search/SearchService.js.map +7 -1
- package/components/Search/engines/Engine.js +18 -25
- package/components/Search/engines/Engine.js.map +7 -1
- package/components/Search/engines/StopFinder.js +21 -38
- package/components/Search/engines/StopFinder.js.map +7 -1
- package/components/Search/index.js +3 -6
- package/components/Search/index.js.map +7 -1
- package/components/StopsFinder/StopsFinder.js +123 -174
- package/components/StopsFinder/StopsFinder.js.map +7 -1
- package/components/StopsFinder/StopsFinderOption.js +37 -54
- package/components/StopsFinder/StopsFinderOption.js.map +7 -1
- package/components/StopsFinder/index.js +1 -3
- package/components/StopsFinder/index.js.map +7 -1
- package/components/TrackerControl/TrackerControl.js +73 -128
- package/components/TrackerControl/TrackerControl.js.map +7 -1
- package/components/TrackerControl/index.js +1 -3
- package/components/TrackerControl/index.js.map +7 -1
- package/components/Zoom/Zoom.js +69 -112
- package/components/Zoom/Zoom.js.map +7 -1
- package/components/Zoom/index.js +1 -3
- package/components/Zoom/index.js.map +7 -1
- package/package.json +10 -5
- package/themes/default/components.scss +0 -1
- package/themes/default/examples.scss +0 -1
- package/utils/GlobalsForOle.js +63 -64
- package/utils/GlobalsForOle.js.map +7 -1
- package/utils/KML.js +178 -364
- package/utils/KML.js.map +7 -1
- package/utils/KMLFormat.js +37 -73
- package/utils/KMLFormat.js.map +7 -1
- package/utils/Styles.js +24 -32
- package/utils/Styles.js.map +7 -1
- package/utils/getPolygonPattern.js +11 -44
- package/utils/getPolygonPattern.js.map +7 -1
- package/utils/timeUtils.js +16 -35
- package/utils/timeUtils.js.map +7 -1
- package/LayerService.js +0 -193
- package/LayerService.js.map +0 -1
- package/LayerService.test.js +0 -160
- package/LayerService.test.js.map +0 -1
- package/Projections.js +0 -16
- package/Projections.js.map +0 -1
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -88
- package/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js.map +0 -1
- package/components/BaseLayerToggler/BaseLayerToggler.js +0 -490
- package/components/BaseLayerToggler/BaseLayerToggler.js.map +0 -1
- package/components/BaseLayerToggler/BaseLayerToggler.md.scss +0 -9
- package/components/BaseLayerToggler/BaseLayerToggler.scss +0 -49
- package/components/BaseLayerToggler/BaseLayerToggler.test.js +0 -127
- package/components/BaseLayerToggler/BaseLayerToggler.test.js.map +0 -1
- package/components/BaseLayerToggler/index.js +0 -3
- package/components/BaseLayerToggler/index.js.map +0 -1
- package/components/BasicMap/BasicMap.test.js +0 -288
- package/components/BasicMap/BasicMap.test.js.map +0 -1
- package/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -173
- package/components/CanvasSaveButton/CanvasSaveButton.test.js.map +0 -1
- package/components/Copyright/Copyright.test.js +0 -133
- package/components/Copyright/Copyright.test.js.map +0 -1
- package/components/FeatureExportButton/FeatureExportButton.test.js +0 -407
- package/components/FeatureExportButton/FeatureExportButton.test.js.map +0 -1
- package/components/FilterButton/FilterButton.test.js +0 -48
- package/components/FilterButton/FilterButton.test.js.map +0 -1
- package/components/FitExtent/FitExtent.test.js +0 -44
- package/components/FitExtent/FitExtent.test.js.map +0 -1
- package/components/FollowButton/FollowButton.test.js +0 -57
- package/components/FollowButton/FollowButton.test.js.map +0 -1
- package/components/Geolocation/Geolocation.test.js +0 -263
- package/components/Geolocation/Geolocation.test.js.map +0 -1
- package/components/LayerTree/LayerTree.test.js +0 -323
- package/components/LayerTree/LayerTree.test.js.map +0 -1
- package/components/MousePosition/MousePosition.test.js +0 -125
- package/components/MousePosition/MousePosition.test.js.map +0 -1
- package/components/NorthArrow/NorthArrow.test.js +0 -106
- package/components/NorthArrow/NorthArrow.test.js.map +0 -1
- package/components/Overlay/Overlay.test.js +0 -145
- package/components/Overlay/Overlay.test.js.map +0 -1
- package/components/Permalink/Permalink.test.js +0 -267
- package/components/Permalink/Permalink.test.js.map +0 -1
- package/components/Popup/Popup.test.js +0 -291
- package/components/Popup/Popup.test.js.map +0 -1
- package/components/ResizeHandler/ResizeHandler.test.js +0 -410
- package/components/ResizeHandler/ResizeHandler.test.js.map +0 -1
- package/components/RouteSchedule/RouteSchedule.test.js +0 -102
- package/components/RouteSchedule/RouteSchedule.test.js.map +0 -1
- package/components/ScaleLine/ScaleLine.test.js +0 -32
- package/components/ScaleLine/ScaleLine.test.js.map +0 -1
- package/components/Search/Search.test.js +0 -15
- package/components/Search/Search.test.js.map +0 -1
- package/components/StopsFinder/StopsFinder.test.js +0 -19
- package/components/StopsFinder/StopsFinder.test.js.map +0 -1
- package/components/TrackerControl/TrackerControl.test.js +0 -17
- package/components/TrackerControl/TrackerControl.test.js.map +0 -1
- package/components/Zoom/Zoom.test.js +0 -150
- package/components/Zoom/Zoom.test.js.map +0 -1
- package/propTypes.js +0 -55
- package/propTypes.js.map +0 -1
- package/setupTests.js +0 -5
- package/setupTests.js.map +0 -1
- package/styleguidist/ComponentsList.js +0 -52
- package/styleguidist/ComponentsList.js.map +0 -1
- package/styleguidist/StyleGuide.js +0 -253
- package/styleguidist/StyleGuide.js.map +0 -1
- package/utils/KML.test.js +0 -163
- package/utils/KML.test.js.map +0 -1
- package/utils/KMLFormat.test.js +0 -22
- package/utils/KMLFormat.test.js.map +0 -1
- package/utils/getPolygonPattern.test.js +0 -66
- package/utils/getPolygonPattern.test.js.map +0 -1
- package/utils/timeUtils.test.js +0 -32
- package/utils/timeUtils.test.js.map +0 -1
|
@@ -1,83 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { getHoursAndMinutes, getDelayString } from
|
|
8
|
-
import ReactTransitPropTypes from
|
|
9
|
-
import firstStation from
|
|
10
|
-
import station from
|
|
11
|
-
import lastStation from
|
|
12
|
-
import line from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @param {Number} time Delay time in milliseconds.
|
|
17
|
-
*/
|
|
18
|
-
var getDelayColor = function (time) {
|
|
19
|
-
var secs = Math.round(((time / 1800 / 2) * 3600) / 1000);
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import {
|
|
4
|
+
RealtimeLayer as TrackerLayer,
|
|
5
|
+
trackerConfig
|
|
6
|
+
} from "mobility-toolbox-js/ol";
|
|
7
|
+
import { getHoursAndMinutes, getDelayString } from "../../utils/timeUtils";
|
|
8
|
+
import ReactTransitPropTypes from "../../propTypes";
|
|
9
|
+
import firstStation from "../../images/RouteSchedule/firstStation.png";
|
|
10
|
+
import station from "../../images/RouteSchedule/station.png";
|
|
11
|
+
import lastStation from "../../images/RouteSchedule/lastStation.png";
|
|
12
|
+
import line from "../../images/RouteSchedule/line.png";
|
|
13
|
+
const { getBgColor } = trackerConfig;
|
|
14
|
+
const getDelayColor = (time) => {
|
|
15
|
+
const secs = Math.round(time / 1800 / 2 * 3600 / 1e3);
|
|
20
16
|
if (secs >= 3600) {
|
|
21
|
-
return
|
|
17
|
+
return "dark-red";
|
|
22
18
|
}
|
|
23
19
|
if (secs >= 500) {
|
|
24
|
-
return
|
|
20
|
+
return "middle-red";
|
|
25
21
|
}
|
|
26
22
|
if (secs >= 300) {
|
|
27
|
-
return
|
|
23
|
+
return "light-red";
|
|
28
24
|
}
|
|
29
25
|
if (secs >= 180) {
|
|
30
|
-
return
|
|
26
|
+
return "orange";
|
|
31
27
|
}
|
|
32
|
-
return
|
|
28
|
+
return "green";
|
|
33
29
|
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Returns true if the train doesn't stop to the station.
|
|
37
|
-
* @param {Object} stop Station information.
|
|
38
|
-
*/
|
|
39
|
-
var isNotStop = function (stop) {
|
|
30
|
+
const isNotStop = (stop) => {
|
|
40
31
|
return !stop.arrivalTime && !stop.departureTime;
|
|
41
32
|
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Returns if the station has already been passed by the vehicule.
|
|
45
|
-
* @param {Object} stop Station information.
|
|
46
|
-
* @param {number} time The current time to test in ms.
|
|
47
|
-
* @param {Array<Object>} stops the list of all stops of the train.
|
|
48
|
-
* @param {idx} idx The index of the stop object in the stops array.
|
|
49
|
-
*/
|
|
50
|
-
var isPassed = function (stop, time, stops, idx) {
|
|
51
|
-
// If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.
|
|
52
|
-
// if yes the current stop is considered as passed.
|
|
33
|
+
const isPassed = (stop, time, stops, idx) => {
|
|
53
34
|
if (isNotStop(stop)) {
|
|
54
35
|
if (stops[idx - 1] && idx > 0) {
|
|
55
36
|
return isPassed(stops[idx - 1], time, stops, idx);
|
|
56
37
|
}
|
|
57
38
|
return true;
|
|
58
39
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var timeToCompare = stop.departureTime || stop.arrivalTime || 0;
|
|
62
|
-
var delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;
|
|
40
|
+
const timeToCompare = stop.departureTime || stop.arrivalTime || 0;
|
|
41
|
+
const delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;
|
|
63
42
|
return timeToCompare + delayToCompare <= time;
|
|
64
43
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* @param {Number} stations The stations list.
|
|
69
|
-
* @param {Number} index Index of the station in the list.
|
|
70
|
-
* @param {Boolean} isStationPassed If the train is already passed at this station.
|
|
71
|
-
* @param {Boolean} isNotStation If the train doesn't stop to this station.
|
|
72
|
-
*/
|
|
73
|
-
var defaultRenderStationImg = function (
|
|
74
|
-
stations,
|
|
75
|
-
index,
|
|
76
|
-
isStationPassed,
|
|
77
|
-
isNotStation
|
|
78
|
-
) {
|
|
79
|
-
var length = stations.length;
|
|
80
|
-
var src = station.src || station;
|
|
44
|
+
const defaultRenderStationImg = (stations, index, isStationPassed, isNotStation) => {
|
|
45
|
+
const { length } = stations;
|
|
46
|
+
let src = station.src || station;
|
|
81
47
|
if (index === 0) {
|
|
82
48
|
src = firstStation.src || firstStation;
|
|
83
49
|
} else if (index === length - 1) {
|
|
@@ -85,267 +51,168 @@ var defaultRenderStationImg = function (
|
|
|
85
51
|
} else if (isNotStation) {
|
|
86
52
|
src = line.src || line;
|
|
87
53
|
}
|
|
88
|
-
return React.createElement(
|
|
54
|
+
return /* @__PURE__ */ React.createElement("img", {
|
|
55
|
+
src,
|
|
56
|
+
alt: "routeScheduleLine",
|
|
57
|
+
className: "rt-route-icon"
|
|
58
|
+
});
|
|
89
59
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
React.createElement( 'span', {
|
|
148
|
-
className: ("rt-route-time-arrival " + (cancelled ? 'rt-route-cancelled' : '')) },
|
|
149
|
-
getHoursAndMinutes(arrivalTime)
|
|
150
|
-
),
|
|
151
|
-
React.createElement( 'span', {
|
|
152
|
-
className: ("rt-route-time-departure " + (cancelled ? 'rt-route-cancelled' : '')) },
|
|
153
|
-
getHoursAndMinutes(departureTime)
|
|
154
|
-
)
|
|
155
|
-
),
|
|
156
|
-
renderStationImg(stations, idx, isStationPassed, isNotStation),
|
|
157
|
-
React.createElement( 'div', { className: cancelled ? 'rt-route-cancelled' : '' }, stationName)
|
|
158
|
-
)
|
|
159
|
-
);
|
|
60
|
+
const defaultRenderStation = ({
|
|
61
|
+
lineInfos,
|
|
62
|
+
onStationClick,
|
|
63
|
+
trackerLayer,
|
|
64
|
+
renderStationImg,
|
|
65
|
+
stop,
|
|
66
|
+
idx
|
|
67
|
+
}) => {
|
|
68
|
+
const {
|
|
69
|
+
stationId,
|
|
70
|
+
arrivalDelay,
|
|
71
|
+
departureDelay,
|
|
72
|
+
arrivalTime,
|
|
73
|
+
departureTime,
|
|
74
|
+
state,
|
|
75
|
+
stationName
|
|
76
|
+
} = stop;
|
|
77
|
+
const cancelled = state === "JOURNEY_CANCELLED" || state === "STOP_CANCELLED";
|
|
78
|
+
const { stations } = lineInfos;
|
|
79
|
+
const isFirstStation = idx === 0;
|
|
80
|
+
const isLastStation = idx === stations.length - 1;
|
|
81
|
+
const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);
|
|
82
|
+
const isNotStation = isNotStop(stop);
|
|
83
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
84
|
+
key: (stationId || stationName) + arrivalTime + departureTime,
|
|
85
|
+
role: "button",
|
|
86
|
+
className: [
|
|
87
|
+
"rt-route-station",
|
|
88
|
+
isStationPassed ? " rt-passed" : "",
|
|
89
|
+
isNotStation ? " rt-no-stop" : ""
|
|
90
|
+
].join(""),
|
|
91
|
+
onClick: (e) => {
|
|
92
|
+
return onStationClick(stop, e);
|
|
93
|
+
},
|
|
94
|
+
tabIndex: 0,
|
|
95
|
+
onKeyPress: (e) => {
|
|
96
|
+
return e.which === 13 && onStationClick(stop, e);
|
|
97
|
+
}
|
|
98
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
99
|
+
className: "rt-route-delay"
|
|
100
|
+
}, typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
|
|
101
|
+
className: `rt-route-delay-arrival${` ${getDelayColor(
|
|
102
|
+
arrivalDelay
|
|
103
|
+
)}`}`
|
|
104
|
+
}, `+${getDelayString(arrivalDelay)}`), typeof departureDelay === "undefined" || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
|
|
105
|
+
className: `rt-route-delay-departure${` ${getDelayColor(
|
|
106
|
+
departureDelay
|
|
107
|
+
)}`}`
|
|
108
|
+
}, `+${getDelayString(departureDelay)}`)), /* @__PURE__ */ React.createElement("div", {
|
|
109
|
+
className: "rt-route-times"
|
|
110
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
111
|
+
className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`
|
|
112
|
+
}, getHoursAndMinutes(arrivalTime)), /* @__PURE__ */ React.createElement("span", {
|
|
113
|
+
className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`
|
|
114
|
+
}, getHoursAndMinutes(departureTime))), renderStationImg(stations, idx, isStationPassed, isNotStation), /* @__PURE__ */ React.createElement("div", {
|
|
115
|
+
className: cancelled ? "rt-route-cancelled" : ""
|
|
116
|
+
}, stationName));
|
|
160
117
|
};
|
|
161
|
-
|
|
162
|
-
var renderRouteIdentifier = function (ref) {
|
|
163
|
-
var routeIdentifier = ref.routeIdentifier;
|
|
164
|
-
var longName = ref.longName;
|
|
165
|
-
|
|
118
|
+
const renderRouteIdentifier = ({ routeIdentifier, longName }) => {
|
|
166
119
|
if (routeIdentifier) {
|
|
167
|
-
|
|
168
|
-
var id = parseInt(routeIdentifier.split('.')[0], 10);
|
|
120
|
+
const id = parseInt(routeIdentifier.split(".")[0], 10);
|
|
169
121
|
if (!longName.includes(id)) {
|
|
170
|
-
return
|
|
122
|
+
return ` (${id})`;
|
|
171
123
|
}
|
|
172
124
|
}
|
|
173
125
|
return null;
|
|
174
126
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
longName,
|
|
202
|
-
renderRouteIdentifier(lineInfos)
|
|
203
|
-
)
|
|
204
|
-
),
|
|
205
|
-
React.createElement( 'div', { className: "rt-route-buttons" },
|
|
206
|
-
renderHeaderButtons(routeIdentifier)
|
|
207
|
-
)
|
|
208
|
-
)
|
|
209
|
-
);
|
|
127
|
+
const defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {
|
|
128
|
+
const {
|
|
129
|
+
type,
|
|
130
|
+
vehicleType,
|
|
131
|
+
shortName,
|
|
132
|
+
longName,
|
|
133
|
+
stroke,
|
|
134
|
+
destination,
|
|
135
|
+
routeIdentifier,
|
|
136
|
+
text_color: textColor
|
|
137
|
+
} = lineInfos;
|
|
138
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
139
|
+
className: "rt-route-header"
|
|
140
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
141
|
+
className: "rt-route-icon",
|
|
142
|
+
style: {
|
|
143
|
+
backgroundColor: stroke || getBgColor(type || vehicleType),
|
|
144
|
+
color: textColor || "black"
|
|
145
|
+
}
|
|
146
|
+
}, shortName), /* @__PURE__ */ React.createElement("div", {
|
|
147
|
+
className: "rt-route-title"
|
|
148
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
149
|
+
className: "rt-route-name"
|
|
150
|
+
}, destination), /* @__PURE__ */ React.createElement("span", null, longName, renderRouteIdentifier(lineInfos))), /* @__PURE__ */ React.createElement("div", {
|
|
151
|
+
className: "rt-route-buttons"
|
|
152
|
+
}, renderHeaderButtons(routeIdentifier)));
|
|
210
153
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
var lineInfos = props.lineInfos;
|
|
214
|
-
var renderCopyright = props.renderCopyright;
|
|
154
|
+
const defaultRenderFooter = (props) => {
|
|
155
|
+
const { lineInfos, renderCopyright } = props;
|
|
215
156
|
if (!lineInfos.operator && !lineInfos.publisher) {
|
|
216
157
|
return null;
|
|
217
158
|
}
|
|
218
|
-
return React.createElement(
|
|
159
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
160
|
+
className: "rt-route-footer"
|
|
161
|
+
}, renderCopyright({ ...props }));
|
|
219
162
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
) : (
|
|
229
|
-
React.createElement( React.Fragment, null, text )
|
|
230
|
-
)
|
|
231
|
-
)
|
|
232
|
-
);
|
|
163
|
+
const defaultRenderLink = (text, url) => {
|
|
164
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
165
|
+
className: "rt-route-copyright-link"
|
|
166
|
+
}, url ? /* @__PURE__ */ React.createElement("a", {
|
|
167
|
+
href: url,
|
|
168
|
+
target: "_blank",
|
|
169
|
+
rel: "noreferrer"
|
|
170
|
+
}, text) : /* @__PURE__ */ React.createElement(React.Fragment, null, text));
|
|
233
171
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return (
|
|
239
|
-
React.createElement( 'span', { className: "rt-route-copyright" },
|
|
240
|
-
lineInfos.operator &&
|
|
241
|
-
defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl),
|
|
242
|
-
lineInfos.operator && lineInfos.publisher && React.createElement( 'span', null, " - " ),
|
|
243
|
-
lineInfos.publisher &&
|
|
244
|
-
defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl),
|
|
245
|
-
lineInfos.license && React.createElement( 'span', null, " (" ),
|
|
246
|
-
lineInfos.license &&
|
|
247
|
-
defaultRenderLink(lineInfos.license, lineInfos.licenseUrl),
|
|
248
|
-
lineInfos.license && ')'
|
|
249
|
-
)
|
|
250
|
-
);
|
|
172
|
+
const defaultRenderCopyright = ({ lineInfos }) => {
|
|
173
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
174
|
+
className: "rt-route-copyright"
|
|
175
|
+
}, lineInfos.operator && defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl), lineInfos.operator && lineInfos.publisher && /* @__PURE__ */ React.createElement("span", null, "\xA0-\xA0"), lineInfos.publisher && defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl), lineInfos.license && /* @__PURE__ */ React.createElement("span", null, "\xA0("), lineInfos.license && defaultRenderLink(lineInfos.license, lineInfos.licenseUrl), lineInfos.license && ")");
|
|
251
176
|
};
|
|
252
|
-
|
|
253
|
-
var propTypes = {
|
|
254
|
-
/**
|
|
255
|
-
* CSS class of the route schedule wrapper.
|
|
256
|
-
*/
|
|
177
|
+
const propTypes = {
|
|
257
178
|
className: PropTypes.string,
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Trajectory stations informations.
|
|
261
|
-
*/
|
|
262
179
|
lineInfos: ReactTransitPropTypes.lineInfos,
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Trackerlayer.
|
|
266
|
-
*/
|
|
267
180
|
trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Render Header of the route scheduler.
|
|
271
|
-
*/
|
|
272
181
|
renderHeader: PropTypes.func,
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Render Footer of the route scheduler.
|
|
276
|
-
*/
|
|
277
182
|
renderFooter: PropTypes.func,
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Render Copyright of the route scheduler.
|
|
281
|
-
*/
|
|
282
183
|
renderCopyright: PropTypes.func,
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Render the status of the station image.
|
|
286
|
-
*/
|
|
287
184
|
renderStationImg: PropTypes.func,
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Render a station.
|
|
291
|
-
*/
|
|
292
185
|
renderStation: PropTypes.func,
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Function triggered on station's click event.
|
|
296
|
-
*/
|
|
297
186
|
onStationClick: PropTypes.func,
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Function to render header buttons.
|
|
301
|
-
*/
|
|
302
|
-
renderHeaderButtons: PropTypes.func,
|
|
187
|
+
renderHeaderButtons: PropTypes.func
|
|
303
188
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
className: 'rt-route-schedule',
|
|
189
|
+
const defaultProps = {
|
|
190
|
+
className: "rt-route-schedule",
|
|
307
191
|
lineInfos: null,
|
|
308
192
|
renderHeader: defaultRenderHeader,
|
|
309
193
|
renderStation: defaultRenderStation,
|
|
310
194
|
renderStationImg: defaultRenderStationImg,
|
|
311
195
|
renderCopyright: defaultRenderCopyright,
|
|
312
196
|
renderFooter: defaultRenderFooter,
|
|
313
|
-
renderHeaderButtons:
|
|
197
|
+
renderHeaderButtons: () => {
|
|
314
198
|
return null;
|
|
315
199
|
},
|
|
316
|
-
onStationClick:
|
|
200
|
+
onStationClick: () => {
|
|
201
|
+
}
|
|
317
202
|
};
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* RouteSchedule displays information, stops and punctuality about the clicked route.
|
|
321
|
-
*/
|
|
322
203
|
function RouteSchedule(props) {
|
|
323
|
-
|
|
324
|
-
var className = props.className;
|
|
325
|
-
var renderStation = props.renderStation;
|
|
326
|
-
var renderHeader = props.renderHeader;
|
|
327
|
-
var renderFooter = props.renderFooter;
|
|
328
|
-
|
|
204
|
+
const { lineInfos, className, renderStation, renderHeader, renderFooter } = props;
|
|
329
205
|
if (!lineInfos) {
|
|
330
206
|
return null;
|
|
331
207
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
})
|
|
340
|
-
),
|
|
341
|
-
renderFooter(Object.assign({}, props))
|
|
342
|
-
)
|
|
343
|
-
);
|
|
208
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
209
|
+
className
|
|
210
|
+
}, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", {
|
|
211
|
+
className: "rt-route-body"
|
|
212
|
+
}, lineInfos.stations.map((stop, idx) => {
|
|
213
|
+
return renderStation({ ...props, stop, idx });
|
|
214
|
+
})), renderFooter({ ...props }));
|
|
344
215
|
}
|
|
345
|
-
|
|
346
216
|
RouteSchedule.propTypes = propTypes;
|
|
347
217
|
RouteSchedule.defaultProps = defaultProps;
|
|
348
|
-
|
|
349
218
|
export default React.memo(RouteSchedule);
|
|
350
|
-
|
|
351
|
-
//# sourceMappingURL=RouteSchedule.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"file":"RouteSchedule.js","sources":["../../../src/components/RouteSchedule/RouteSchedule.js"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { TrackerLayer } from 'mobility-toolbox-js/ol';\nimport { getBgColor } from 'mobility-toolbox-js/common/trackerConfig';\nimport { getHoursAndMinutes, getDelayString } from '../../utils/timeUtils';\nimport ReactTransitPropTypes from '../../propTypes';\nimport firstStation from '../../images/RouteSchedule/firstStation.png';\nimport station from '../../images/RouteSchedule/station.png';\nimport lastStation from '../../images/RouteSchedule/lastStation.png';\nimport line from '../../images/RouteSchedule/line.png';\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return 'dark-red';\n }\n if (secs >= 500) {\n return 'middle-red';\n }\n if (secs >= 300) {\n return 'light-red';\n }\n if (secs >= 180) {\n return 'orange';\n }\n return 'green';\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.departureTime || stop.arrivalTime || 0;\n const delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nconst defaultRenderStation = ({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) => {\n const {\n stationId,\n arrivalDelay,\n departureDelay,\n arrivalTime,\n departureTime,\n state,\n stationName,\n } = stop;\n const cancelled = state === 'JOURNEY_CANCELLED' || state === 'STOP_CANCELLED';\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);\n const isNotStation = isNotStop(stop);\n return (\n <div\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n role=\"button\"\n className={[\n 'rt-route-station',\n isStationPassed ? ' rt-passed' : '',\n isNotStation ? ' rt-no-stop' : '',\n ].join('')}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === 'undefined' || isFirstStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === 'undefined' || isLastStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(arrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(departureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? 'rt-route-cancelled' : ''}>{stationName}</div>\n </div>\n );\n};\n\nconst renderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split('.')[0], 10);\n if (!longName.includes(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || 'black',\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n <>{text}</>\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span> - </span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span> (</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && ')'}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rt-route-schedule',\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],"names":["const","let"],"mappings":"AAAA;AACA;AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,SAAS,YAAY,QAAQ,wBAAwB,CAAC;AACtD,SAAS,UAAU,QAAQ,0CAA0C,CAAC;AACtE,SAAS,kBAAkB,EAAE,cAAc,QAAQ,uBAAuB,CAAC;AAC3E,OAAO,qBAAqB,MAAM,iBAAiB,CAAC;AACpD,OAAO,YAAY,MAAM,6CAA6C,CAAC;AACvE,OAAO,OAAO,MAAM,wCAAwC,CAAC;AAC7D,OAAO,WAAW,MAAM,4CAA4C,CAAC;AACrE,OAAO,IAAI,MAAM,qCAAqC,CAAC;AACvD;AACA;AACA;AACA;AACA;AACAA,GAAK,CAAC,aAAa,YAAG,CAAC,IAAI,EAAK;AAChC,EAAEA,GAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7D,EAAE,IAAI,IAAI,IAAI,IA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C;AACpC,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC;AAC1C;AACA,eAAe,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;"}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/RouteSchedule/RouteSchedule.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n RealtimeLayer as TrackerLayer,\n trackerConfig,\n} from 'mobility-toolbox-js/ol';\nimport { getHoursAndMinutes, getDelayString } from '../../utils/timeUtils';\nimport ReactTransitPropTypes from '../../propTypes';\nimport firstStation from '../../images/RouteSchedule/firstStation.png';\nimport station from '../../images/RouteSchedule/station.png';\nimport lastStation from '../../images/RouteSchedule/lastStation.png';\nimport line from '../../images/RouteSchedule/line.png';\n\nconst { getBgColor } = trackerConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return 'dark-red';\n }\n if (secs >= 500) {\n return 'middle-red';\n }\n if (secs >= 300) {\n return 'light-red';\n }\n if (secs >= 180) {\n return 'orange';\n }\n return 'green';\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.departureTime || stop.arrivalTime || 0;\n const delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nconst defaultRenderStation = ({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) => {\n const {\n stationId,\n arrivalDelay,\n departureDelay,\n arrivalTime,\n departureTime,\n state,\n stationName,\n } = stop;\n const cancelled = state === 'JOURNEY_CANCELLED' || state === 'STOP_CANCELLED';\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);\n const isNotStation = isNotStop(stop);\n return (\n <div\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n role=\"button\"\n className={[\n 'rt-route-station',\n isStationPassed ? ' rt-passed' : '',\n isNotStation ? ' rt-no-stop' : '',\n ].join('')}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === 'undefined' || isFirstStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === 'undefined' || isLastStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(arrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(departureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? 'rt-route-cancelled' : ''}>{stationName}</div>\n </div>\n );\n};\n\nconst renderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split('.')[0], 10);\n if (!longName.includes(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || 'black',\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n <>{text}</>\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span> - </span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span> (</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && ')'}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rt-route-schedule',\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
+
"mappings": "AAEA,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9B,QAAM,OAAO,KAAK,MAAQ,OAAO,OAAO,IAAK,OAAQ,GAAI;AACzD,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,MAAM,YAAY,CAAC,SAAS;AAC1B,SAAO,CAAC,KAAK,eAAe,CAAC,KAAK;AACpC;AASA,MAAM,WAAW,CAAC,MAAM,MAAM,OAAO,QAAQ;AAG3C,MAAI,UAAU,IAAI,GAAG;AACnB,QAAI,MAAM,MAAM,MAAM,MAAM,GAAG;AAC7B,aAAO,SAAS,MAAM,MAAM,IAAI,MAAM,OAAO,GAAG;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,KAAK,iBAAiB,KAAK,eAAe;AAChE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,UAAU;AAAA,EAK3B,kBAAkB,UAAU;AAAA,EAK5B,eAAe,UAAU;AAAA,EAKzB,gBAAgB,UAAU;AAAA,EAK1B,qBAAqB,UAAU;AACjC;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,qBAAqB,MAAM;AACzB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB,MAAM;AAAA,EAAC;AACzB;AAKA,SAAS,cAAc,OAAO;AAC5B,QAAM,EAAE,WAAW,WAAW,eAAe,cAAc,aAAa,IACtE;AAEF,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,oCAAC;AAAA,IAAI;AAAA,KACF,aAAa,EAAE,GAAG,MAAM,CAAC,GAC1B,oCAAC;AAAA,IAAI,WAAU;AAAA,KACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe,MAAM,KAAK,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/RouteSchedule/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default } from './RouteSchedule';\n"],
|
|
5
|
+
"mappings": "AAAA,wBAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|