small fixes and clean up

This commit is contained in:
Jacob Salvi 2020-04-25 13:53:55 +02:00
parent 272b0dc330
commit 71bd9cecd5
4 changed files with 0 additions and 158 deletions

View File

@ -64,21 +64,7 @@ class Curtain extends Component {
}
};
helper2 = () => {
if (this.props.device.intensity <= 10) {
this.setIntensity(0);
this.saveIntensity();
} else {
this.setIntensity(this.props.device.intensity / 100 - 0.1);
this.saveIntensity();
}
};
helper3 = (a) => {
//console.log(a);
this.setIntensity(a / 100);
this.saveIntensity();
};
///*this took me way too much more time than it should have*/
handleChange = (a) => {
@ -107,22 +93,7 @@ class Curtain extends Component {
max="100"
/>
</div>
/*
<div>
<p>{this.props.device.intensity}</p>
<Slider
min={0}
value={this.props.device.intensity}
max={100}
onChange={(e, val) => {
this.helper3(val);
}}
/>
<input type="submit" value="increase" onClick={this.helper} />
<input type="submit" value="decrease" onClick={this.helper2} />
</div>*/
);
}
}

View File

@ -1,41 +0,0 @@
// TODO Remove this!
import React, { Component } from "react";
import "./Curtains.css";
class Curtain extends Component {
constructor(props) {
super(props);
this.state = {
open: 0.6,
};
}
handleChange = (e) => {
this.setState({ open: e.target.value / 100 });
};
render() {
return (
<div className="container">
<div
className="open-container"
style={{ height: 9 * this.state.open + "rem" }}
></div>{" "}
<span className="span-open">
{Math.round(this.state.open * 100)}%
</span>
<input
onChange={this.handleChange}
value={this.state.open * 100}
className="slider"
type="range"
min="0"
max="100"
/>
</div>
);
}
}
export default Curtain;

View File

@ -1,62 +0,0 @@
// TODO Remove this!
import React, { Component } from "react";
import {
stateTag,
container,
deviceName,
targetTemperature,
slider,
line,
stateTagContainer,
} from "./ThermostatStyle";
class Thermostat extends Component {
constructor(props) {
super(props);
this.state = {
currentTemperature: 10,
targetTemperature: 20,
state: "idle",
};
}
handleChange = (value) => {
let state = this.state.state;
if (this.state.currentTemperature > value) {
state = "cooling";
} else if (this.state.currentTemperature < value) {
state = "heating";
} else {
state = "idle"; // or heating, i don't know the difference
}
this.setState({ targetTemperature: value, state: state });
};
render() {
return (
<div style={container}>
<h3 style={deviceName}>{this.props.device.name}</h3>
<div style={line}></div>
<span style={targetTemperature}>
{this.state.targetTemperature}ºC
</span>
<input
type="range"
min="0"
max="40"
className="slider-css"
value={this.state.targetTemperature}
onChange={(event) => this.handleChange(event.target.value)}
id="targetTemperature"
/>
<div style={stateTagContainer}>
<span style={stateTag}>{this.state.state}</span>
</div>
</div>
);
}
}
export default Thermostat;

View File

@ -135,32 +135,6 @@ class Thermostats extends Component {
render() {
return (
/*<div>
<p>"mode is: "{this.props.device.mode}</p>
<p>
"internalsensortemperature is: "
{this.props.device.internalSensorTemperature}
</p>
<p>
"targetTemperature is: "
{this.props.device.targetTemperature}
</p>
<p>
"measuredtemperature is: "
{this.props.device.measuredTemperature}
</p>
<p>{this.props.device.on}</p>
<input
type="submit"
value="change targetTemperature"
onClick={this.helperMode}
/>
<input
type="submit"
value="robe"
onClick={this.onClickDevice}
/>
</div>*/
<div style={container}>
<h3 style={deviceName}>{this.props.device.name}</h3>