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/SelectUserButton.js b/src/components/SelectUserButton.js index 1d690e7..4a7e967 100644 --- a/src/components/SelectUserButton.js +++ b/src/components/SelectUserButton.js @@ -16,25 +16,30 @@ 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 { selectUser = () => { 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 + globData.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 }else if (this.props.path === "user3"){ globData.user = user3 - globData.stop = locationuser3.LocationList.StopLocation[0] + 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 = user4 + globData.user = user4 + globData.user.track = locationuser4.LocationList.StopLocation[0].track globData.stop = locationuser4.LocationList.StopLocation[0] globData.stop.departures = departureuser4.DepartureBoard.Departures } 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 ?