From be292c8aa3db89178f065fec405b729e3868379d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Wahlberg?= Date: Thu, 10 Dec 2020 13:52:58 +0100 Subject: [PATCH] Change of track and fix minor design flaws --- src/components/DisruptionButton.js | 40 ++++++++++++++---------------- src/components/FindStops.js | 10 ++++---- src/components/MenuButton.js | 4 +-- src/components/NavigationDrawer.js | 6 ++--- src/components/SelectUserButton.js | 39 ++++++++++++++--------------- src/components/StopTitle.js | 21 +++++++++++++--- src/components/css/Popup.css | 18 +++++++++++--- src/components/css/StopTitle.css | 5 ++-- src/components/css/TopMenu.css | 4 +-- src/components/css/TrafficInfo.css | 2 +- 10 files changed, 85 insertions(+), 64 deletions(-) diff --git a/src/components/DisruptionButton.js b/src/components/DisruptionButton.js index 08f0dc3..af5ddcf 100644 --- a/src/components/DisruptionButton.js +++ b/src/components/DisruptionButton.js @@ -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 ( ); } diff --git a/src/components/FindStops.js b/src/components/FindStops.js index 46a7d0d..9c8cfd1 100644 --- a/src/components/FindStops.js +++ b/src/components/FindStops.js @@ -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 } } diff --git a/src/components/MenuButton.js b/src/components/MenuButton.js index 0ab96d0..090dbd5 100644 --- a/src/components/MenuButton.js +++ b/src/components/MenuButton.js @@ -5,14 +5,14 @@ class MenuButton extends Button { render() { if (this.props.childOrderReverse) { return ( - ); } else { return ( - diff --git a/src/components/NavigationDrawer.js b/src/components/NavigationDrawer.js index 48a40d7..c4bd993 100644 --- a/src/components/NavigationDrawer.js +++ b/src/components/NavigationDrawer.js @@ -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 ( <> -

Välj hållplats:

+

Välj scenario: