Compare commits
5 Commits
we-Disrupt
...
we-demo-di
Author | SHA1 | Date | |
---|---|---|---|
ea2a18f3ad | |||
75b4ecc4ed | |||
3080359dcd | |||
3d7e6cf52f | |||
34f4b8af18 |
15
src/APIexamples/disruption1.json
Normal file
15
src/APIexamples/disruption1.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"situationNumber": "RT1",
|
||||||
|
"severity":"normal",
|
||||||
|
"title":"Stannar inte på dessa hållplatser",
|
||||||
|
"affectedStopPoints":[
|
||||||
|
{
|
||||||
|
"gid": "9022014014020001",
|
||||||
|
"name": "Ekelöv västra, Kungälv"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gid": "9022014014751001",
|
||||||
|
"name": "Guddeby, Kungälv"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
src/APIexamples/disruption2.json
Normal file
11
src/APIexamples/disruption2.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"situationNumber": "RT2",
|
||||||
|
"severity":"normal",
|
||||||
|
"title":"Försening",
|
||||||
|
"affectedStopPoints":[
|
||||||
|
{
|
||||||
|
"gid": "9021014014225000",
|
||||||
|
"name": "Skrämmenborg, Kungälv"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
5
src/APIexamples/user1.json
Normal file
5
src/APIexamples/user1.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name":"1",
|
||||||
|
"deviceId":"1",
|
||||||
|
"location":"9022014014754001"
|
||||||
|
}
|
5
src/APIexamples/user2.json
Normal file
5
src/APIexamples/user2.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name":"2",
|
||||||
|
"deviceId":"2",
|
||||||
|
"location":"9022014014020001"
|
||||||
|
}
|
5
src/APIexamples/user3.json
Normal file
5
src/APIexamples/user3.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name":"3",
|
||||||
|
"deviceId":"3",
|
||||||
|
"location":"9022014014751001"
|
||||||
|
}
|
5
src/APIexamples/user4.json
Normal file
5
src/APIexamples/user4.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name":"4",
|
||||||
|
"deviceId":"4",
|
||||||
|
"location":"9021014014225000"
|
||||||
|
}
|
@ -21,8 +21,6 @@ class App extends Component {
|
|||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<NearbyStation/>
|
|
||||||
<Disruption/>
|
|
||||||
<Route path="/" exact component={TicketsBuy} />
|
<Route path="/" exact component={TicketsBuy} />
|
||||||
<Route path="/tickets" exact component={Tickets} />
|
<Route path="/tickets" exact component={Tickets} />
|
||||||
<Route path="/ticketsBuy" exact component={TicketsBuy} />
|
<Route path="/ticketsBuy" exact component={TicketsBuy} />
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import User from './classes/User.js';
|
import User from './classes/User.js';
|
||||||
|
import Disruption from './classes/Disruption.js'
|
||||||
import Coordinates from "./classes/Coordinates.js";
|
import Coordinates from "./classes/Coordinates.js";
|
||||||
|
|
||||||
let globalData = {
|
let globalData = {
|
||||||
user: new User(
|
user: new User(
|
||||||
"test",
|
"test",
|
||||||
"123",
|
"123",
|
||||||
new Coordinates()
|
new Coordinates(),
|
||||||
|
"9022014014020001"
|
||||||
|
),
|
||||||
|
disruption: new Disruption(
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
constructor(name, deviceId, location) {
|
constructor(name, deviceId, location, stoppointgid) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
|
11
src/classes/disruption.js
Normal file
11
src/classes/disruption.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
class Disruption {
|
||||||
|
constructor(situationNumber, severity, title, affectedStopPoints) {
|
||||||
|
this.situationNumber = situationNumber;
|
||||||
|
this.severity = severity;
|
||||||
|
this.title = title;
|
||||||
|
this.affectedStopPoints = affectedStopPoints;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Disruption;
|
@ -1,11 +1,33 @@
|
|||||||
import addNotification from "react-push-notification";
|
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 Button from './Button.js';
|
||||||
import disruptIcon from '../img/flash.svg';
|
import disruptIcon from '../img/flash.svg';
|
||||||
|
|
||||||
|
|
||||||
class DisruptionButton extends Button {
|
class DisruptionButton extends Button {
|
||||||
|
state = {
|
||||||
|
jsonLocation: this.props.path,
|
||||||
|
user: globData.user,
|
||||||
|
disruption: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
genDisrupt = () => {
|
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({
|
addNotification({
|
||||||
title: "Warning",
|
title: "Warning",
|
||||||
subtitle: "This is a subtitle",
|
subtitle: "This is a subtitle",
|
||||||
|
@ -63,7 +63,7 @@ class NavigationDrawer extends Component {
|
|||||||
<span>example@gmail.com</span>
|
<span>example@gmail.com</span>
|
||||||
</header>
|
</header>
|
||||||
<div id="navList">
|
<div id="navList">
|
||||||
<DisruptionButton onClick={[this.showPopup, this.close]} />
|
<DisruptionButton path={"ex1"} 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>
|
||||||
|
Reference in New Issue
Block a user