diff --git a/server/frontend/src/HomePage.js b/server/frontend/src/HomePage.js index 3e24ad8..d526f5e 100644 --- a/server/frontend/src/HomePage.js +++ b/server/frontend/src/HomePage.js @@ -41,12 +41,14 @@ class Home extends Component { return a.source > b.source ? 1 : -1 }); d.data.forEach(element => { + var updated = translateStatus(element.status) sensors.push({ source: element.source, status: element.status, timestamp: element.timestamp, timesince: timeSince(element.timestamp), - icon: "zap-off" + icon: updated.icon, + color: updated.color }) }) component.setState({data: sensors}) @@ -54,7 +56,6 @@ class Home extends Component { } render() { - var state return ( @@ -62,8 +63,7 @@ class Home extends Component { {this.state.data.map(item => ( - state = translateStatus(item.status), // eslint-disable-line no-sequences - + )) } diff --git a/server/frontend/src/Sensor.js b/server/frontend/src/Sensor.js index f6a0890..a186a7e 100644 --- a/server/frontend/src/Sensor.js +++ b/server/frontend/src/Sensor.js @@ -14,9 +14,6 @@ class Sensor extends Component { this.props.socket.on("sensor/status", function(data) { if (data.source === source) { var updated = translateStatus(data.status) - if (data.source === "front-door") { - console.log(updated) - } component.setState({ color: updated.color, source: data.source, @@ -31,7 +28,7 @@ class Sensor extends Component { state = { color: "", source: this.props.source, - icon: "zap-off", + icon: "", timestamp: "", timesince: "" };