diff --git a/src/App.js b/src/App.js index f1c39ec..f338a98 100644 --- a/src/App.js +++ b/src/App.js @@ -21,8 +21,6 @@ class App extends Component { return (
- - diff --git a/src/GlobalData.js b/src/GlobalData.js index 3f4e9b9..317501f 100644 --- a/src/GlobalData.js +++ b/src/GlobalData.js @@ -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( ) }; diff --git a/src/classes/User.js b/src/classes/User.js index bd48e47..bce7ce4 100644 --- a/src/classes/User.js +++ b/src/classes/User.js @@ -7,7 +7,7 @@ */ class User { - constructor(name, deviceId, location) { + constructor(name, deviceId, location, stoppointgid) { this.name = name; this.deviceId = deviceId; this.location = location; diff --git a/src/classes/disruption.js b/src/classes/disruption.js index fbaf04a..583db9a 100644 --- a/src/classes/disruption.js +++ b/src/classes/disruption.js @@ -8,4 +8,4 @@ class Disruption { } } -export default User; \ No newline at end of file +export default Disruption; \ No newline at end of file diff --git a/src/components/DisruptionButton.js b/src/components/DisruptionButton.js index c88e5ca..d221792 100644 --- a/src/components/DisruptionButton.js +++ b/src/components/DisruptionButton.js @@ -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", diff --git a/src/components/NavigationDrawer.js b/src/components/NavigationDrawer.js index de49e86..5225cdc 100644 --- a/src/components/NavigationDrawer.js +++ b/src/components/NavigationDrawer.js @@ -63,7 +63,7 @@ class NavigationDrawer extends Component { example@gmail.com
Projektgrupp 3 - Utmaning 7