1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 02:12:53 +00:00

getting ready to ship

This commit is contained in:
2016-09-18 17:13:21 +00:00
parent 11a91412c1
commit 87d941804a
14 changed files with 66 additions and 27 deletions

View File

@@ -14,18 +14,20 @@ const LineChart = Chart.Line;
export default class SensorInfo extends React.Component {
componentDidMount() {
componentWillMount() {
let location = this.props.params.location;
this.props.sensorActions.fetchUniqueDates(location);
}
componentWillReceiveProps(nextProps) {
componentWillUpdate(nextProps) {
let currentLocation = this.props.params.location,
nextLocation = nextProps.params.location;
currentLocation !== nextLocation ? this.props.sensorActions.fetchUniqueDates(nextLocation) : null;
if (currentLocation !== nextLocation){
this.props.sensorActions.fetchUniqueDates(nextLocation);
}
}
loadYearOptions = (date, index) => {
return (
<option key={index} value={index}>{date.year}</option>
@@ -64,7 +66,6 @@ export default class SensorInfo extends React.Component {
filterData(data) {
let temp = JSON.parse(JSON.stringify(DataTemplate));
console.log(temp);
for (let d of data) {
let label = `${d.month}/${d.day}`;
temp.labels.push(label);

View File

@@ -4,11 +4,12 @@
flex-direction: column;
align-items: center;
min-width: 0;
min-height: 600px;
width: 80%;
.selector-row{
display: flex;
justify-content: center;
margin-bottom: 1em;
margin-bottom: 2em;
select{
margin-left: 5px;
}

View File

@@ -35,7 +35,12 @@ export default class SensorList extends React.Component {
</div>
<div class="item">
<h3>{sensor.location}</h3>
<span class="date">Updated: {date.toLocaleString('en-us', options)}</span>
<span class="date">Updated: {date.toLocaleString('en-us', options)}
{Date.now() - date < 420000
? <span class="connected"> Connected</span>
: <span class="disconnected"> Disconnected</span>
}
</span>
</div>
</div>
);

View File

@@ -25,4 +25,11 @@
}
}
.connected{
color: green;
}
.disconnected{
color: red;
}
}