diff --git a/src/APIexamples/Disruption.json b/src/APIexamples/Disruption.json deleted file mode 100644 index e69de29..0000000 diff --git a/src/App.js b/src/App.js index 74bfe0c..f1c39ec 100644 --- a/src/App.js +++ b/src/App.js @@ -21,7 +21,8 @@ class App extends Component { return (
- + + diff --git a/src/classes/Disruption.js b/src/classes/Disruption.js new file mode 100644 index 0000000..139b98c --- /dev/null +++ b/src/classes/Disruption.js @@ -0,0 +1,24 @@ +/* + Denna klass är en modell för störningar. +*/ + +class Disruption { + constructor(startTime, locations, departures) { + this.startTime = startTime; + this.affectedLines = affectedLines; + this.departures = departures; + } +} + +/* +Från västtrafiks api ett element i listan av hållplatser ser ut som följande + "id": "string", + "lon": "string", + "idx": "string", + "weight": "string", + "name": "string", + "track": "string", + "lat": "string" +*/ + +export default Disruption; \ No newline at end of file diff --git a/src/classes/User.js b/src/classes/User.js index 7b8fc05..deb3ce2 100644 --- a/src/classes/User.js +++ b/src/classes/User.js @@ -9,6 +9,7 @@ class User { constructor(deviceId, location) { this.deviceId = deviceId; this.location = location; + this.stoppointgid = stoppointgid; } } diff --git a/src/components/NearbyStation.js b/src/components/NearbyStation.js index efb4132..5ed2a2a 100644 --- a/src/components/NearbyStation.js +++ b/src/components/NearbyStation.js @@ -1,6 +1,8 @@ import React from 'react'; import axios from 'axios'; -import AccessToken from '../classes/AccessToken' +import AccessToken from '../classes/AccessToken'; +import StopComponent from './StopComponent'; +import Stop from '../classes/Stop'; class NearbyStation extends React.Component { state = { @@ -58,18 +60,11 @@ class NearbyStation extends React.Component { {this.state.long} {this.state.stops.map((item) => -
-

- {item.name}, - {item.id}, - {item.lat}, - {item.lon}, - {item.track} -

-
+ )}
) } } + export default NearbyStation diff --git a/src/components/StopComponent.js b/src/components/StopComponent.js new file mode 100644 index 0000000..db5bdb2 --- /dev/null +++ b/src/components/StopComponent.js @@ -0,0 +1,19 @@ +import React, {Component} from 'react'; + +class StopComponent extends Component { + render() { + return ( +
+

+ {this.props.stop.name}, + {this.props.stop.id}, + {this.props.stop.lat}, + {this.props.stop.lon}, + {this.props.stop.track} +

+
+ ); + } +} +// TODO Add css +export default StopComponent