diff --git a/src/APIexamples/user1.json b/src/APIexamples/user1.json index 4a13853..6f3b2f2 100644 --- a/src/APIexamples/user1.json +++ b/src/APIexamples/user1.json @@ -1,5 +1,5 @@ { - "name":"1", - "deviceId":"1", - "stoppointgid":"9022014014754001" + "name": "Användare 1", + "deviceId": "1", + "stoppointgid": "9022014014754001" } \ No newline at end of file diff --git a/src/APIexamples/user2.json b/src/APIexamples/user2.json index be15eab..06eef29 100644 --- a/src/APIexamples/user2.json +++ b/src/APIexamples/user2.json @@ -1,5 +1,5 @@ { - "name":"2", - "deviceId":"2", - "stoppointgid":"9022014014020001" + "name": "Användare 2", + "deviceId": "2", + "stoppointgid": "9022014014020001" } \ No newline at end of file diff --git a/src/APIexamples/user3.json b/src/APIexamples/user3.json index a496cc3..6ee5f34 100644 --- a/src/APIexamples/user3.json +++ b/src/APIexamples/user3.json @@ -1,5 +1,5 @@ { - "name":"3", - "deviceId":"3", - "stoppointgid":"9022014014751001" + "name": "Användare 3", + "deviceId": "3", + "stoppointgid": "9022014014751001" } \ No newline at end of file diff --git a/src/APIexamples/user4.json b/src/APIexamples/user4.json index 7bcc5a5..3a81c81 100644 --- a/src/APIexamples/user4.json +++ b/src/APIexamples/user4.json @@ -1,5 +1,5 @@ { - "name":"4", - "deviceId":"4", - "stoppointgid":"9021014014225000" + "name": "Användare 4", + "deviceId": "4", + "stoppointgid": "9021014014225000" } \ No newline at end of file diff --git a/src/GlobalData.js b/src/GlobalData.js index 08c5de3..fa6caba 100644 --- a/src/GlobalData.js +++ b/src/GlobalData.js @@ -2,12 +2,11 @@ import User from './classes/User.js'; import Disruption from './classes/Disruption.js' import Coordinates from './classes/Coordinates.js'; import Stop from './classes/Stop.js' -import Departure from './classes/Departure.js'; let globalData = { users : [], user: new User( - "test", + "Exempelanvändare", "123", new Coordinates(), "123" diff --git a/src/classes/User.js b/src/classes/User.js index bce7ce4..22db7ec 100644 --- a/src/classes/User.js +++ b/src/classes/User.js @@ -4,14 +4,16 @@ name : String (Användarnamn) deviceId : Int (Enhetens ID) location : Coordinates (Användarens koordinater) + track : String (Nuvarande hållplatsläge) */ class User { - constructor(name, deviceId, location, stoppointgid) { + constructor(name, deviceId, location, stoppointgid, track) { this.name = name; this.deviceId = deviceId; this.location = location; this.stoppointgid = stoppointgid; + this.track = track; } } diff --git a/src/components/DisruptionButton.js b/src/components/DisruptionButton.js index 1fd5f6c..08f0dc3 100644 --- a/src/components/DisruptionButton.js +++ b/src/components/DisruptionButton.js @@ -1,5 +1,3 @@ -import addNotification from "react-push-notification"; - import globData from '../GlobalData.js'; import user1 from '../APIexamples/user1.json' @@ -110,14 +108,6 @@ class DisruptionButton extends Button { } globData.disruption = this.state.disruption - - addNotification({ - title: "Warning", - subtitle: "This is a subtitle", - message: "This is a very long message", - theme: "blue", - native: true, // when using native, your OS will handle theming. - }); } render() { diff --git a/src/components/NavigationDrawer.js b/src/components/NavigationDrawer.js index c154a1a..48a40d7 100644 --- a/src/components/NavigationDrawer.js +++ b/src/components/NavigationDrawer.js @@ -9,7 +9,6 @@ import Button from './Button.js'; import './css/NavigationDrawer.css'; import userIcon from '../img/user.svg'; -import { glob } from 'glob'; class NavigationDrawer extends Component { @@ -54,13 +53,14 @@ class NavigationDrawer extends Component { } render() { + return ( <>

Välj hållplats:

diff --git a/src/components/SelectUserButton.js b/src/components/SelectUserButton.js index 9383075..aeb5da8 100644 --- a/src/components/SelectUserButton.js +++ b/src/components/SelectUserButton.js @@ -1,4 +1,3 @@ - import globData from '../GlobalData.js'; import user1 from '../APIexamples/user1.json' @@ -17,9 +16,10 @@ import departureuser3 from '../APIexamples/departureuser3.json' import departureuser4 from '../APIexamples/departureuser4.json' import Button from './Button.js'; -import disruptIcon from '../img/flash.svg'; +import userIcon from '../img/userDark.svg'; import globalData from '../GlobalData.js'; + class SelectUserButton extends Button { state = { first : false, @@ -53,17 +53,25 @@ class SelectUserButton extends Button { this.genUsers() if(this.props.path === "user1"){ - globData.user = globData.users[0] - globData.stop = globData.users[0].stop + globData.user = user1 + globData.user.track = locationuser1.LocationList.StopLocation[0].track + globData.stop = locationuser1.LocationList.StopLocation[0] + globData.stop.departures = departureuser1.DepartureBoard.Departures }else if (this.props.path === "user2"){ - globData.user = globData.users[1] - globData.stop = globData.users[1].stop + globData.user = user2 + globData.user.track = locationuser2.LocationList.StopLocation[0].track + globData.stop = locationuser2.LocationList.StopLocation[0] + globData.stop.departures = departureuser2.DepartureBoard.Departures }else if (this.props.path === "user3"){ - globData.user = globData.users[2] - globData.stop = globData.users[2].stop + globData.user = user3 + globData.user.track = locationuser3.LocationList.StopLocation[0].track + globData.stop = locationuser3.LocationList.StopLocation[0] + globData.stop.departures = departureuser3.DepartureBoard.Departures }else if (this.props.path === "user4"){ - globData.user = globData.users[3] - globData.stop = globData.users[3].stop + globData.user = user4 + globData.user.track = locationuser4.LocationList.StopLocation[0].track + globData.stop = locationuser4.LocationList.StopLocation[0] + globData.stop.departures = departureuser4.DepartureBoard.Departures } } @@ -74,12 +82,11 @@ class SelectUserButton extends Button { render() { return ( ); } } - export default SelectUserButton; diff --git a/src/components/StopTitle.js b/src/components/StopTitle.js index 81656d0..f8719ca 100644 --- a/src/components/StopTitle.js +++ b/src/components/StopTitle.js @@ -1,12 +1,38 @@ import React, { Component } from 'react'; +import Button from './Button.js'; +import Popup from './Popup.js'; + import './css/StopTitle.css'; -class StopTitle extends Component { - render() { +class StopTitle extends Component { + constructor(props) { + super(props); + this.popupElem = React.createRef(); + } + + showPopup = () => { + this.popupElem.current.show(); + }; + + hidePopup = () => { + this.popupElem.current.hide(); + }; + + render() { return (
+ +

Välj läge:

+ +
+

{this.props.stop.name !== undefined ? this.props.stop.name : "Hållplats saknas" @@ -15,9 +41,9 @@ class StopTitle extends Component { {this.props.stop.name !== undefined && this.props.stop.track !== undefined ?

- {this.props.stop.track} + {"Läge " + this.props.stop.track}

- +
: (this.props.stop.name !== undefined ? diff --git a/src/components/css/StopTitle.css b/src/components/css/StopTitle.css index b45c74b..8063d66 100644 --- a/src/components/css/StopTitle.css +++ b/src/components/css/StopTitle.css @@ -24,7 +24,7 @@ color: var(--colorDiscrete); } -@media screen and (min-width: 350px) { +@media screen and (min-width: 400px) { #stopTitle h1 { font-size: 35px; } diff --git a/src/img/userDark.svg b/src/img/userDark.svg new file mode 100644 index 0000000..06172f0 --- /dev/null +++ b/src/img/userDark.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + +