From 194e502578ef1918dfcfde14518cdd1c0b047f4c Mon Sep 17 00:00:00 2001 From: "Claudio Maggioni (maggicl)" Date: Wed, 6 May 2020 11:13:17 +0200 Subject: [PATCH 1/2] Added label to share cameras button and other minor fixes --- smart-hut/src/components/HeaderController.js | 17 +++++++++++++++-- .../components/dashboard/devices/Curtains.css | 4 ---- .../components/dashboard/devices/Thermostats.js | 5 ++++- smart-hut/src/views/Dashboard.js | 4 ++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/smart-hut/src/components/HeaderController.js b/smart-hut/src/components/HeaderController.js index 6c797ab..f67edfe 100644 --- a/smart-hut/src/components/HeaderController.js +++ b/smart-hut/src/components/HeaderController.js @@ -58,7 +58,7 @@ export class MyHeader extends React.Component { - + @@ -68,7 +68,7 @@ export class MyHeader extends React.Component { - + } checked={this.props.cameraEnabled} toggle onChange={(e, val) => this.setCameraEnabled(val.checked)} /> + @@ -104,6 +108,15 @@ export class MyHeader extends React.Component { + + Share cameras} + checked={this.props.cameraEnabled} + toggle + onChange={(e, val) => this.setCameraEnabled(val.checked)} + /> + diff --git a/smart-hut/src/components/dashboard/devices/Curtains.css b/smart-hut/src/components/dashboard/devices/Curtains.css index 5d1939b..c4ec319 100644 --- a/smart-hut/src/components/dashboard/devices/Curtains.css +++ b/smart-hut/src/components/dashboard/devices/Curtains.css @@ -4,10 +4,6 @@ box-sizing: border-box; } -body { - overflow-y: hidden; -} - .container.curtain-container { position: relative; margin-top: 10%; diff --git a/smart-hut/src/components/dashboard/devices/Thermostats.js b/smart-hut/src/components/dashboard/devices/Thermostats.js index 9ec24ff..fcab8a6 100644 --- a/smart-hut/src/components/dashboard/devices/Thermostats.js +++ b/smart-hut/src/components/dashboard/devices/Thermostats.js @@ -164,7 +164,10 @@ class Thermostats extends Component { const mapStateToProps2 = (state, ownProps) => ({ ...mapStateToProps(state, ownProps), get tempSensorsInRoom() { - const deviceIds = state.rooms[state.devices[ownProps.id].roomId].devices; + if (state.active.activeTab !== "Devices") return false; + const room = state.rooms[state.devices[ownProps.id].roomId]; + if (!room) return false; + const deviceIds = room.devices; const devices = [...deviceIds].map((id) => state.devices[id]); const sensors = devices.filter( (d) => d.kind === "sensor" && d.sensor === "TEMPERATURE" diff --git a/smart-hut/src/views/Dashboard.js b/smart-hut/src/views/Dashboard.js index ab2c952..45cec4a 100644 --- a/smart-hut/src/views/Dashboard.js +++ b/smart-hut/src/views/Dashboard.js @@ -85,12 +85,12 @@ class Dashboard extends Component {
- + - + Date: Wed, 6 May 2020 11:28:27 +0200 Subject: [PATCH 2/2] Fixed style issues on scene share guest button --- smart-hut/src/components/SceneModal.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/smart-hut/src/components/SceneModal.js b/smart-hut/src/components/SceneModal.js index 513c2e6..8b935cc 100644 --- a/smart-hut/src/components/SceneModal.js +++ b/smart-hut/src/components/SceneModal.js @@ -9,6 +9,7 @@ import { Input, Dropdown, Checkbox, + Segment, } from "semantic-ui-react"; import SelectIcons from "./SelectIcons"; import { connect } from "react-redux"; @@ -110,15 +111,15 @@ class SceneModal extends Component { }; closeModal = (e) => { - this.setState({ openModal: false }); + this.setState({ ...this.state, openModal: false }); }; openModal = (e) => { - this.setState({ openModal: true }); + this.setState({ ...this.state, openModal: true }); }; updateIcon(e) { - this.setState({ selectedIcon: e }); + this.setState({ ...this.state, selectedIcon: e }); } setCopyFrom(_, copyFrom) { @@ -127,7 +128,7 @@ class SceneModal extends Component { setGuestAccessEnabled(val) { console.log(this.state, val); - this.setState({ guestAccessEnabled: val }); + this.setState({ ...this.state, guestAccessEnabled: val }); } render() { @@ -223,13 +224,16 @@ class SceneModal extends Component { )} {this.type === "modify" ? ( + this.setGuestAccessEnabled(val.checked) } /> + ) : null}