react-spatial 1.11.6 → 1.12.0
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.
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
RealtimeLayer as TrackerLayer,
|
|
5
5
|
realtimeConfig
|
|
6
6
|
} from "mobility-toolbox-js/ol";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getHoursAndMinutes,
|
|
9
|
+
getDelayString as defaultGetDelayString
|
|
10
|
+
} from "../../utils/timeUtils";
|
|
8
11
|
import ReactTransitPropTypes from "../../propTypes";
|
|
9
12
|
import firstStation from "../../images/RouteSchedule/firstStation.png";
|
|
10
13
|
import station from "../../images/RouteSchedule/station.png";
|
|
@@ -68,6 +71,7 @@ function RouteStop({
|
|
|
68
71
|
trackerLayer,
|
|
69
72
|
renderStationImg = defaultRenderStationImg,
|
|
70
73
|
renderStationName = defaultRenderStationName,
|
|
74
|
+
getDelayString = defaultGetDelayString,
|
|
71
75
|
stop,
|
|
72
76
|
idx
|
|
73
77
|
}) {
|
|
@@ -259,7 +263,11 @@ const propTypes = {
|
|
|
259
263
|
/**
|
|
260
264
|
* Function to render header buttons.
|
|
261
265
|
*/
|
|
262
|
-
renderHeaderButtons: PropTypes.func
|
|
266
|
+
renderHeaderButtons: PropTypes.func,
|
|
267
|
+
/**
|
|
268
|
+
* Function to get the delay string for stations.
|
|
269
|
+
*/
|
|
270
|
+
getDelayString: PropTypes.func
|
|
263
271
|
};
|
|
264
272
|
function RouteSchedule({
|
|
265
273
|
className = "rt-route-schedule",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\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 } = realtimeConfig;\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.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\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\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n lineInfos,\n onStationClick = emptyFunc,\n trackerLayer,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n stop,\n idx,\n}) {\n const {\n arrivalDelay,\n departureDelay,\n state,\n aimedArrivalTime,\n aimedDepartureTime,\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 isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\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 {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n 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(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n {renderStationName(stations, idx, cancelled)}\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { stationId, arrivalTime, departureTime, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\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 // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ 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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\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 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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\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 route identifier in the header\n */\n renderRouteIdentifier: 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 * Render a station name.\n */\n renderStationName: 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\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderStation = defaultRenderStation,\n renderHeader = defaultRenderHeader,\n renderFooter = defaultRenderFooter,\n ...props\n}) {\n const { lineInfos } = 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;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
-
"mappings": "AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from \"mobility-toolbox-js/ol\";\nimport {\n getHoursAndMinutes,\n getDelayString as defaultGetDelayString,\n} 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 } = realtimeConfig;\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.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\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\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n lineInfos,\n onStationClick = emptyFunc,\n trackerLayer,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n getDelayString = defaultGetDelayString,\n stop,\n idx,\n}) {\n const {\n arrivalDelay,\n departureDelay,\n state,\n aimedArrivalTime,\n aimedDepartureTime,\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 isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\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 {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n 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(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n {renderStationName(stations, idx, cancelled)}\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { stationId, arrivalTime, departureTime, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\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 // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ 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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\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 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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\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 route identifier in the header\n */\n renderRouteIdentifier: 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 * Render a station name.\n */\n renderStationName: 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 /**\n * Function to get the delay string for stations.\n */\n getDelayString: PropTypes.func,\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderStation = defaultRenderStation,\n renderHeader = defaultRenderHeader,\n renderFooter = defaultRenderFooter,\n ...props\n}) {\n const { lineInfos } = 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;\n\nexport default React.memo(RouteSchedule);\n"],
|
|
5
|
+
"mappings": "AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA,kBAAkB;AAAA,OACb;AACP,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9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