Merge branch 'main' into live

This commit is contained in:
williameriksson126 2020-12-11 10:20:54 +01:00
commit 25977e6600
24 changed files with 416 additions and 371 deletions

View File

@ -1,53 +1,53 @@
{
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "10:09",
"serverdate": "2020-12-10",
"Departures": [
{
"name": "Buss MEXP",
"sname": "MEXP",
"journeyNumber": "24",
"type": "BUS",
"stopid": "9022014014754002",
"stop": "Bollestadsvägen, Kungälv",
"time": "10:09",
"date": "2020-12-10",
"journeyid": "9015014621000024",
"direction": "Marstrand",
"track": "B",
"rtTime": "10:11",
"rtDate": "2020-12-10",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=347217%2F124275%2F19874%2F105802%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14754002%26station_type%3Ddep%26format%3Djson%26"
}
},
{
"name": "Buss 920",
"sname": "920",
"journeyNumber": "2",
"type": "BUS",
"stopid": "9022014014754002",
"stop": "Bollestadsvägen, Kungälv",
"time": "12:26",
"date": "2020-12-10",
"journeyid": "9015014692000002",
"direction": "Bredsten",
"track": "B",
"rtTime": "12:26",
"rtDate": "2020-12-10",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=210630%2F70533%2F834318%2F346949%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14754002%26station_type%3Ddep%26format%3Djson%26"
}
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "09:38",
"serverdate": "2020-12-11",
"Departures": [
{
"name": "Buss MEXP",
"sname": "MEXP",
"journeyNumber": "22",
"type": "BUS",
"stopid": "9022014014751002",
"stop": "Guddeby, Kungälv",
"time": "09:40",
"date": "2020-12-11",
"journeyid": "9015014621000022",
"direction": "Marstrand",
"track": "B",
"rtTime": "09:44",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=715722%2F247121%2F629948%2F76401%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14751002%26station_type%3Ddep%26format%3Djson%26"
}
]
}
},
{
"name": "Buss 927",
"sname": "927",
"journeyNumber": "2",
"type": "BUS",
"stopid": "9022014014751002",
"stop": "Guddeby, Kungälv",
"time": "12:29",
"date": "2020-12-11",
"journeyid": "9015014692700002",
"direction": "Tjuvkil",
"track": "B",
"rtTime": "12:30",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=286581%2F125303%2F109682%2F40686%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14751002%26station_type%3Ddep%26format%3Djson%26"
}
}
]
}
}

View File

@ -1,53 +1,53 @@
{
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "10:10",
"serverdate": "2020-12-10",
"Departures": [
{
"name": "Buss MEXP",
"sname": "MEXP",
"journeyNumber": "24",
"type": "BUS",
"stopid": "9022014014020002",
"stop": "Ekelöv västra, Kungälv",
"time": "10:10",
"date": "2020-12-10",
"journeyid": "9015014621000024",
"direction": "Marstrand",
"track": "B",
"rtTime": "10:13",
"rtDate": "2020-12-10",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=740262%2F255290%2F59460%2F217024%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14020002%26station_type%3Ddep%26format%3Djson%26"
}
},
{
"name": "Buss 920",
"sname": "920",
"journeyNumber": "2",
"type": "BUS",
"stopid": "9022014014754002",
"stop": "Bollestadsvägen, Kungälv",
"time": "12:28",
"date": "2020-12-10",
"journeyid": "9015014692000002",
"direction": "Bredsten",
"track": "B",
"rtTime": "12:26",
"rtDate": "2020-12-10",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=210630%2F70533%2F834318%2F346949%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14754002%26station_type%3Ddep%26format%3Djson%26"
}
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "09:41",
"serverdate": "2020-12-11",
"Departures": [
{
"name": "Buss MEXP",
"sname": "MEXP",
"journeyNumber": "22",
"type": "BUS",
"stopid": "9022014014010002",
"stop": "Hålta kyrka, Kungälv",
"time": "09:47",
"date": "2020-12-11",
"journeyid": "9015014621000022",
"direction": "Marstrand",
"track": "B",
"rtTime": "09:50",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=514476%2F180039%2F54148%2F144419%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14010002%26station_type%3Ddep%26format%3Djson%26"
}
]
}
},
{
"name": "Buss 927",
"sname": "927",
"journeyNumber": "2",
"type": "BUS",
"stopid": "9022014014010002",
"stop": "Hålta kyrka, Kungälv",
"time": "12:38",
"date": "2020-12-11",
"journeyid": "9015014692700002",
"direction": "Tjuvkil",
"track": "B",
"rtTime": "12:38",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=667647%2F252325%2F917844%2F236373%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14010002%26station_type%3Ddep%26format%3Djson%26"
}
}
]
}
}

View File

@ -1,27 +1,53 @@
{
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "10:10",
"serverdate": "2020-12-10",
"Departures": [{
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "09:44",
"serverdate": "2020-12-11",
"Departures": [
{
"name": "Buss MEXP",
"sname": "MEXP",
"journeyNumber": "24",
"journeyNumber": "22",
"type": "BUS",
"stopid": "9022014014751002",
"stop": "Guddeby, Kungälv",
"time": "10:07",
"date": "2020-12-10",
"journeyid": "9015014621000024",
"stopid": "9022014014614002",
"stop": "Stenskärsvägen, Kungälv",
"time": "09:52",
"date": "2020-12-11",
"journeyid": "9015014621000022",
"direction": "Marstrand",
"track": "B",
"rtTime": "09:57",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=473190%2F166266%2F666560%2F175550%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14751002%26station_type%3Ddep%26format%3Djson%26"
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=341064%2F122235%2F154456%2F36461%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14614002%26station_type%3Ddep%26format%3Djson%26"
}
}]
}
},
{
"name": "Buss 320",
"sname": "320",
"journeyNumber": "10",
"type": "BUS",
"stopid": "9022014014614002",
"stop": "Stenskärsvägen, Kungälv",
"time": "10:44",
"date": "2020-12-11",
"journeyid": "9015014632000010",
"direction": "Tjuvkil",
"track": "B",
"rtTime": "10:44",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=931884%2F318653%2F795430%2F87087%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14614002%26station_type%3Ddep%26format%3Djson%26"
}
}
]
}
}

View File

@ -1,30 +1,29 @@
{
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "10:11",
"serverdate": "2020-12-10",
"Departures":
[{
"name": "Buss 928",
"sname": "928",
"journeyNumber": "10",
"type": "BUS",
"stopid": "9022014014225001",
"stop": "Skrämmenborg, Kungälv",
"time": "15:19",
"date": "2020-12-10",
"journeyid": "9015014692800010",
"direction": "Kärna",
"track": "A",
"rtTime": "15:19",
"rtDate": "2020-12-10",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=261732%2F87569%2F149176%2F12656%2F80%3Fdate%3D2020-12-10%26station_evaId%3D14225001%26station_type%3Ddep%26format%3Djson%26"
}
}]
}
"DepartureBoard": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestDepartureBoard.xsd",
"servertime": "09:45",
"serverdate": "2020-12-11",
"Departures": [{
"name": "Buss 928",
"sname": "928",
"journeyNumber": "10",
"type": "BUS",
"stopid": "9022014014225001",
"stop": "Skrämmenborg, Kungälv",
"time": "15:19",
"date": "2020-12-11",
"journeyid": "9015014692800010",
"direction": "Kärna",
"track": "A",
"rtTime": "15:19",
"rtDate": "2020-12-11",
"fgColor": "#006C93",
"bgColor": "#FFFFFF",
"stroke": "Solid",
"accessibility": "wheelChair",
"JourneyDetailRef": {
"ref": "https://api.vasttrafik.se/bin/rest.exe/v2/journeyDetail?ref=110424%2F37130%2F997492%2F461938%2F80%3Fdate%3D2020-12-11%26station_evaId%3D14225001%26station_type%3Ddep%26format%3Djson%26"
}
}]
}
}

View File

@ -2,15 +2,15 @@
"situationNumber": "RT1",
"severity":"normal",
"title":"Nabbensbergsvägen närmast Edsvägen helt avstängd och trafiken hänvisas istället via Korsebergsvägen. Samtidigt tas den tillfälliga förbifarten bort på Edsvägen och trafiken kommer att ledas förbi den nya cirkulationsplatsen i de två västra körfälten tills arbetet på Nabbensbergsvägen är klart Hastighet: 50km/h",
"time":"00:01",
"time":"00:07",
"affectedStopPoints":[
{
"gid": "9022014014020001",
"name": "Ekelöv västra, Kungälv"
"gid": "9022014014010001",
"name": "Hålta kyrka, Kungälv"
},
{
"gid": "9022014014751001",
"name": "Guddeby, Kungälv"
"gid": "9022014014614001",
"name": "Stenskärsvägen, Kungälv"
}
]
}

View File

@ -1,12 +1,12 @@
{
"situationNumber": "RT2",
"severity":"normal",
"title":"Försening",
"time":"00:02",
"title":"På grund av renovation av Nordreälvsbron i Kungälv från 10 november, 2019 till sommaren 2022 är det risk för förseningar på vissa Västtrafik bussar.",
"time":"00:09",
"affectedStopPoints":[
{
"gid": "9021014014225000",
"name": "Skrämmenborg, Kungälv"
"gid": "9022014014762001",
"name": "Kuröd, Kungälv"
}
]
}

View File

@ -1,36 +1,36 @@
{
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "16:48",
"serverdate": "2020-12-09",
"StopLocation": [
{
"name": "Bollestadsvägen, Kungälv",
"id": "9022014014754001",
"lat": "57.888940",
"lon": "11.885663",
"track": "A"
},
{
"name": "Bollestadsvägen, Kungälv",
"id": "9021014014754000",
"lat": "57.889030",
"lon": "11.885708"
},
{
"name": "Bollestadsvägen, Kungälv",
"id": "9022014014754002",
"lat": "57.889111",
"lon": "11.885753",
"track": "B"
},
{
"name": "Bredsten, Kungälv",
"id": "9022014014753002",
"lat": "57.886450",
"lon": "11.889529",
"track": "B"
}
]
}
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "09:34",
"serverdate": "2020-12-11",
"StopLocation": [
{
"name": "Guddeby, Kungälv",
"id": "9022014014751001",
"lat": "57.874665",
"lon": "11.903884",
"track": "A"
},
{
"name": "Guddeby, Kungälv",
"id": "9021014014751000",
"lat": "57.874710",
"lon": "11.903929"
},
{
"name": "Guddeby, Kungälv",
"id": "9022014014751002",
"lat": "57.874746",
"lon": "11.903965",
"track": "B"
},
{
"name": "Stället, Kungälv",
"id": "9022014014744001",
"lat": "57.869784",
"lon": "11.904172",
"track": "A"
}
]
}
}

View File

@ -1,36 +1,36 @@
{
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "16:47",
"serverdate": "2020-12-09",
"StopLocation": [
{
"name": "Ekelöv västra, Kungälv",
"id": "9022014014020001",
"lat": "57.892527",
"lon": "11.865321",
"track": "A"
},
{
"name": "Ekelöv västra, Kungälv",
"id": "9021014014020000",
"lat": "57.892608",
"lon": "11.865312"
},
{
"name": "Ekelöv västra, Kungälv",
"id": "9022014014020002",
"lat": "57.892689",
"lon": "11.865285",
"track": "B"
},
{
"name": "Ekelöv östra, Kungälv",
"id": "9022014014021002",
"lat": "57.892994",
"lon": "11.873923",
"track": "B"
}
]
}
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "09:35",
"serverdate": "2020-12-11",
"StopLocation": [
{
"name": "Hålta kyrka, Kungälv",
"id": "9022014014010001",
"lat": "57.895125",
"lon": "11.827854",
"track": "A"
},
{
"name": "Hålta kyrka, Kungälv",
"id": "9021014014010000",
"lat": "57.895206",
"lon": "11.827647"
},
{
"name": "Hålta kyrka, Kungälv",
"id": "9022014014010002",
"lat": "57.895278",
"lon": "11.827440",
"track": "B"
},
{
"name": "Hålta skola, Kungälv",
"id": "9022014014015001",
"lat": "57.896015",
"lon": "11.824555",
"track": "A"
}
]
}
}

View File

@ -1,36 +1,36 @@
{
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "16:45",
"serverdate": "2020-12-09",
"StopLocation": [
{
"name": "Guddeby, Kungälv",
"id": "9022014014751001",
"lat": "57.874665",
"lon": "11.903884",
"track": "A"
},
{
"name": "Guddeby, Kungälv",
"id": "9021014014751000",
"lat": "57.874710",
"lon": "11.903929"
},
{
"name": "Guddeby, Kungälv",
"id": "9022014014751002",
"lat": "57.874746",
"lon": "11.903965",
"track": "B"
},
{
"name": "Stället, Kungälv",
"id": "9022014014744001",
"lat": "57.869784",
"lon": "11.904172",
"track": "A"
}
]
}
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "09:36",
"serverdate": "2020-12-11",
"StopLocation": [
{
"name": "Stenskärsvägen, Kungälv",
"id": "9022014014614001",
"lat": "57.894594",
"lon": "11.740128",
"track": "A"
},
{
"name": "Stenskärsvägen, Kungälv",
"id": "9022014014614002",
"lat": "57.894729",
"lon": "11.739984",
"track": "B"
},
{
"name": "Stenskärsvägen, Kungälv",
"id": "9021014014614000",
"lat": "57.894738",
"lon": "11.739858"
},
{
"name": "Tjuvkilsboden, Kungälv",
"id": "9022014014615002",
"lat": "57.892743",
"lon": "11.743490",
"track": "B"
}
]
}
}

View File

@ -1,35 +1,35 @@
{
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "16:44",
"serverdate": "2020-12-09",
"StopLocation": [
{
"name": "Skrämmenborg, Kungälv",
"id": "9021014014225000",
"lat": "57.863528",
"lon": "11.867406"
},
{
"name": "Skrämmenborg, Kungälv",
"id": "9022014014225001",
"lat": "57.863528",
"lon": "11.867406",
"track": "A"
},
{
"name": "Kuröd, Kungälv",
"id": "9022014014762002",
"lat": "57.856966",
"lon": "11.863774",
"track": "B"
},
{
"name": "Kuröd, Kungälv",
"id": "9021014014762000",
"lat": "57.856831",
"lon": "11.864260"
}
]
}
"LocationList": {
"noNamespaceSchemaLocation": "http://api.vasttrafik.se/v1/hafasRestLocation.xsd",
"servertime": "09:37",
"serverdate": "2020-12-11",
"StopLocation": [
{
"name": "Kuröd, Kungälv",
"id": "9022014014762001",
"lat": "57.856687",
"lon": "11.864727",
"track": "A"
},
{
"name": "Kuröd, Kungälv",
"id": "9021014014762000",
"lat": "57.856831",
"lon": "11.864260"
},
{
"name": "Kuröd, Kungälv",
"id": "9022014014762002",
"lat": "57.856966",
"lon": "11.863774",
"track": "B"
},
{
"name": "Skrämmenborg, Kungälv",
"id": "9021014014225000",
"lat": "57.863528",
"lon": "11.867406"
}
]
}
}

View File

@ -1,5 +1,5 @@
{
"name": "Användare 1",
"deviceId": "1",
"stoppointgid": "9022014014754001"
"stoppointgid": "9022014014751001"
}

View File

@ -1,5 +1,5 @@
{
"name": "Användare 2",
"deviceId": "2",
"stoppointgid": "9022014014020001"
"stoppointgid": "9022014014010001"
}

View File

@ -1,5 +1,5 @@
{
"name": "Användare 3",
"deviceId": "3",
"stoppointgid": "9022014014751001"
"stoppointgid": "9022014014614001"
}

View File

@ -1,5 +1,5 @@
{
"name": "Användare 4",
"deviceId": "4",
"stoppointgid": "9021014014225000"
"stoppointgid": "9022014014762001"
}

View File

@ -1,4 +1,7 @@
import globData from '../GlobalData.js';
import moment from "moment";
import globalData from '../GlobalData.js';
import Button from './Button.js';
import user1 from '../APIexamples/user1.json'
import user2 from '../APIexamples/user2.json'
@ -18,11 +21,6 @@ import departureuser4 from '../APIexamples/departureuser4.json'
import ex1 from '../APIexamples/disruption1.json'
import ex2 from '../APIexamples/disruption2.json'
import Button from './Button.js';
import disruptIcon from '../img/flash.svg';
import globalData from '../GlobalData.js'
import moment from "moment";
class DisruptionButton extends Button {
state = {
@ -39,12 +37,11 @@ class DisruptionButton extends Button {
}
showMomentTime = (time) => {
//return(time.hours().toString()+ ":"+time.minutes().toString())
return(time.format("HH:mm"))
}
genUsers = () => {
if(globData.users.length < 2){
if(globalData.users.length < 2){
this.state.first = true;
this.state.u1.stop = locationuser1.LocationList.StopLocation[0];
this.state.u1.stop.departures = departureuser1.DepartureBoard.Departures;
@ -54,7 +51,7 @@ class DisruptionButton extends Button {
this.state.u3.stop.departures = departureuser3.DepartureBoard.Departures;
this.state.u4.stop = locationuser4.LocationList.StopLocation[0];
this.state.u4.stop.departures = departureuser4.DepartureBoard.Departures;
globData.users = [
globalData.users = [
this.state.u1,
this.state.u2,
this.state.u3,
@ -69,7 +66,7 @@ class DisruptionButton extends Button {
this.state.disruption = undefined
if(this.state.jsonLocation === "ex1"){
for (let stopPoint of ex1.affectedStopPoints) {
for (let user of globData.users){
for (let user of globalData.users){
if(stopPoint.gid === user.stoppointgid){
this.state.disruption = ex1;
var old1t = moment(user.stop.departures[0].time,"HH:mm");
@ -78,17 +75,17 @@ class DisruptionButton extends Button {
user.stop.departures[0].trafficInfo = ex1.title;
}
}
if(stopPoint.gid === globData.user.stoppointgid){
if(stopPoint.gid === globalData.user.stoppointgid){
this.state.disruption = ex1;
var old2t = moment(globData.stop.departures[0].time,"HH:mm");
var old2t = moment(globalData.stop.departures[0].time,"HH:mm");
old2t.add(ex1.time, "HH:mm");
globData.stop.departures[0].newTime = this.showMomentTime(old2t);
globData.stop.departures[0].trafficInfo = ex1.title;
globalData.stop.departures[0].newTime = this.showMomentTime(old2t);
globalData.stop.departures[0].trafficInfo = ex1.title;
}
}
} else if (this.state.jsonLocation === "ex2"){
for (let stopPoint of ex2.affectedStopPoints) {
for (let user of globData.users){
for (let user of globalData.users){
if(stopPoint.gid === user.stoppointgid){
this.state.disruption = ex2;
var old3t = moment(user.stop.departures[0].time,"HH:mm");
@ -97,24 +94,23 @@ class DisruptionButton extends Button {
user.stop.departures[0].trafficInfo = ex2.title;
}
}
if(stopPoint.gid === globData.user.stoppointgid){
if(stopPoint.gid === globalData.user.stoppointgid){
this.state.disruption = ex2;
var old4t = moment(globData.stop.departures[0].time,"HH:mm");
var old4t = moment(globalData.stop.departures[0].time,"HH:mm");
old4t.add(ex2.time, "HH:mm");
globData.stop.departures[0].newTime = this.showMomentTime(old4t);
globData.stop.departures[0].trafficInfo = ex2.title;
globalData.stop.departures[0].newTime = this.showMomentTime(old4t);
globalData.stop.departures[0].trafficInfo = ex2.title;
}
}
}
globData.disruption = this.state.disruption
globalData.disruption = this.state.disruption
}
render() {
return (
<Button onClick={this.props.onClick.concat([this.genDisrupt,this.updatePage])} className="disruptBtn">
<img src={disruptIcon} alt="" />
<span>Generera Störning</span>
{this.props.children}
</Button>
);
}

View File

@ -1,5 +1,5 @@
import globData from '../GlobalData.js';
import globalData from '../GlobalData.js';
import locationuser1 from '../APIexamples/locationuser1.json'
import locationuser2 from '../APIexamples/locationuser2.json'
@ -15,13 +15,13 @@ class FindStops extends Button {
locations : []
}
findStops = () => {
if(globData.user.deviceId === "1"){
if(globalData.user.deviceId === "1"){
this.state.locations = locationuser1.LocationList.StopLocation
}else if (globData.user.deviceId === "2"){
}else if (globalData.user.deviceId === "2"){
this.state.locations = locationuser2.LocationList.StopLocation
}else if (globData.user.deviceId === "3"){
}else if (globalData.user.deviceId === "3"){
this.state.locations = locationuser3.LocationList.StopLocation
}else if (globData.user.deviceId === "4"){
}else if (globalData.user.deviceId === "4"){
this.state.locations = locationuser4.LocationList.StopLocation
}
}

View File

@ -5,14 +5,14 @@ class MenuButton extends Button {
render() {
if (this.props.childOrderReverse) {
return (
<Button>
<Button className="menuButton">
<span>{this.props.label}</span>
<img src={this.props.icon} alt="" />
</Button>
);
} else {
return (
<Button>
<Button className="menuButton">
<img src={this.props.icon} alt="" />
<span>{this.props.label}</span>
</Button>

View File

@ -9,6 +9,7 @@ import Button from './Button.js';
import './css/NavigationDrawer.css';
import userIcon from '../img/user.svg';
import disruptIcon from '../img/flash.svg';
class NavigationDrawer extends Component {
@ -53,11 +54,10 @@ class NavigationDrawer extends Component {
}
render() {
return (
<>
<Popup ref={this.popupElem}>
<h3>Välj hållplats:</h3>
<h3>Välj scenario:</h3>
<ul>
<li><DisruptionButton path={"ex1"} onClick={[this.hidePopup]}>Störningsscenario 1</DisruptionButton></li>
<li><DisruptionButton path={"ex2"} onClick={[this.hidePopup]}>Störningsscenario 2</DisruptionButton></li>
@ -75,7 +75,7 @@ class NavigationDrawer extends Component {
<SelectUserButton path={"user2"} username="Användare 2"/>
<SelectUserButton path={"user3"} username="Användare 3"/>
<SelectUserButton path={"user4"} username="Användare 4"/>
<Button onClick={[this.showPopup, this.close]}><span>Generera Störning</span></Button>
<Button onClick={[this.showPopup, this.close]} className="disruptBtn"><img src={disruptIcon} alt="" />Generera Störning</Button>
</div>
<hr />
<span id="version">Projektgrupp 3 - Utmaning 7</span>

View File

@ -1,4 +1,4 @@
import globData from '../GlobalData.js';
import globalData from '../GlobalData.js';
import user1 from '../APIexamples/user1.json'
import user2 from '../APIexamples/user2.json'
@ -17,20 +17,19 @@ import departureuser4 from '../APIexamples/departureuser4.json'
import Button from './Button.js';
import userIcon from '../img/userDark.svg';
import globalData from '../GlobalData.js';
class SelectUserButton extends Button {
state = {
first : false,
u1 : user1,
u2 : user2,
u3 : user3,
u4 : user4,
first: false,
u1: user1,
u2: user2,
u3: user3,
u4: user4,
}
genUsers = () => {
if(globData.users.length < 2){
if (globalData.users.length < 2) {
this.state.first = true;
this.state.u1.stop = locationuser1.LocationList.StopLocation[0];
this.state.u1.stop.departures = departureuser1.DepartureBoard.Departures;
@ -40,7 +39,7 @@ class SelectUserButton extends Button {
this.state.u3.stop.departures = departureuser3.DepartureBoard.Departures;
this.state.u4.stop = locationuser4.LocationList.StopLocation[0];
this.state.u4.stop.departures = departureuser4.DepartureBoard.Departures;
globData.users = [
globalData.users = [
this.state.u1,
this.state.u2,
this.state.u3,
@ -51,33 +50,32 @@ class SelectUserButton extends Button {
selectUser = () => {
this.genUsers()
if(this.props.path === "user1"){
globData.user = user1
globData.user.track = locationuser1.LocationList.StopLocation[0].track
globData.stop = locationuser1.LocationList.StopLocation[0]
globData.stop.departures = departureuser1.DepartureBoard.Departures
globalData.user = user1
globalData.user.track = locationuser1.LocationList.StopLocation[0].track
globalData.stop = locationuser1.LocationList.StopLocation[0]
globalData.stop.departures = departureuser1.DepartureBoard.Departures
}else if (this.props.path === "user2"){
globData.user = user2
globData.user.track = locationuser2.LocationList.StopLocation[0].track
globData.stop = locationuser2.LocationList.StopLocation[0]
globData.stop.departures = departureuser2.DepartureBoard.Departures
globalData.user = user2
globalData.user.track = locationuser2.LocationList.StopLocation[0].track
globalData.stop = locationuser2.LocationList.StopLocation[0]
globalData.stop.departures = departureuser2.DepartureBoard.Departures
}else if (this.props.path === "user3"){
globData.user = user3
globData.user.track = locationuser3.LocationList.StopLocation[0].track
globData.stop = locationuser3.LocationList.StopLocation[0]
globData.stop.departures = departureuser3.DepartureBoard.Departures
globalData.user = user3
globalData.user.track = locationuser3.LocationList.StopLocation[0].track
globalData.stop = locationuser3.LocationList.StopLocation[0]
globalData.stop.departures = departureuser3.DepartureBoard.Departures
}else if (this.props.path === "user4"){
globData.user = user4
globData.user.track = locationuser4.LocationList.StopLocation[0].track
globData.stop = locationuser4.LocationList.StopLocation[0]
globData.stop.departures = departureuser4.DepartureBoard.Departures
globalData.user = user4
globalData.user.track = locationuser4.LocationList.StopLocation[0].track
globalData.stop = locationuser4.LocationList.StopLocation[0]
globalData.stop.departures = departureuser4.DepartureBoard.Departures
}
}
updatePage = () => {
globalData.currentPage.forceUpdate();
}
updatePage = () => {
globalData.currentPage.forceUpdate();
}
render() {
return (

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react';
import Button from './Button.js';
import Popup from './Popup.js';
import globalData from '../GlobalData.js';
import './css/StopTitle.css';
@ -20,6 +21,18 @@ class StopTitle extends Component {
this.popupElem.current.hide();
};
setTrackA = () => {
globalData.user.track = "A";
};
setTrackB = () => {
globalData.user.track = "B";
};
updatePage = () => {
globalData.currentPage.forceUpdate();
}
render() {
return (
<div id="stopTitle">
@ -27,8 +40,8 @@ class StopTitle extends Component {
<h3>Välj läge:</h3>
<ul>
<>
<li><Button onClick={[this.hidePopup]}>{"Läge A"}</Button></li>
<li><Button onClick={[this.hidePopup]}>{"Läge B"}</Button></li>
<li><Button onClick={[this.setTrackA, this.updatePage, this.hidePopup]}>{"Läge A"}</Button></li>
<li><Button onClick={[this.setTrackB, this.updatePage, this.hidePopup]}>{"Läge B"}</Button></li>
</>
</ul>
</Popup>
@ -41,9 +54,9 @@ class StopTitle extends Component {
{this.props.stop.name !== undefined && this.props.stop.track !== undefined ?
<div>
<h3>
<span>{"Läge " + this.props.stop.track}</span>
<span>{"Läge " + globalData.user.track}</span>
</h3>
<Button onclick={this.showPopup}>Byt Läge</Button>
<Button className="changeTrackBtn" onClick={[this.showPopup]}>Byt Läge</Button>
</div>
:
(this.props.stop.name !== undefined ?

View File

@ -5,6 +5,8 @@
transform: translate(-50%, -50%) scale(0);
transform-origin: center;
background: white;
display: flex !important;
flex-direction: column !important;
width: 55vw;
height: 39vh;
padding: 3vh 5vw;
@ -21,16 +23,26 @@
.popup h3 {
margin-bottom: 20px;
display: block;
font-size: 1.17em;
font-weight: bold !important;
text-align: center;
color: black !important;
}
.popup ul {
list-style: none;
width: 100%;
}
.popup li button {
width: 100%;
padding: 8% 0;
font-size: 16px;
width: 100% !important;
height: 50px;
padding: 8% 0 !important;
font-size: 16px !important;
display: flex;
align-items: center;
justify-content: center;
}
.popupClose {

View File

@ -38,9 +38,10 @@
#stopTitle div {
display: flex;
flex-direction: row;
align-items: center;
}
#stopTitle button {
.changeTrackBtn {
width: auto;
height: 100%;
box-shadow: none;
@ -52,6 +53,6 @@
border-radius: calc(var(--topMenuHeight) / 15);
}
#stopTitle button:active {
.changeTrackBtn:active {
background: rgba(0, 0, 0, 0.3);
}

View File

@ -6,7 +6,7 @@
justify-content: space-evenly;
}
#topMenu button {
#topMenu .menuButton {
width: var(--topMenuHeight);
height: calc(var(--topMenuHeight) / 1.3);
display: flex;
@ -17,7 +17,7 @@
box-shadow: var(--boxShadow);
}
#topMenu button:active {
#topMenu .menuButton:active {
background: rgb(235, 235, 235);
}

View File

@ -89,7 +89,7 @@
flex-grow: 1;
display: block;
white-space: nowrap;
max-height: 3.5vw;
max-height: 4.5vw;
}
.infoWrapper span {