diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index cadc1db..003ee6c 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -27,6 +27,7 @@ class App extends Component { super(props); let loggedIn = false; + let token = undefined; try { let userJsonString = localStorage.getItem("token"); @@ -34,6 +35,7 @@ class App extends Component { let date = new Date().getTime(); if (userJsonString && exp && date < exp) { loggedIn = true; + token = userJsonString; } else { localStorage.removeItem("token"); localStorage.removeItem("exp"); @@ -42,6 +44,7 @@ class App extends Component { this.state = { loggedIn: loggedIn, + token: token, }; this.auth = this.auth.bind(this); diff --git a/smart-hut/src/components/dashboard/devices/NewDevice.js b/smart-hut/src/components/dashboard/devices/NewDevice.js index 9026c6f..b460007 100644 --- a/smart-hut/src/components/dashboard/devices/NewDevice.js +++ b/smart-hut/src/components/dashboard/devices/NewDevice.js @@ -144,11 +144,17 @@ export default class NewDevice extends Component { image: { avatar: true, src: "/img/switchOn.svg" }, }, { - key: "dimmer", - text: "Dimmer", + key: "buttonDimmer", + text: "Button Dimmer", value: "buttonDimmer", image: { avatar: true, src: "/img/dimmer.svg" }, }, + { + key: "knobDimmer", + text: "Knob Dimmer", + value: "knobDimmer", + image: { avatar: true, src: "/img/dimmer.svg" }, + }, ]; const sensorOptions = [ { @@ -176,13 +182,27 @@ export default class NewDevice extends Component { image: { avatar: true, src: "/img/sensorOn.svg" }, }, ]; - const availableLights = []; + const availableSwitchDevices = []; + const availableDimmerDevices = []; this.props.devices.forEach((d) => { - availableLights.push({ - key: d.id, - text: d.name, - value: d.id, - }); + if ( + d.kind === "regularLight" || + d.kind === "dimmableLight" || + d.kind === "smartPlug" + ) { + availableSwitchDevices.push({ + key: d.id, + text: d.name, + value: d.id, + }); + } + if (d.kind === "dimmableLight") { + availableDimmerDevices.push({ + key: d.id, + text: d.name, + value: d.id, + }); + } }); const step1 = ( ); - const switchDimmerOptions = ( + const switchOptions = ( + + ); + const dimmerOptions = ( + + + ); @@ -239,9 +272,10 @@ export default class NewDevice extends Component {
{deviceName} {this.state.typeOfDevice === "sensor" ? sensorForm : ""} - {this.state.typeOfDevice === "switch" || - this.state.typeOfDevice === "dimmer" - ? switchDimmerOptions + {this.state.typeOfDevice === "switch" ? switchOptions : ""} + {this.state.typeOfDevice === "buttonDimmer" || + this.state.typeOfDevice === "knobDimmer" + ? dimmerOptions : ""}
); diff --git a/smart-hut/src/components/modalform.js b/smart-hut/src/components/modalform.js index 41951fd..14513a6 100644 --- a/smart-hut/src/components/modalform.js +++ b/smart-hut/src/components/modalform.js @@ -22,7 +22,7 @@ export default class ModalWindow extends Component { this.state = { id: "", selectedIcon: "", - name: this.props.type === "new" ? "" : this.props.idRoom.name, + name: this.props.type === "new" ? "Device" : this.props.idRoom.name, img: this.props.type === "new" ? null : this.props.idRoom.image, openModal: false, }; diff --git a/smart-hut/src/views/ConfirmResetPassword.js b/smart-hut/src/views/ConfirmResetPassword.js index 6e09fc8..0d6123d 100644 --- a/smart-hut/src/views/ConfirmResetPassword.js +++ b/smart-hut/src/views/ConfirmResetPassword.js @@ -20,8 +20,7 @@ class Paragraph extends Component { Congratulations! - Your password has been succesffuly - successfully reset + Your password has been successfully reset ); } diff --git a/smart-hut/src/views/FourOhFour.js b/smart-hut/src/views/FourOhFour.js index 3934d03..14ae7af 100644 --- a/smart-hut/src/views/FourOhFour.js +++ b/smart-hut/src/views/FourOhFour.js @@ -29,99 +29,93 @@ export default class FourOhFour extends Component { render() { return ( - - -
- - - - - - - - - - - - -

404 Page Not Found

-
-
- - - - - -

- Hey what are you doing here? Looks like you are - lost, this room does not exist. Maybe you were - looking for the kitchen, or the garage, or the - bedroom, or your love room... so don't wait here and - let's go back to our main room! ...or refresh this - page some times... -

- -
-
-
-
-
-
-
-
+
+ + + + + + + + + + + + + +

404 Page Not Found

+
+
+ + + + + +

+ Hey what are you doing here? Looks like you are lost, + this room does not exist. Maybe you were looking for + the kitchen, or the garage, or the bedroom, or your + love room... so don't wait here and let's go back to + our main room! ...or refresh this page some times... +

+ +
+
+
+
+
+
+
- -
- - - - - - - - - - - - -

404 Page Not Found

-
-
- - - - - - - -

- Hey what are you doing here? Looks like you are - lost, this room does not exist. Maybe you were - looking for the kitchen, or the garage, or the - bedroom, or your love room... so don't wait here and - let's go back to our main room! ...or refresh this - page some times... -

- -
-
-
-
-
-
-
-
+ + + + + + + + + + + + + +

404 Page Not Found

+
+
+ + + + + + + +

+ Hey what are you doing here? Looks like you are lost, + this room does not exist. Maybe you were looking for + the kitchen, or the garage, or the bedroom, or your + love room... so don't wait here and let's go back to + our main room! ...or refresh this page some times... +

+ +
+
+
+
+
+
+
- +
); } } diff --git a/smart-hut/src/views/Navbar.js b/smart-hut/src/views/Navbar.js index ee521cb..b115139 100644 --- a/smart-hut/src/views/Navbar.js +++ b/smart-hut/src/views/Navbar.js @@ -49,150 +49,145 @@ class Navbar extends Component { render() { //const { activeItem } = this.state return ( -
- - - - - + + + + - Edit - - - - - - - - - - - HOME - - - + + + + + + HOME + + + - {this.props.rooms - ? this.props.rooms.map((e, i) => { - return ( - - - - - - - {e.name} - - {this.state.editMode ? ( - - ) : null} - - - - - ); - }) - : null} + {this.props.rooms + ? this.props.rooms.map((e, i) => { + return ( + + + + + + + {e.name} + + {this.state.editMode ? ( + + ) : null} + + + + + ); + }) + : null} - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - Home - - - + + + + + + + + + + + Home + + + - {this.props.rooms - ? this.props.rooms.map((e, i) => { - return ( - - - - - - - {e.name} - - - - ); - }) - : null} - - - - - + {this.props.rooms + ? this.props.rooms.map((e, i) => { + return ( + + + + + + + {e.name} + + + + ); + }) + : null} + + + + + + + + + {this.state.activeItem !== -1 ? ( - + - {this.state.activeItem !== -1 ? ( - - - - ) : null} - - - - + ) : null} + + +
); }