Add: Progress

This commit is contained in:
williameriksson126 2020-12-10 10:43:43 +01:00
parent 211257ac67
commit df3e181e2e
4 changed files with 34 additions and 14 deletions

View File

@ -2,6 +2,7 @@ import User from './classes/User.js';
import Disruption from './classes/Disruption.js' import Disruption from './classes/Disruption.js'
import Coordinates from './classes/Coordinates.js'; import Coordinates from './classes/Coordinates.js';
import Stop from './classes/Stop.js' import Stop from './classes/Stop.js'
import Departure from './classes/Departure.js';
let globalData = { let globalData = {
user: new User( user: new User(

View File

@ -9,15 +9,15 @@
*/ */
class Departure { class Departure {
constructor(lineName, finalStop, originalTime, trafficInfo) { constructor(lineName, finalStop, originalTime) {
this.lineName = lineName; this.sname = lineName;
this.finalStop = finalStop; this.direction = finalStop;
this.originalTime = originalTime; this.time = originalTime;
this.trafficInfo = trafficInfo;
} }
timeUpdate(time) { timeUpdate(time, trafficInfo) {
this.newTime = time; this.newTime = time;
this.trafficInfo = trafficInfo;
} }
} }

View File

@ -6,20 +6,39 @@ import user2 from '../APIexamples/user2.json'
import user3 from '../APIexamples/user3.json' import user3 from '../APIexamples/user3.json'
import user4 from '../APIexamples/user4.json' import user4 from '../APIexamples/user4.json'
import locationuser1 from '../APIexamples/locationuser1.json'
import locationuser2 from '../APIexamples/locationuser2.json'
import locationuser3 from '../APIexamples/locationuser3.json'
import locationuser4 from '../APIexamples/locationuser4.json'
import departureuser1 from '../APIexamples/departureuser1.json'
import departureuser2 from '../APIexamples/departureuser2.json'
import departureuser3 from '../APIexamples/departureuser3.json'
import departureuser4 from '../APIexamples/departureuser4.json'
import Button from './Button.js'; import Button from './Button.js';
import disruptIcon from '../img/flash.svg'; import disruptIcon from '../img/flash.svg';
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.stop = locationuser1.LocationList.StopLocation[0]
globData.stop.departures = [departureuser1.DepartureBoard.Departure]
}else if (this.props.path === "user2"){ }else if (this.props.path === "user2"){
globData.user = user2 globData.user = user2
globData.stop = locationuser2.LocationList.StopLocation[0]
globData.stop.departures = [departureuser2.DepartureBoard.Departure]
}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.stop.departures = [departureuser3.DepartureBoard.Departure]
}else if (this.props.path === "user4"){ }else if (this.props.path === "user4"){
globData.user = user4 globData.user = user4
} globData.stop = locationuser4.LocationList.StopLocation[0]
globData.stop.departures = [departureuser4.DepartureBoard.Departure]
}
console.log(globData.stop)
} }
render() { render() {

View File

@ -39,7 +39,7 @@ class TrafficEntry extends Component {
<div> <div>
<div className="timeColumn"> <div className="timeColumn">
{!lineInterference && {!lineInterference &&
<span>{this.props.departure.originalTime}</span> <span>{this.props.departure.time}</span>
} }
{lineInterference && {lineInterference &&
<> <>
@ -53,9 +53,9 @@ class TrafficEntry extends Component {
</div> </div>
<div className="lineColumn"> <div className="lineColumn">
<div> <div>
<span className="lineName">{this.props.departure.lineName}</span> <span className="lineName">{this.props.departure.sname}</span>
<img src={busIcon} alt=""></img> <img src={busIcon} alt=""></img>
<span className="destination">{"Mot " + this.props.departure.finalStop}</span> <span className="destination">{"Mot " + this.props.departure.direction}</span>
</div> </div>
{lineInterference && {lineInterference &&
<div className="infoWrapper" onClick={this.toggle}> <div className="infoWrapper" onClick={this.toggle}>