Present correct information about track in traffic info
This commit is contained in:
		| @@ -4,14 +4,16 @@ | |||||||
|     name     : String           (Användarnamn) |     name     : String           (Användarnamn) | ||||||
|     deviceId : Int              (Enhetens ID) |     deviceId : Int              (Enhetens ID) | ||||||
|     location : Coordinates      (Användarens koordinater) |     location : Coordinates      (Användarens koordinater) | ||||||
|  |     track    : String      (Nuvarande hållplatsläge) | ||||||
| */ | */ | ||||||
|  |  | ||||||
| class User { | class User { | ||||||
|     constructor(name, deviceId, location, stoppointgid) { |     constructor(name, deviceId, location, stoppointgid, track) { | ||||||
|         this.name = name; |         this.name = name; | ||||||
|         this.deviceId = deviceId; |         this.deviceId = deviceId; | ||||||
|         this.location = location; |         this.location = location; | ||||||
|         this.stoppointgid = stoppointgid; |         this.stoppointgid = stoppointgid; | ||||||
|  |         this.track = track; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,25 +16,30 @@ import departureuser3 from '../APIexamples/departureuser3.json' | |||||||
| import departureuser4 from '../APIexamples/departureuser4.json' | import departureuser4 from '../APIexamples/departureuser4.json' | ||||||
|  |  | ||||||
| import Button from './Button.js'; | import Button from './Button.js'; | ||||||
| import disruptIcon from '../img/flash.svg'; | import userIcon from '../img/userDark.svg'; | ||||||
| import globalData from '../GlobalData.js'; | import globalData from '../GlobalData.js'; | ||||||
|  |  | ||||||
|  |  | ||||||
| class SelectUserButton extends Button { | class SelectUserButton extends Button { | ||||||
| 	selectUser = () => { | 	selectUser = () => { | ||||||
|         if(this.props.path === "user1"){ |         if(this.props.path === "user1"){ | ||||||
| 			globData.user = user1 | 			globData.user = user1 | ||||||
|  | 			globData.user.track = locationuser1.LocationList.StopLocation[0].track | ||||||
| 			globData.stop = locationuser1.LocationList.StopLocation[0] | 			globData.stop = locationuser1.LocationList.StopLocation[0] | ||||||
| 			globData.stop.departures = departureuser1.DepartureBoard.Departures |             globData.stop.departures = departureuser1.DepartureBoard.Departures | ||||||
|         }else if (this.props.path === "user2"){ |         }else if (this.props.path === "user2"){ | ||||||
| 			globData.user = user2 | 			globData.user = user2 | ||||||
|  |             globData.user.track = locationuser2.LocationList.StopLocation[0].track | ||||||
| 			globData.stop = locationuser2.LocationList.StopLocation[0] | 			globData.stop = locationuser2.LocationList.StopLocation[0] | ||||||
| 			globData.stop.departures = departureuser2.DepartureBoard.Departures | 			globData.stop.departures = departureuser2.DepartureBoard.Departures | ||||||
|         }else if (this.props.path === "user3"){ |         }else if (this.props.path === "user3"){ | ||||||
| 			globData.user = 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 | 			globData.stop.departures = departureuser3.DepartureBoard.Departures | ||||||
|         }else if (this.props.path === "user4"){ |         }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 = locationuser4.LocationList.StopLocation[0] | ||||||
| 			globData.stop.departures = departureuser4.DepartureBoard.Departures | 			globData.stop.departures = departureuser4.DepartureBoard.Departures | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -1,12 +1,38 @@ | |||||||
| import React, { Component } from 'react'; | import React, { Component } from 'react'; | ||||||
|  |  | ||||||
|  | import Button from './Button.js'; | ||||||
|  | import Popup from './Popup.js'; | ||||||
|  |  | ||||||
| import './css/StopTitle.css'; | 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 ( |         return ( | ||||||
|             <div id="stopTitle"> |             <div id="stopTitle"> | ||||||
|  |                 <Popup ref={this.popupElem} className=""> | ||||||
|  |                     <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> | ||||||
|  |                         </> | ||||||
|  |                     </ul> | ||||||
|  |                 </Popup> | ||||||
|  |  | ||||||
|                 <h1>{this.props.stop.name !== undefined ? |                 <h1>{this.props.stop.name !== undefined ? | ||||||
|                     this.props.stop.name |                     this.props.stop.name | ||||||
|                     : "Hållplats saknas" |                     : "Hållplats saknas" | ||||||
| @@ -15,9 +41,9 @@ class StopTitle extends Component { | |||||||
|                 {this.props.stop.name !== undefined && this.props.stop.track !== undefined ? |                 {this.props.stop.name !== undefined && this.props.stop.track !== undefined ? | ||||||
|                     <div> |                     <div> | ||||||
|                         <h3> |                         <h3> | ||||||
|                             <span>{this.props.stop.track}</span> |                             <span>{"Läge " + this.props.stop.track}</span> | ||||||
|                         </h3> |                         </h3> | ||||||
|                         <button>Byt Läge</button> |                         <Button onclick={this.showPopup}>Byt Läge</Button> | ||||||
|                     </div> |                     </div> | ||||||
|                     : |                     : | ||||||
|                     (this.props.stop.name !== undefined ? |                     (this.props.stop.name !== undefined ? | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 André Wahlberg
					André Wahlberg