Add: Multiple disruptions
This commit is contained in:
parent
3c0fc6fe1f
commit
2d2ec96533
@ -3,7 +3,7 @@ import addNotification from "react-push-notification";
|
|||||||
import globData from '../GlobalData.js';
|
import globData from '../GlobalData.js';
|
||||||
|
|
||||||
import ex1 from '../APIexamples/disruption1.json'
|
import ex1 from '../APIexamples/disruption1.json'
|
||||||
import ex2 from '../APIexamples/disruption1.json'
|
import ex2 from '../APIexamples/disruption2.json'
|
||||||
|
|
||||||
import Button from './Button.js';
|
import Button from './Button.js';
|
||||||
import disruptIcon from '../img/flash.svg';
|
import disruptIcon from '../img/flash.svg';
|
||||||
@ -17,12 +17,20 @@ class DisruptionButton extends Button {
|
|||||||
|
|
||||||
genDisrupt = () => {
|
genDisrupt = () => {
|
||||||
this.state.disruption = ""
|
this.state.disruption = ""
|
||||||
for (let stopPoint of ex1.affectedStopPoints) {
|
if(this.state.jsonLocation === "ex1"){
|
||||||
if(stopPoint.gid === globData.user.stoppointgid){
|
for (let stopPoint of ex1.affectedStopPoints) {
|
||||||
this.state.disruption = ex1
|
if(stopPoint.gid === globData.user.stoppointgid){
|
||||||
|
this.state.disruption = ex1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this.state.jsonLocation === "ex2"){
|
||||||
|
for (let stopPoint of ex2.affectedStopPoints) {
|
||||||
|
if(stopPoint.gid === globData.user.stoppointgid){
|
||||||
|
this.state.disruption = ex2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.state.disruption)
|
console.log(this.state.disruption)
|
||||||
globData.disruption = this.state.disruption
|
globData.disruption = this.state.disruption
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ class NavigationDrawer extends Component {
|
|||||||
<SelectUserButton path={"user3"} username="user3"/>
|
<SelectUserButton path={"user3"} username="user3"/>
|
||||||
<SelectUserButton path={"user4"} username="user4"/>
|
<SelectUserButton path={"user4"} username="user4"/>
|
||||||
<DisruptionButton path={"ex1"} onClick={[this.showPopup, this.close]} />
|
<DisruptionButton path={"ex1"} onClick={[this.showPopup, this.close]} />
|
||||||
|
<DisruptionButton path={"ex2"} onClick={[this.showPopup, this.close]} />
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<span id="version">Projektgrupp 3 - Utmaning 7</span>
|
<span id="version">Projektgrupp 3 - Utmaning 7</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user