);
diff --git a/src/components/TrafficList.js b/src/components/TrafficList.js
index c91101c..9dd9d52 100644
--- a/src/components/TrafficList.js
+++ b/src/components/TrafficList.js
@@ -7,21 +7,23 @@ import './css/TrafficInfo.css';
class TrafficList extends Component {
render() {
let entries = [];
+
+ if (this.props.departures) {
+ let i = 0; // React requires elems in array to have associated unique key
- let i = 0; // React requires elems in array to have associated unique key
+ this.props.departures.forEach(departure => {
+ entries.push(
+
+ );
+ });
- this.props.departures.forEach(departure => {
- entries.push(
-
- );
- });
+ // Add separator between every element
+ const intersperse = (arr, sep) => arr.reduce((a,v)=>[...a,v,sep],[]).slice(0,-1);
+ entries = intersperse(entries, ());
- // Add separator between every element
- const intersperse = (arr, sep) => arr.reduce((a,v)=>[...a,v,sep],[]).slice(0,-1);
- entries = intersperse(entries, ());
-
- // Add separator after the last element
- entries.push();
+ // Add separator after the last element
+ entries.push();
+ }
return (
diff --git a/src/components/pages/TrafficInfo.js b/src/components/pages/TrafficInfo.js
index 265b2bf..1ef2b96 100644
--- a/src/components/pages/TrafficInfo.js
+++ b/src/components/pages/TrafficInfo.js
@@ -6,38 +6,19 @@ import MainArea from "../MainArea.js";
import StopTitle from "../StopTitle.js";
import TrafficList from "../TrafficList.js";
-import Stop from "../../classes/Stop.js";
-import Departure from "../../classes/Departure.js";
+import globalData from '../../GlobalData.js';
class TrafficInfo extends Component {
render() {
- /* TEST DATA - TO BE REPLACED */
- let testStop = new Stop(
- "Lemmingsgatan",
- ["Läge A", "Läge B", "Läge C"],
- [
- new Departure(
- "519",
- "Heden",
- "11:59",
- "Trafikolycka vid Partille Centrum. Olyckan ska ha inträffat i höjd med brandstationen och det är oklart om någon är skadad. Polis på väg. Två av bilarna behöver bärgas från platsen. Inga uppgifter om personskador."
- ),
- new Departure("58", "Västra Eriksberg", "12:07"),
- ]
- );
-
- testStop.departures[0].timeUpdate("16:50");
- /* TEST DATA - TO BE REPLACED */
-
return (
<>
-
+
-
+
>
);