From 031829d4f9f66c19c219c9c36861b60bb2ddf8a1 Mon Sep 17 00:00:00 2001 From: williameriksson126 Date: Thu, 10 Dec 2020 11:15:17 +0100 Subject: [PATCH] Add: Traffic info now shows disruption data as well. Format of new time needs to be rewritten --- src/APIexamples/disruption1.json | 1 + src/APIexamples/disruption2.json | 1 + src/components/DisruptionButton.js | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/APIexamples/disruption1.json b/src/APIexamples/disruption1.json index 17e823e..7aaba41 100644 --- a/src/APIexamples/disruption1.json +++ b/src/APIexamples/disruption1.json @@ -2,6 +2,7 @@ "situationNumber": "RT1", "severity":"normal", "title":"Stannar inte på dessa hållplatser", + "time":"01:00", "affectedStopPoints":[ { "gid": "9022014014020001", diff --git a/src/APIexamples/disruption2.json b/src/APIexamples/disruption2.json index 9928f49..3b3c207 100644 --- a/src/APIexamples/disruption2.json +++ b/src/APIexamples/disruption2.json @@ -2,6 +2,7 @@ "situationNumber": "RT2", "severity":"normal", "title":"Försening", + "time":"02:00", "affectedStopPoints":[ { "gid": "9021014014225000", diff --git a/src/components/DisruptionButton.js b/src/components/DisruptionButton.js index bbca6e2..34eeec1 100644 --- a/src/components/DisruptionButton.js +++ b/src/components/DisruptionButton.js @@ -20,13 +20,18 @@ class DisruptionButton extends Button { if(this.state.jsonLocation === "ex1"){ for (let stopPoint of ex1.affectedStopPoints) { if(stopPoint.gid === globData.user.stoppointgid){ - this.state.disruption = ex1 + this.state.disruption = ex1; + console.log(globData.stop.departures[0]) + globData.stop.departures[0].newTime = ex1.time + globData.stop.departures[0].trafficInfo = ex1.title; } } } else if (this.state.jsonLocation === "ex2"){ for (let stopPoint of ex2.affectedStopPoints) { if(stopPoint.gid === globData.user.stoppointgid){ this.state.disruption = ex2 + globData.stop.departures[0].newTime = ex2.time + globData.stop.departures[0].trafficInfo = ex2.title; } } }