52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
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",
|
|
message: "This is a very long message",
|
|
theme: "blue",
|
|
native: true, // when using native, your OS will handle theming.
|
|
});
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Button onClick={this.props.onClick.concat([this.genDisrupt])} className="disruptBtn">
|
|
<img src={disruptIcon} alt="" />
|
|
<span>Generera Störning</span>
|
|
</Button>
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
export default DisruptionButton;
|