diff --git a/smart-hut/src/components/dashboard/devices/DeviceSettingsModal.js b/smart-hut/src/components/dashboard/devices/DeviceSettingsModal.js index fcf29a0..037118a 100644 --- a/smart-hut/src/components/dashboard/devices/DeviceSettingsModal.js +++ b/smart-hut/src/components/dashboard/devices/DeviceSettingsModal.js @@ -35,6 +35,7 @@ const SettingsForm = (props) => { onChange={handleInputChange} value={values.name} placeholder="Device name" + // {this.props.device.name} /> @@ -63,9 +64,13 @@ class DeviceSettingsModal extends Component { this.deleteDevice = this.deleteDevice.bind(this); } - openModal() { - this.setState({ open: true }); - } + closeModal = (e) => { + this.setState({ openModal: false }); + }; + + openModal = (e) => { + this.setState({ openModal: true }); + }; updateDevice(values) { if (values.name.length === 0) return; @@ -94,7 +99,7 @@ class DeviceSettingsModal extends Component { render() { const SettingsModal = () => ( - + Settings of {this.props.device.name} { - if (this.props.device.name.length > 15) { - return this.props.device.name.slice(0, 12) + "..."; - } - return this.props.device.name; - }; + // setName = () => { + // if (this.props.device.name.length > 15) { + // return this.props.device.name.slice(0, 12) + "..."; + // } + // return this.props.device.name; + // }; componentDidUpdate(prevProps) { if ( @@ -83,16 +84,19 @@ class Sensor extends Component { this.units = "ÂșC"; this.colors = temperatureSensorColors; this.icon = "temperatureIcon.svg"; + this.name = "Temperature Sensor"; break; case "HUMIDITY": this.units = "%"; this.colors = humiditySensorColors; this.icon = "humidityIcon.svg"; + this.name = "Humidity Sensor"; break; case "LIGHT": this.units = "lm"; this.colors = lightSensorColors; this.icon = "lightSensorIcon.svg"; + this.name = "Light Sensor"; break; default: this.units = ""; @@ -131,7 +135,7 @@ class Sensor extends Component { }} > - {this.props.device.name} + Motion Sensor ); @@ -176,7 +180,7 @@ class Sensor extends Component { dy="0.4em" fontWeight="bold" > - {this.setName()} ({this.props.device.id}) + {this.name}