Merge pull request #6 from thefeli73/we-demo-disruption-first
Add: code to fetch disruption data and see if it is relevant
This commit is contained in:
commit
ca1ca3884d
@ -21,8 +21,6 @@ class App extends Component {
|
||||
return (
|
||||
<Router>
|
||||
<div className="App">
|
||||
<NearbyStation/>
|
||||
<Disruption/>
|
||||
<Route path="/" exact component={TicketsBuy} />
|
||||
<Route path="/tickets" exact component={Tickets} />
|
||||
<Route path="/ticketsBuy" exact component={TicketsBuy} />
|
||||
|
@ -1,11 +1,15 @@
|
||||
import User from './classes/User.js';
|
||||
import Disruption from './classes/Disruption.js'
|
||||
import Coordinates from "./classes/Coordinates.js";
|
||||
|
||||
let globalData = {
|
||||
user: new User(
|
||||
"test",
|
||||
"123",
|
||||
new Coordinates()
|
||||
new Coordinates(),
|
||||
"9022014014020001"
|
||||
),
|
||||
disruption: new Disruption(
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
class User {
|
||||
constructor(name, deviceId, location) {
|
||||
constructor(name, deviceId, location, stoppointgid) {
|
||||
this.name = name;
|
||||
this.deviceId = deviceId;
|
||||
this.location = location;
|
||||
|
@ -8,4 +8,4 @@ class Disruption {
|
||||
}
|
||||
}
|
||||
|
||||
export default User;
|
||||
export default Disruption;
|
@ -1,11 +1,33 @@
|
||||
import addNotification from "react-push-notification";
|
||||
|
||||
import globData from '../GlobalData.js';
|
||||
|
||||
import ex1 from '../APIexamples/disruption1.json'
|
||||
import ex2 from '../APIexamples/disruption1.json'
|
||||
|
||||
import Button from './Button.js';
|
||||
import disruptIcon from '../img/flash.svg';
|
||||
|
||||
|
||||
class DisruptionButton extends Button {
|
||||
state = {
|
||||
jsonLocation: this.props.path,
|
||||
user: globData.user,
|
||||
disruption: ""
|
||||
}
|
||||
|
||||
|
||||
genDisrupt = () => {
|
||||
console.log(globData.disruption)
|
||||
for (let stopPoint of ex1.affectedStopPoints) {
|
||||
if(stopPoint.gid === this.state.user.stoppointgid){
|
||||
this.state.disruption = ex1
|
||||
}
|
||||
}
|
||||
|
||||
globData.disruption = this.state.disruption
|
||||
|
||||
console.log(globData.disruption)
|
||||
|
||||
addNotification({
|
||||
title: "Warning",
|
||||
subtitle: "This is a subtitle",
|
||||
|
@ -63,7 +63,7 @@ class NavigationDrawer extends Component {
|
||||
<span>example@gmail.com</span>
|
||||
</header>
|
||||
<div id="navList">
|
||||
<DisruptionButton onClick={[this.showPopup, this.close]} />
|
||||
<DisruptionButton path={"ex1"} onClick={[this.showPopup, this.close]} />
|
||||
</div>
|
||||
<hr />
|
||||
<span id="version">Projektgrupp 3 - Utmaning 7</span>
|
||||
|
Loading…
Reference in New Issue
Block a user