From c5fefe7ad6e3e953f31613f767437c0b48086058 Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 21:43:09 +0200 Subject: [PATCH 1/9] removed sonarqube confirm duplication --- smart-hut/src/views/ConfirmRegistration.js | 38 +++------------------ smart-hut/src/views/ConfirmResetPassword.js | 35 +++---------------- 2 files changed, 8 insertions(+), 65 deletions(-) diff --git a/smart-hut/src/views/ConfirmRegistration.js b/smart-hut/src/views/ConfirmRegistration.js index 05adedd..1eb3c12 100644 --- a/smart-hut/src/views/ConfirmRegistration.js +++ b/smart-hut/src/views/ConfirmRegistration.js @@ -1,40 +1,10 @@ import React, { Component } from "react"; -import { - Image, - Grid, - Button, - Icon, - Header, - Container, -} from "semantic-ui-react"; +import Confirm from "./Confirm"; +const msg = + "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; export default class ConfirmRegistration extends Component { render() { - return ( - - - - -
- Congratulation! -
- -

- An E-mail has been sent to your address, confirm your - registration by following the enclosed link. If you don't find - the E-mail please check also the spam folder. -

-
-
-
-
- ); + return ; } } diff --git a/smart-hut/src/views/ConfirmResetPassword.js b/smart-hut/src/views/ConfirmResetPassword.js index 75c0bdc..1465149 100644 --- a/smart-hut/src/views/ConfirmResetPassword.js +++ b/smart-hut/src/views/ConfirmResetPassword.js @@ -1,36 +1,9 @@ import React, { Component } from "react"; -import { - Image, - Grid, - Button, - Icon, - Header, - Container, -} from "semantic-ui-react"; +import Confirm from "./Confirm"; +const msg = "Your password has been successfully reset."; -export default class ConfirmResetPassword extends Component { +export default class ConfirmRegistration extends Component { render() { - return ( - - - - -
- Congratulation! -
- -

Your password has been successfully reset.

-
-
-
-
- ); + return ; } } From f6d5ea7853732d0965037643d842655063d50626 Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 21:43:30 +0200 Subject: [PATCH 2/9] file confirm --- smart-hut/src/views/Confirm.js | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 smart-hut/src/views/Confirm.js diff --git a/smart-hut/src/views/Confirm.js b/smart-hut/src/views/Confirm.js new file mode 100644 index 0000000..463e66a --- /dev/null +++ b/smart-hut/src/views/Confirm.js @@ -0,0 +1,36 @@ +import React, { Component } from "react"; +import { + Image, + Grid, + Button, + Icon, + Header, + Container, +} from "semantic-ui-react"; + +export default class Confirm extends Component { + render() { + return ( + + + + +
+ Congratulation! +
+ +

{this.props.msg}

+
+
+
+
+ ); + } +} From 746e00baa7bb0125675cb193087d3a6cb46ee158 Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 21:51:09 +0200 Subject: [PATCH 3/9] wrong class name --- smart-hut/src/views/ConfirmResetPassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smart-hut/src/views/ConfirmResetPassword.js b/smart-hut/src/views/ConfirmResetPassword.js index 1465149..c11ab29 100644 --- a/smart-hut/src/views/ConfirmResetPassword.js +++ b/smart-hut/src/views/ConfirmResetPassword.js @@ -2,7 +2,7 @@ import React, { Component } from "react"; import Confirm from "./Confirm"; const msg = "Your password has been successfully reset."; -export default class ConfirmRegistration extends Component { +export default class ConfirmResetPassword extends Component { render() { return ; } From 9c89a2ea999441bbf8e00ea489aa59fd86493d9c Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 23:28:20 +0200 Subject: [PATCH 4/9] fixed another duplication --- smart-hut/src/components/FilterDevices.js | 82 ------------------- .../dashboard/AutomationCreationModal.js | 2 +- 2 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 smart-hut/src/components/FilterDevices.js diff --git a/smart-hut/src/components/FilterDevices.js b/smart-hut/src/components/FilterDevices.js deleted file mode 100644 index bc241b1..0000000 --- a/smart-hut/src/components/FilterDevices.js +++ /dev/null @@ -1,82 +0,0 @@ -import { Dropdown } from "semantic-ui-react"; -import React, { Component } from "react"; - -export default class FilterDevices extends Component { - render() { - const tagOptions = [ - { - key: "regularLight", - text: "regularLight", - value: "regularLight", - label: { color: "red", empty: true, circular: true }, - }, - { - key: "dimmableLight", - text: "dimmableLight", - value: "dimmableLight", - label: { color: "blue", empty: true, circular: true }, - }, - { - key: "buttonDimmer", - text: "buttonDimmer", - value: "buttonDimmer", - label: { color: "black", empty: true, circular: true }, - }, - { - key: "knobDimmer", - text: "knobDimmer", - value: "knobDimmer", - label: { color: "purple", empty: true, circular: true }, - }, - { - key: "motionSensor", - text: "motionSensor", - value: "motionSensor", - label: { color: "orange", empty: true, circular: true }, - }, - { - key: "sensor", - text: "sensor", - value: "sensor", - label: { empty: true, circular: true }, - }, - { - key: "smartPlug", - text: "smartPlug", - value: "smartPlug", - label: { color: "pink", empty: true, circular: true }, - }, - { - key: "switch", - text: "switch", - value: "switch", - label: { color: "green", empty: true, circular: true }, - }, - ]; - - return ( - - - - - - {tagOptions.map((option) => ( - - ))} - - - - ); - } -} diff --git a/smart-hut/src/components/dashboard/AutomationCreationModal.js b/smart-hut/src/components/dashboard/AutomationCreationModal.js index e0ef5f6..84f3a76 100644 --- a/smart-hut/src/components/dashboard/AutomationCreationModal.js +++ b/smart-hut/src/components/dashboard/AutomationCreationModal.js @@ -431,7 +431,7 @@ class AutomationSaveModal extends Component { automation.id = this.props.id; automation.triggers = []; automation.scenes = []; - + automation.conditions = []; for (let i = 0; i < this.state.order.length; i++) { automation.scenes.push({ priority: i, From bb11babc5b1e1831e01f2c72801b73819ad86652 Mon Sep 17 00:00:00 2001 From: britea Date: Sun, 10 May 2020 23:50:59 +0200 Subject: [PATCH 5/9] fixed other duplications --- smart-hut/src/App.js | 9 +- smart-hut/src/views/ConfirmForgotPassword.js | 38 +------ smart-hut/src/views/Forgot-pass-reset.js | 114 ------------------- smart-hut/src/views/Forgot-password.js | 89 ++++++++++++--- smart-hut/src/views/ForgotPassword.js | 91 --------------- 5 files changed, 81 insertions(+), 260 deletions(-) delete mode 100644 smart-hut/src/views/Forgot-pass-reset.js delete mode 100644 smart-hut/src/views/ForgotPassword.js diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index 602e77f..6598de0 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -6,7 +6,6 @@ import Signup from "./views/Signup"; import Login from "./views/Login"; import FourOhFour from "./views/FourOhFour"; import ForgotPass from "./views/Forgot-password"; -import ChangePass from "./views/Forgot-pass-reset"; import ConfirmForgotPasswrod from "./views/ConfirmForgotPassword"; import ConfirmRegistration from "./views/ConfirmRegistration"; import ConfirmResetPassword from "./views/ConfirmResetPassword"; @@ -49,7 +48,7 @@ class App extends Component { {this.props.loggedIn ? : } - + @@ -60,9 +59,11 @@ class App extends Component { - + + + - + diff --git a/smart-hut/src/views/ConfirmForgotPassword.js b/smart-hut/src/views/ConfirmForgotPassword.js index 1f4d0ec..c025a75 100644 --- a/smart-hut/src/views/ConfirmForgotPassword.js +++ b/smart-hut/src/views/ConfirmForgotPassword.js @@ -1,40 +1,10 @@ import React, { Component } from "react"; -import { - Image, - Grid, - Button, - Icon, - Header, - Container, -} from "semantic-ui-react"; +import Confirm from "./Confirm"; +const msg = + "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; export default class ConfirmForgotPasswrod extends Component { render() { - return ( - - - - -
- Link has been sent! -
- -

- An E-mail has been sent to your address, please follow the - instructions to create a new password. If you don't find the - E-mail please check also the spam folder. -

-
-
-
-
- ); + return ; } } diff --git a/smart-hut/src/views/Forgot-pass-reset.js b/smart-hut/src/views/Forgot-pass-reset.js deleted file mode 100644 index 24ed9e6..0000000 --- a/smart-hut/src/views/Forgot-pass-reset.js +++ /dev/null @@ -1,114 +0,0 @@ -import React, { Component } from "react"; -import { - Button, - Form, - Grid, - Header, - Image, - Icon, - Message, -} from "semantic-ui-react"; -import { Redirect } from "react-router-dom"; -import { Forms } from "../remote"; - -export default class ChangePass extends Component { - constructor(props) { - super(props); - this.state = { - password: "", - error: { - state: false, - message: "", - }, - success: false, - }; - this.handleChangePassword = this.handleChangePassword.bind(this); - } - - onChangeHandler = (event) => { - let nam = event.target.name; - let val = event.target.value; - this.setState({ [nam]: val }); - }; - - handleChangePassword = (e) => { - if (this.state.confirmPassword !== this.state.password) { - this.setState({ - error: { - state: true, - message: "Passwords do not match.", - }, - }); - } - - Forms.submitResetPassword(this.props.query.token, this.state.password) - .then(() => this.setState({ success: true })) - .catch((err) => - this.setState({ - error: { state: true, message: err.messages.join(" - ") }, - }) - ); - }; - - render() { - if (this.state.success) { - return ; - } - return ( - - - - -
- Reset Password -
-
- - - - - -
-
-
- ); - } -} diff --git a/smart-hut/src/views/Forgot-password.js b/smart-hut/src/views/Forgot-password.js index 6ebc2a5..bf3064e 100644 --- a/smart-hut/src/views/Forgot-password.js +++ b/smart-hut/src/views/Forgot-password.js @@ -22,6 +22,8 @@ export default class ForgotPass extends Component { }, success: false, }; + + this.handleChangePassword = this.handleChangePassword.bind(this); } onChangeHandler = (event) => { @@ -40,7 +42,27 @@ export default class ForgotPass extends Component { ); }; + handleChangePassword = (e) => { + if (this.state.confirmPassword !== this.state.password) { + this.setState({ + error: { + state: true, + message: "Passwords do not match.", + }, + }); + } + + Forms.submitResetPassword(this.props.query.token, this.state.password) + .then(() => this.setState({ success: true })) + .catch((err) => + this.setState({ + error: { state: true, message: err.messages.join(" - ") }, + }) + ); + }; + render() { + console.log(this.props); if (this.state.success) { return ; } @@ -74,23 +96,56 @@ export default class ForgotPass extends Component { ))} - - + {this.props.type === "FPassword1" ? ( + + + + + ) : ( + + + + + + )} diff --git a/smart-hut/src/views/ForgotPassword.js b/smart-hut/src/views/ForgotPassword.js deleted file mode 100644 index b6ade3f..0000000 --- a/smart-hut/src/views/ForgotPassword.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { Component } from "react"; -import { render } from "react-dom"; -import HomeNavbar from "./../components/HomeNavbar"; -import { - Container, - Icon, - Image, - Menu, - Sidebar, - Responsive, - Header, - Divider, - Message, - Grid, -} from "semantic-ui-react"; - -class Paragraph extends Component { - state = { visible: true }; - - handleDismiss = () => { - this.setState({ visible: false }); - - setTimeout(() => { - this.setState({ visible: true }); - }, 2000); - }; - - render() { - if (this.state.visible) { - return ( - - ); - } - - return ( -

-
- The message will return in 2s -
-
-

- ); - } -} - -const MessageReg = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default class ForgotPasswrod extends React.Component { - render() { - return ; - } -} From 50ac55db8ba8ef965fbc3a57bc1de45dbd90e3a4 Mon Sep 17 00:00:00 2001 From: Andrea Mocci Date: Mon, 11 May 2020 14:29:14 +0200 Subject: [PATCH 6/9] Issue #115: Add eslint configuration, commands, and pipeline config --- .gitlab-ci.yml | 7 ++--- smart-hut/.eslintrc | 60 ++++++++++++++++++++++++++++++++++++++++++ smart-hut/package.json | 6 ++++- 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 smart-hut/.eslintrc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index daddd39..afa202c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,11 +27,12 @@ testing_testing: sonar-scanner: stage: code_quality - only: - - dev + # only: + # - dev script: - cd smart-hut - - yarn sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.exclusion=cypress -Dsonar.sources=src -Dsonar.javascript.file.suffixes=.js,.jsx -Dsonar.sourceEncoding=UTF-8 -Dsonar.scm.disabled=True + - yarn eslint:report || true + - yarn sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.exclusion=cypress -Dsonar.sources=src -Dsonar.javascript.file.suffixes=.js,.jsx -Dsonar.sourceEncoding=UTF-8 -Dsonar.scm.disabled=True -Dsonar.eslint.reportPaths=eslint-report.json smartHut_deploy: stage: deploy diff --git a/smart-hut/.eslintrc b/smart-hut/.eslintrc new file mode 100644 index 0000000..d1dbd6e --- /dev/null +++ b/smart-hut/.eslintrc @@ -0,0 +1,60 @@ +{ + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true + } + }, + "rules": { + "semi": "error", + "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], + "react/jsx-no-bind": [ + "error", + { + "allowArrowFunctions": true, + "allowBind": false, + "ignoreRefs": true + } + ], + "react/no-did-update-set-state": "error", + "react/no-unknown-property": "error", + "react/no-unused-prop-types": "error", + "react/prop-types": "error", + "react/react-in-jsx-scope": "error", + "cypress/no-assigning-return-values": "error", + "cypress/no-unnecessary-waiting": "error", + "cypress/assertion-before-screenshot": "warn", + "cypress/no-force": "warn", + "no-unused-expressions": 0, + "chai-friendly/no-unused-expressions": 2, + "indent": [0, 4] + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:cypress/recommended", + "airbnb" + ], + "env": { + "node": true, + "browser": true, + "jest": true, + "cypress/globals": true + }, + + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + + "settings": { + "react": { + "version": "detect" + } + }, + + "plugins": ["react", "cypress", "chai-friendly"] +} + diff --git a/smart-hut/package.json b/smart-hut/package.json index 664eb89..f3140c7 100644 --- a/smart-hut/package.json +++ b/smart-hut/package.json @@ -36,6 +36,8 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", + "eslint": "eslint src", + "eslint:report": "eslint src -f json -o eslint-report.json", "eject": "react-scripts eject" }, "eslintConfig": { @@ -55,6 +57,8 @@ }, "devDependencies": { "prettier": "2.0.1", - "sonarqube-scanner": "^2.6.0" + "sonarqube-scanner": "^2.6.0", + "eslint-config-airbnb": "^18.1.0", + "eslint-plugin-chai-friendly": "^0.6.0" } } From 22d0ba078ab65a2045cd6a7b0319d7eae6dbe6fc Mon Sep 17 00:00:00 2001 From: Andrea Mocci Date: Mon, 11 May 2020 14:40:15 +0200 Subject: [PATCH 7/9] Issue #115: Remove cypress config for eslint --- smart-hut/.eslintrc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/smart-hut/.eslintrc b/smart-hut/.eslintrc index d1dbd6e..ed73165 100644 --- a/smart-hut/.eslintrc +++ b/smart-hut/.eslintrc @@ -23,10 +23,6 @@ "react/no-unused-prop-types": "error", "react/prop-types": "error", "react/react-in-jsx-scope": "error", - "cypress/no-assigning-return-values": "error", - "cypress/no-unnecessary-waiting": "error", - "cypress/assertion-before-screenshot": "warn", - "cypress/no-force": "warn", "no-unused-expressions": 0, "chai-friendly/no-unused-expressions": 2, "indent": [0, 4] @@ -34,14 +30,12 @@ "extends": [ "eslint:recommended", "plugin:react/recommended", - "plugin:cypress/recommended", "airbnb" ], "env": { "node": true, "browser": true, - "jest": true, - "cypress/globals": true + "jest": true }, "globals": { @@ -55,6 +49,6 @@ } }, - "plugins": ["react", "cypress", "chai-friendly"] + "plugins": ["react", "chai-friendly"] } From 19efeb22de2972d1242f003c2cc5dc1f1a52cba0 Mon Sep 17 00:00:00 2001 From: Andrea Mocci Date: Mon, 11 May 2020 14:54:34 +0200 Subject: [PATCH 8/9] Issue #115: Run code quality pipeline only on dev --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afa202c..66e0666 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,8 +27,8 @@ testing_testing: sonar-scanner: stage: code_quality - # only: - # - dev + only: + - dev script: - cd smart-hut - yarn eslint:report || true From c67f2e4707da50b1d9cd306998bd2c8c60217b4f Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Tue, 12 May 2020 15:18:33 +0200 Subject: [PATCH 9/9] Beautifier fix --- hooks/pre-commit.sh | 7 +- smart-hut/package-lock.json | 959 ++++++++++++++++++ smart-hut/package.json | 1 + smart-hut/src/App.js | 40 +- smart-hut/src/App.test.js | 20 +- smart-hut/src/components/Banner.js | 34 +- smart-hut/src/components/Footer.js | 2 +- smart-hut/src/components/Header.js | 28 +- smart-hut/src/components/HeaderController.js | 39 +- smart-hut/src/components/HomeNavbar.js | 29 +- smart-hut/src/components/HostModal.js | 36 +- smart-hut/src/components/RoomModal.js | 79 +- smart-hut/src/components/SceneModal.js | 80 +- smart-hut/src/components/SelectIcons.js | 54 +- smart-hut/src/components/VideoTest.js | 4 +- .../dashboard/AutomationCreationModal.js | 240 +++-- .../components/dashboard/AutomationsPanel.js | 88 +- .../src/components/dashboard/DevicePanel.js | 39 +- .../src/components/dashboard/HostsPanel.js | 58 +- .../components/dashboard/NewSceneDevice.js | 61 +- .../src/components/dashboard/ScenesPanel.js | 33 +- .../components/dashboard/devices/Curtain.js | 38 +- .../components/dashboard/devices/Device.js | 58 +- .../dashboard/devices/DeviceSettingsModal.js | 60 +- .../components/dashboard/devices/Dimmer.js | 30 +- .../dashboard/devices/DimmerStyle.js | 86 +- .../src/components/dashboard/devices/Light.js | 64 +- .../dashboard/devices/LightStyle.js | 86 +- .../components/dashboard/devices/NewDevice.js | 236 ++--- .../components/dashboard/devices/Sensor.js | 92 +- .../dashboard/devices/SensorStyle.js | 142 +-- .../components/dashboard/devices/SmartPlug.js | 36 +- .../dashboard/devices/SmartPlugStyle.js | 62 +- .../components/dashboard/devices/Switch.js | 32 +- .../dashboard/devices/SwitchStyle.js | 46 +- .../dashboard/devices/ThermostatStyle.js | 86 +- .../dashboard/devices/Thermostats.js | 89 +- .../dashboard/devices/TypesOfDevices.js | 26 +- .../components/dashboard/devices/Videocam.js | 34 +- .../dashboard/devices/VideocamModal.js | 28 +- .../dashboard/devices/styleComponents.js | 148 +-- smart-hut/src/deviceProps.js | 32 +- smart-hut/src/endpoint.js | 10 +- smart-hut/src/index.js | 14 +- smart-hut/src/remote.js | 545 ++++------ smart-hut/src/serviceWorker.js | 40 +- smart-hut/src/setupTests.js | 2 +- smart-hut/src/store.js | 115 +-- smart-hut/src/storeActions.js | 80 +- smart-hut/src/views/Confirm.js | 19 +- smart-hut/src/views/ConfirmForgotPassword.js | 7 +- smart-hut/src/views/ConfirmRegistration.js | 7 +- smart-hut/src/views/ConfirmResetPassword.js | 7 +- smart-hut/src/views/Dashboard.js | 101 +- smart-hut/src/views/DashboardTest.js | 9 +- smart-hut/src/views/Forgot-password.js | 55 +- smart-hut/src/views/FourOhFour.js | 48 +- smart-hut/src/views/Home.js | 52 +- smart-hut/src/views/HostsNavbar.js | 70 +- smart-hut/src/views/Instruction.js | 8 +- smart-hut/src/views/Login.js | 47 +- smart-hut/src/views/Navbar.js | 116 +-- smart-hut/src/views/ScenesNavbar.js | 114 +-- smart-hut/src/views/Signup.js | 45 +- smart-hut/src/views/TestHeaderController.js | 6 +- smart-hut/src/views/Videocam.js | 7 +- 66 files changed, 2905 insertions(+), 2061 deletions(-) diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh index 2b233cc..6b0c5cd 100755 --- a/hooks/pre-commit.sh +++ b/hooks/pre-commit.sh @@ -1,10 +1,11 @@ #!/bin/sh -FILES=$(git diff --cached --name-only --diff-filter=ACMR "*.js" "*.jsx" | sed 's| |\\ |g') -[ -z "$FILES" ] && exit 0 +FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') # Prettify all selected files -echo "$FILES" | xargs ./smart-hut/node_modules/.bin/prettier --write +cd $(git rev-parse --show-toplevel)/smart-hut +npm run eslint-fix +cd .. # Add back the modified/prettified files to staging echo "$FILES" | xargs git add diff --git a/smart-hut/package-lock.json b/smart-hut/package-lock.json index be890f1..5a1ee14 100644 --- a/smart-hut/package-lock.json +++ b/smart-hut/package-lock.json @@ -1392,6 +1392,12 @@ "resolved": "https://registry.npmjs.org/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz", "integrity": "sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==" }, + "@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "dev": true + }, "@stardust-ui/react-component-event-listener": { "version": "0.38.0", "resolved": "https://registry.npmjs.org/@stardust-ui/react-component-event-listener/-/react-component-event-listener-0.38.0.tgz", @@ -2088,6 +2094,15 @@ "type-fest": "^0.8.1" } }, + "ansi-gray": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", + "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, "ansi-html": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", @@ -2106,6 +2121,12 @@ "color-convert": "^1.9.0" } }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -2120,6 +2141,23 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, + "archive-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz", + "integrity": "sha1-+S5yIzBW38aWlHJ0nCZ72wRrHXA=", + "dev": true, + "requires": { + "file-type": "^4.2.0" + }, + "dependencies": { + "file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=", + "dev": true + } + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2726,6 +2764,48 @@ "file-uri-to-path": "1.0.0" } }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "dev": true, + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -2957,6 +3037,34 @@ } } }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -3033,6 +3141,72 @@ "unset-value": "^1.0.0" } }, + "cacheable-request": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", + "dev": true, + "requires": { + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "normalize-url": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "dev": true, + "requires": { + "prepend-http": "^2.0.0", + "query-string": "^5.0.1", + "sort-keys": "^2.0.0" + } + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dev": true, + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + } + } + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -3112,6 +3286,18 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "caw": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", + "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", + "dev": true, + "requires": { + "get-proxy": "^2.0.0", + "isurl": "^1.0.0-alpha5", + "tunnel-agent": "^0.6.0", + "url-to-options": "^1.0.1" + } + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -3310,6 +3496,15 @@ "shallow-clone": "^0.1.2" } }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "clsx": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", @@ -3375,6 +3570,12 @@ "simple-swizzle": "^0.2.2" } }, + "color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3493,6 +3694,16 @@ } } }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "confusing-browser-globals": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", @@ -4010,6 +4221,151 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, + "decompress": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", + "dev": true, + "requires": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + }, + "dependencies": { + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "dev": true, + "requires": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + }, + "dependencies": { + "file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", + "dev": true + } + } + }, + "decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "dev": true, + "requires": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "dependencies": { + "file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "dev": true + } + } + }, + "decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "dev": true, + "requires": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + }, + "dependencies": { + "file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", + "dev": true + } + } + }, + "decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "dev": true, + "requires": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "dependencies": { + "file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", + "dev": true + }, + "get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, "deep-equal": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", @@ -4339,11 +4695,54 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, + "download": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/download/-/download-7.1.0.tgz", + "integrity": "sha512-xqnBTVd/E+GxJVrX5/eUJiLYjCGPwMpdL+jGhGU57BvtcA7wwhtHVbXBeUk51kOpW3S7Jn3BQbN9Q1R1Km2qDQ==", + "dev": true, + "requires": { + "archive-type": "^4.0.0", + "caw": "^2.0.1", + "content-disposition": "^0.5.2", + "decompress": "^4.2.0", + "ext-name": "^5.0.0", + "file-type": "^8.1.0", + "filenamify": "^2.0.0", + "get-stream": "^3.0.0", + "got": "^8.3.1", + "make-dir": "^1.2.0", + "p-event": "^2.1.0", + "pify": "^3.0.0" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + } + } + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -4669,6 +5068,28 @@ } } }, + "eslint-config-airbnb": { + "version": "18.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-18.1.0.tgz", + "integrity": "sha512-kZFuQC/MPnH7KJp6v95xsLBf63G/w7YqdPfQ0MUanxQ7zcKUNG8j+sSY860g3NwCBOa62apw16J6pRN+AOgXzw==", + "dev": true, + "requires": { + "eslint-config-airbnb-base": "^14.1.0", + "object.assign": "^4.1.0", + "object.entries": "^1.1.1" + } + }, + "eslint-config-airbnb-base": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.1.0.tgz", + "integrity": "sha512-+XCcfGyCnbzOnktDVhwsCAx+9DmrzEmuwxyHUJpw+kqBVT744OUBrB09khgFKlK1lshVww6qXGsYPZpavoNjJw==", + "dev": true, + "requires": { + "confusing-browser-globals": "^1.0.9", + "object.assign": "^4.1.0", + "object.entries": "^1.1.1" + } + }, "eslint-config-react-app": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-5.2.0.tgz", @@ -4783,6 +5204,12 @@ } } }, + "eslint-plugin-chai-friendly": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.6.0.tgz", + "integrity": "sha512-Uvvv1gkbRGp/qfN15B0kQyQWg+oFA8buDSqrwmW3egNSk/FpqH2MjQqKOuKwmEL6w4QIQrIjDp+gg6kGGmD3oQ==", + "dev": true + }, "eslint-plugin-flowtype": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.6.0.tgz", @@ -5246,6 +5673,25 @@ } } }, + "ext-list": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", + "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", + "dev": true, + "requires": { + "mime-db": "^1.28.0" + } + }, + "ext-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", + "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", + "dev": true, + "requires": { + "ext-list": "^2.0.0", + "sort-keys-length": "^1.0.0" + } + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -5349,6 +5795,18 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, + "fancy-log": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", + "integrity": "sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==", + "dev": true, + "requires": { + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "parse-node-version": "^1.0.0", + "time-stamp": "^1.0.0" + } + }, "fast-deep-equal": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", @@ -5443,6 +5901,15 @@ } } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "figgy-pudding": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", @@ -5473,12 +5940,35 @@ "schema-utils": "^2.5.0" } }, + "file-type": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz", + "integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==", + "dev": true + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", "optional": true }, + "filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", + "dev": true + }, + "filenamify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", + "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", + "dev": true, + "requires": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.0", + "trim-repeated": "^1.0.0" + } + }, "filesize": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz", @@ -5734,6 +6224,12 @@ } } }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -5828,6 +6324,15 @@ "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==" }, + "get-proxy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", + "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", + "dev": true, + "requires": { + "npm-conf": "^1.1.0" + } + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -5931,11 +6436,50 @@ } } }, + "got": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.7.0", + "cacheable-request": "^2.1.1", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "into-stream": "^3.1.0", + "is-retry-allowed": "^1.1.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "mimic-response": "^1.0.0", + "p-cancelable": "^0.4.0", + "p-timeout": "^2.0.1", + "pify": "^3.0.0", + "safe-buffer": "^5.1.1", + "timed-out": "^4.0.1", + "url-parse-lax": "^3.0.0", + "url-to-options": "^1.0.1" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + } + } + }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -6014,11 +6558,26 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true + }, "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "requires": { + "has-symbol-support-x": "^1.4.1" + } + }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -6250,6 +6809,12 @@ } } }, + "http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "dev": true + }, "http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", @@ -6474,6 +7039,24 @@ "ipaddr.js": "^1.9.0" } }, + "into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", + "dev": true, + "requires": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + }, + "dependencies": { + "p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", + "dev": true + } + } + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -6637,6 +7220,12 @@ "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" }, + "is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -6650,6 +7239,12 @@ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, "is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -6707,6 +7302,12 @@ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==" }, + "is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true + }, "is-root": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-root/-/is-root-2.1.0.tgz", @@ -6841,6 +7442,16 @@ "html-escaper": "^2.0.0" } }, + "isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, "jest": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz", @@ -7906,6 +8517,12 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -8067,6 +8684,15 @@ "resolved": "https://registry.npmjs.org/keyboard-key/-/keyboard-key-1.1.0.tgz", "integrity": "sha512-qkBzPTi3rlAKvX7k0/ub44sqOfXeLc/jcnGGmj5c7BJpU8eDrEVPyhCvNYAaoubbsLm9uGWwQJO1ytQK1a9/dQ==" }, + "keyv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -8240,6 +8866,12 @@ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -8293,6 +8925,12 @@ "tslib": "^1.10.0" } }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, "lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -8533,6 +9171,12 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, "min-indent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.0.tgz", @@ -8969,6 +9613,16 @@ "sort-keys": "^1.0.0" } }, + "npm-conf": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", + "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", + "dev": true, + "requires": { + "config-chain": "^1.1.11", + "pify": "^3.0.0" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -9232,6 +9886,12 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "p-cancelable": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", + "dev": true + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -9245,6 +9905,15 @@ "p-reduce": "^1.0.0" } }, + "p-event": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz", + "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==", + "dev": true, + "requires": { + "p-timeout": "^2.0.1" + } + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -9292,6 +9961,15 @@ "retry": "^0.12.0" } }, + "p-timeout": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", + "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "dev": true, + "requires": { + "p-finally": "^1.0.0" + } + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -9387,6 +10065,12 @@ "json-parse-better-errors": "^1.0.1" } }, + "parse-node-version": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", + "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", + "dev": true + }, "parse5": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", @@ -9474,6 +10158,12 @@ "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -10582,6 +11272,12 @@ "react-is": "^16.8.1" } }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", + "dev": true + }, "proxy-addr": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", @@ -11534,6 +12230,15 @@ } } }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -11737,6 +12442,26 @@ "ajv-keywords": "^3.4.1" } }, + "seek-bzip": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", + "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", + "dev": true, + "requires": { + "commander": "~2.8.1" + }, + "dependencies": { + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + } + } + } + }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -12032,6 +12757,12 @@ } } }, + "slugify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.0.tgz", + "integrity": "sha512-FtLNsMGBSRB/0JOE2A0fxlqjI6fJsgHGS13iTuVT28kViI4JjUiNqp/vyis0ZXYcMnpR3fzGNkv+6vRlI2GwdQ==", + "dev": true + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -12182,6 +12913,78 @@ } } }, + "sonarqube-scanner": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/sonarqube-scanner/-/sonarqube-scanner-2.6.0.tgz", + "integrity": "sha512-H6DKMW2WBjFAZ81ubscwE803aiaTQCBeOIu+STrACRdNtrw6WmRmUvw5JY5eGxs/Q+ysyEvz4hInWn0h+7YAlQ==", + "dev": true, + "requires": { + "download": "^7.1.0", + "extend": "3.0.2", + "fancy-log": "^1.3.3", + "lodash.get": "^4.4.2", + "lodash.uniq": "^4.5.0", + "mkdirp": "^1.0.3", + "progress": "^2.0.3", + "read-pkg": "2.0.0", + "slugify": "^1.4.0" + }, + "dependencies": { + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + } + } + }, "sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -12190,6 +12993,15 @@ "is-plain-obj": "^1.0.0" } }, + "sort-keys-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", + "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=", + "dev": true, + "requires": { + "sort-keys": "^1.0.0" + } + }, "source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -12575,6 +13387,15 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0" } }, + "strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "dev": true, + "requires": { + "is-natural-number": "^4.0.1" + } + }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -12593,6 +13414,15 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==" }, + "strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, "style-loader": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.23.1.tgz", @@ -12734,6 +13564,53 @@ "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==" }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "terser": { "version": "4.6.4", "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.4.tgz", @@ -12909,6 +13786,18 @@ "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" }, + "time-stamp": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", + "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, "timers-browserify": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", @@ -12950,6 +13839,12 @@ "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", + "dev": true + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -13005,6 +13900,15 @@ "punycode": "^2.1.0" } }, + "trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, "ts-pnp": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.5.tgz", @@ -13083,6 +13987,28 @@ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==" }, + "unbzip2-stream": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.2.tgz", + "integrity": "sha512-pZMVAofMrrHX6Ik39hCk470kulCbmZ2SWfQLPmTWqfJV/oUm0gn1CblvHdUu4+54Je6Jq34x8kY6XjTy6dMkOg==", + "dev": true, + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + }, + "dependencies": { + "buffer": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + } + } + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -13253,6 +14179,29 @@ "requires-port": "^1.0.0" } }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + }, + "dependencies": { + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + } + } + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -15321,6 +16270,16 @@ "camelcase": "^5.0.0", "decamelize": "^1.2.0" } + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } } } } diff --git a/smart-hut/package.json b/smart-hut/package.json index f3140c7..b57dade 100644 --- a/smart-hut/package.json +++ b/smart-hut/package.json @@ -37,6 +37,7 @@ "build": "react-scripts build", "test": "react-scripts test", "eslint": "eslint src", + "eslint-fix": "eslint --fix src", "eslint:report": "eslint src -f json -o eslint-report.json", "eject": "react-scripts eject" }, diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js index 6598de0..fa6403d 100644 --- a/smart-hut/src/App.js +++ b/smart-hut/src/App.js @@ -1,27 +1,29 @@ -import React, { Component } from "react"; -import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom"; -import Home from "./views/Home"; -import Dashboard from "./views/Dashboard"; -import Signup from "./views/Signup"; -import Login from "./views/Login"; -import FourOhFour from "./views/FourOhFour"; -import ForgotPass from "./views/Forgot-password"; -import ConfirmForgotPasswrod from "./views/ConfirmForgotPassword"; -import ConfirmRegistration from "./views/ConfirmRegistration"; -import ConfirmResetPassword from "./views/ConfirmResetPassword"; -import Instruction from "./views/Instruction"; -import Videocam from "./views/Videocam"; -import queryString from "query-string"; -import { RemoteService } from "./remote"; -import { connect } from "react-redux"; +import React, { Component } from 'react'; +import { + BrowserRouter, Switch, Route, Redirect, +} from 'react-router-dom'; +import queryString from 'query-string'; +import { connect } from 'react-redux'; +import Home from './views/Home'; +import Dashboard from './views/Dashboard'; +import Signup from './views/Signup'; +import Login from './views/Login'; +import FourOhFour from './views/FourOhFour'; +import ForgotPass from './views/Forgot-password'; +import ConfirmForgotPasswrod from './views/ConfirmForgotPassword'; +import ConfirmRegistration from './views/ConfirmRegistration'; +import ConfirmResetPassword from './views/ConfirmResetPassword'; +import Instruction from './views/Instruction'; +import Videocam from './views/Videocam'; +import { RemoteService } from './remote'; class App extends Component { constructor(props, context) { super(props, context); this.state = { - query: "", - info: "", + query: '', + info: '', }; } @@ -35,7 +37,7 @@ class App extends Component { } render() { - console.log("rendering root", this.props.loggedIn, this.state.query); + console.log('rendering root', this.props.loggedIn, this.state.query); return ( diff --git a/smart-hut/src/App.test.js b/smart-hut/src/App.test.js index 135fe7a..3ff4d37 100644 --- a/smart-hut/src/App.test.js +++ b/smart-hut/src/App.test.js @@ -1,19 +1,19 @@ -import React from "react"; -import { render } from "@testing-library/react"; -import { Router } from "react-router"; -import { createMemoryHistory } from "history"; -import App from "./App"; -import { Provider } from "react-redux"; -import smartHutStore from "./store"; +import React from 'react'; +import { render } from '@testing-library/react'; +import { Router } from 'react-router'; +import { createMemoryHistory } from 'history'; +import { Provider } from 'react-redux'; +import App from './App'; +import smartHutStore from './store'; -test("redirects to homepage", () => { +test('redirects to homepage', () => { const history = createMemoryHistory(); render( - + , ); - expect(history.location.pathname).toBe("/"); + expect(history.location.pathname).toBe('/'); }); diff --git a/smart-hut/src/components/Banner.js b/smart-hut/src/components/Banner.js index 5ff1efd..0cd88bb 100644 --- a/smart-hut/src/components/Banner.js +++ b/smart-hut/src/components/Banner.js @@ -1,34 +1,34 @@ -import React from "react"; -import PropTypes from "prop-types"; -import { makeStyles } from "@material-ui/core/styles"; -import Paper from "@material-ui/core/Paper"; -import Typography from "@material-ui/core/Typography"; -import Grid from "@material-ui/core/Grid"; -import Link from "@material-ui/core/Link"; +import React from 'react'; +import PropTypes from 'prop-types'; +import { makeStyles } from '@material-ui/core/styles'; +import Paper from '@material-ui/core/Paper'; +import Typography from '@material-ui/core/Typography'; +import Grid from '@material-ui/core/Grid'; +import Link from '@material-ui/core/Link'; const useStyles = makeStyles((theme) => ({ mainFeaturedPost: { - position: "relative", + position: 'relative', backgroundColor: theme.palette.grey[800], color: theme.palette.common.white, marginBottom: theme.spacing(4), - backgroundImage: "img/banner.jpg", - backgroundSize: "cover", - backgroundRepeat: "no-repeat", - backgroundPosition: "center", + backgroundImage: 'img/banner.jpg', + backgroundSize: 'cover', + backgroundRepeat: 'no-repeat', + backgroundPosition: 'center', }, overlay: { - position: "absolute", + position: 'absolute', top: 0, bottom: 0, right: 0, left: 0, - backgroundColor: "rgba(0,0,0,.3)", + backgroundColor: 'rgba(0,0,0,.3)', }, mainFeaturedPostContent: { - position: "relative", + position: 'relative', padding: theme.spacing(3), - [theme.breakpoints.up("md")]: { + [theme.breakpoints.up('md')]: { padding: theme.spacing(6), paddingRight: 0, }, @@ -47,7 +47,7 @@ export default function Banner(props) { {/* Increase the priority of the hero background image */} { {post.imageText} diff --git a/smart-hut/src/components/Footer.js b/smart-hut/src/components/Footer.js index acf9ebb..e0a34fc 100644 --- a/smart-hut/src/components/Footer.js +++ b/smart-hut/src/components/Footer.js @@ -1,4 +1,4 @@ -import React from "react"; +import React from 'react'; export default function Footer() { return ( diff --git a/smart-hut/src/components/Header.js b/smart-hut/src/components/Header.js index b9bde06..0b789ed 100644 --- a/smart-hut/src/components/Header.js +++ b/smart-hut/src/components/Header.js @@ -1,12 +1,12 @@ -import React from "react"; -import PropTypes from "prop-types"; -import { makeStyles } from "@material-ui/core/styles"; -import Toolbar from "@material-ui/core/Toolbar"; -import Button from "@material-ui/core/Button"; -import IconButton from "@material-ui/core/IconButton"; -import SearchIcon from "@material-ui/icons/Search"; -import Typography from "@material-ui/core/Typography"; -import Link from "@material-ui/core/Link"; +import React from 'react'; +import PropTypes from 'prop-types'; +import { makeStyles } from '@material-ui/core/styles'; +import Toolbar from '@material-ui/core/Toolbar'; +import Button from '@material-ui/core/Button'; +import IconButton from '@material-ui/core/IconButton'; +import SearchIcon from '@material-ui/icons/Search'; +import Typography from '@material-ui/core/Typography'; +import Link from '@material-ui/core/Link'; const useStyles = makeStyles((theme) => ({ toolbar: { @@ -16,8 +16,8 @@ const useStyles = makeStyles((theme) => ({ flex: 1, }, toolbarSecondary: { - justifyContent: "space-between", - overflowX: "auto", + justifyContent: 'space-between', + overflowX: 'auto', }, toolbarLink: { padding: theme.spacing(1), @@ -30,7 +30,7 @@ export default function Header(props) { const { sections, title } = props; return ( - + <> ))} - @@ -68,7 +68,7 @@ export default function Header(props) { Sign up - + ); } diff --git a/smart-hut/src/components/HeaderController.js b/smart-hut/src/components/HeaderController.js index 47954c9..6b214ba 100644 --- a/smart-hut/src/components/HeaderController.js +++ b/smart-hut/src/components/HeaderController.js @@ -1,4 +1,4 @@ -import React from "react"; +import React from 'react'; import { Grid, Divider, @@ -6,16 +6,17 @@ import { Label, Responsive, Checkbox, -} from "semantic-ui-react"; -import { Segment, Image } from "semantic-ui-react"; -import { RemoteService } from "../remote"; -import { withRouter } from "react-router-dom"; -import { connect } from "react-redux"; + Segment, Image, +} from 'semantic-ui-react'; + +import { withRouter } from 'react-router-dom'; +import { connect } from 'react-redux'; +import { RemoteService } from '../remote'; const IconHomeImage = () => ( this.props.history.push("/")); + this.props.logout().then(() => this.props.history.push('/')); } getInfo() { this.props .fetchUserInfo() - .catch((err) => console.error("MyHeader fetch user info error", err)); + .catch((err) => console.error('MyHeader fetch user info error', err)); } setCameraEnabled(val) { - let enabled = { + const enabled = { cameraEnabled: val, }; this.props .userPermissions(enabled) .then(() => this.getInfo()) - .catch((err) => console.error("Camera enabled", err)); + .catch((err) => console.error('Camera enabled', err)); } render() { @@ -80,9 +81,9 @@ export class MyHeader extends React.Component { ({ username: - state.userInfo && state.userInfo.username ? state.userInfo.username : "", + state.userInfo && state.userInfo.username ? state.userInfo.username : '', cameraEnabled: state.userInfo ? state.userInfo.cameraEnabled : false, }); const LoginContainer = connect( mapStateToProps, - RemoteService + RemoteService, )(withRouter(MyHeader)); export default LoginContainer; diff --git a/smart-hut/src/components/HomeNavbar.js b/smart-hut/src/components/HomeNavbar.js index 401cf72..8aa4cd4 100644 --- a/smart-hut/src/components/HomeNavbar.js +++ b/smart-hut/src/components/HomeNavbar.js @@ -1,5 +1,5 @@ -import _ from "lodash"; -import React, { Component } from "react"; +import _ from 'lodash'; +import React, { Component } from 'react'; import { Container, Icon, @@ -7,7 +7,7 @@ import { Menu, Sidebar, Responsive, -} from "semantic-ui-react"; +} from 'semantic-ui-react'; const NavBarMobile = ({ children, @@ -30,7 +30,7 @@ const NavBarMobile = ({ @@ -67,7 +67,7 @@ const NavBarDesktop = ({ leftItems, rightItems }) => ( ); const NavBarChildren = ({ children }) => ( - {children} + {children} ); class HomeNavabarApp extends Component { @@ -75,10 +75,11 @@ class HomeNavabarApp extends Component { super(props); this.state = { logged: true, - email: "", - password: "", + email: '', + password: '', }; } + state = { visible: false, }; @@ -117,17 +118,23 @@ class HomeNavabarApp extends Component { } } -const leftItems = [{ as: "a", content: "Home", key: "home", href: "/" }]; +const leftItems = [{ + as: 'a', content: 'Home', key: 'home', href: '/', +}]; const rightItems = [ - { as: "a", content: "Login", key: "login", href: "/login" }, - { as: "a", content: "Sign up", key: "register", href: "/signup" }, + { + as: 'a', content: 'Login', key: 'login', href: '/login', +}, + { + as: 'a', content: 'Sign up', key: 'register', href: '/signup', +}, ]; const HomeNavbarApp = () => ( + /> ); export default HomeNavbarApp; diff --git a/smart-hut/src/components/HostModal.js b/smart-hut/src/components/HostModal.js index cd03809..5d890a3 100644 --- a/smart-hut/src/components/HostModal.js +++ b/smart-hut/src/components/HostModal.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Button, Header, @@ -7,10 +7,10 @@ import { Form, Responsive, Dropdown, -} from "semantic-ui-react"; -import { connect } from "react-redux"; -import { RemoteService, Forms } from "../remote"; -import { appActions } from "../storeActions"; +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import { RemoteService, Forms } from '../remote'; +import { appActions } from '../storeActions'; class HostModal extends Component { constructor(props) { @@ -28,8 +28,7 @@ class HostModal extends Component { .catch(console.error); Forms.fetchAllUsers() - .then((users) => - this.setState({ + .then((users) => this.setState({ ...this.state, users: users .filter((u) => u.id !== this.props.currentUserId) @@ -38,8 +37,7 @@ class HostModal extends Component { text: `@${u.username} (${u.name})`, value: u.id, })), - }) - ) + })) .catch(console.error); this.saveGuestSettings = this.saveGuestSettings.bind(this); @@ -70,7 +68,7 @@ class HostModal extends Component { render() { return ( - + <> - + ); } } -const setActiveHost = (activeHost) => { - return (dispatch) => dispatch(appActions.setActiveHost(activeHost)); -}; +const setActiveHost = (activeHost) => (dispatch) => dispatch(appActions.setActiveHost(activeHost)); const mapStateToProps = (state) => ({ guests: state.guests, @@ -129,6 +129,6 @@ const HostModalContainer = connect( mapStateToProps, { ...RemoteService, setActiveHost }, null, - { forwardRef: true } + { forwardRef: true }, )(HostModal); export default HostModalContainer; diff --git a/smart-hut/src/components/RoomModal.js b/smart-hut/src/components/RoomModal.js index d6dae1e..e8e60f0 100644 --- a/smart-hut/src/components/RoomModal.js +++ b/smart-hut/src/components/RoomModal.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Button, Header, @@ -9,13 +9,13 @@ import { Responsive, Image, Confirm, -} from "semantic-ui-react"; -import SelectIcons from "./SelectIcons"; -import { connect } from "react-redux"; -import { RemoteService } from "../remote"; -import { appActions } from "../storeActions"; +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import SelectIcons from './SelectIcons'; +import { RemoteService } from '../remote'; +import { appActions } from '../storeActions'; -const NO_IMAGE = "https://react.semantic-ui.com/images/wireframe/image.png"; +const NO_IMAGE = 'https://react.semantic-ui.com/images/wireframe/image.png'; class RoomModal extends Component { constructor(props) { @@ -31,9 +31,9 @@ class RoomModal extends Component { get initialState() { return { - selectedIcon: this.type === "new" ? "home" : this.props.room.icon, - name: this.type === "new" ? "New Room" : this.props.room.name, - img: this.type === "new" ? null : this.props.room.image, + selectedIcon: this.type === 'new' ? 'home' : this.props.room.icon, + name: this.type === 'new' ? 'New Room' : this.props.room.name, + img: this.type === 'new' ? null : this.props.room.image, openModal: false, sure: false, }; @@ -41,7 +41,7 @@ class RoomModal extends Component { unsetImage = (e) => { e.preventDefault(); - this.setState({ ...this.state, img: "" }); + this.setState({ ...this.state, img: '' }); }; setInitialState() { @@ -49,11 +49,11 @@ class RoomModal extends Component { } get type() { - return !this.props.id ? "new" : "modify"; + return !this.props.id ? 'new' : 'modify'; } addRoomModal = (e) => { - let data = { + const data = { icon: this.state.selectedIcon, name: this.state.name, image: this.state.img, @@ -65,17 +65,17 @@ class RoomModal extends Component { this.setInitialState(); this.closeModal(); }) - .catch((err) => console.error("error in creating room", err)); + .catch((err) => console.error('error in creating room', err)); }; modifyRoomModal = (e) => { - let data = { + const data = { icon: this.state.selectedIcon, name: this.state.name, image: this.state.img, }; - console.log("data", data); + console.log('data', data); this.props .saveRoom(data, this.props.id) @@ -83,14 +83,14 @@ class RoomModal extends Component { this.setInitialState(); this.closeModal(); }) - .catch((err) => console.error("error in updating room", err)); + .catch((err) => console.error('error in updating room', err)); }; deleteRoom = (e) => { this.props .deleteRoom(this.props.id) .then(() => this.closeModal()) - .catch((err) => console.error("error in deleting room", err)); + .catch((err) => console.error('error in deleting room', err)); }; setSureTrue = () => { @@ -102,8 +102,8 @@ class RoomModal extends Component { }; changeSomething = (event) => { - let nam = event.target.name; - let val = event.target.value; + const nam = event.target.name; + const val = event.target.value; this.setState({ [nam]: val }); }; @@ -120,7 +120,7 @@ class RoomModal extends Component { } getBase64(file, callback) { - let reader = new FileReader(); + const reader = new FileReader(); reader.readAsDataURL(file.target.files[0]); reader.onload = () => { this.setState(Object.assign(this.state, { img: reader.result })); @@ -130,16 +130,16 @@ class RoomModal extends Component { render() { const spaceDiv = { - background: "#f4f4f4", - padding: "10px 10px", - margin: "10px 0px", + background: '#f4f4f4', + padding: '10px 10px', + margin: '10px 0px', }; return (
{!this.props.nicolaStop ? (
- {this.type === "new" ? ( + {this.type === 'new' ? (
- {this.type === "modify" ? ( + {this.type === 'modify' ? (
@@ -271,9 +274,7 @@ class RoomModal extends Component { } } -const setActiveRoom = (activeRoom) => { - return (dispatch) => dispatch(appActions.setActiveRoom(activeRoom)); -}; +const setActiveRoom = (activeRoom) => (dispatch) => dispatch(appActions.setActiveRoom(activeRoom)); const mapStateToProps = (state, ownProps) => ({ room: ownProps.id ? state.rooms[ownProps.id] : null, @@ -282,6 +283,6 @@ const RoomModalContainer = connect( mapStateToProps, { ...RemoteService, setActiveRoom }, null, - { forwardRef: true } + { forwardRef: true }, )(RoomModal); export default RoomModalContainer; diff --git a/smart-hut/src/components/SceneModal.js b/smart-hut/src/components/SceneModal.js index d9cce65..f4a4d9e 100644 --- a/smart-hut/src/components/SceneModal.js +++ b/smart-hut/src/components/SceneModal.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Button, Header, @@ -10,12 +10,12 @@ import { Dropdown, Checkbox, Segment, -} from "semantic-ui-react"; -import SelectIcons from "./SelectIcons"; -import { connect } from "react-redux"; -import { RemoteService } from "../remote"; -import { appActions } from "../storeActions"; -//import { update } from "immutability-helper"; +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import SelectIcons from './SelectIcons'; +import { RemoteService } from '../remote'; +import { appActions } from '../storeActions'; +// import { update } from "immutability-helper"; class SceneModal extends Component { constructor(props) { @@ -39,13 +39,13 @@ class SceneModal extends Component { get initialState() { return { - name: this.type === "new" ? "New Scene" : this.props.scene.name, + name: this.type === 'new' ? 'New Scene' : this.props.scene.name, openModal: false, - selectedIcon: "home", + selectedIcon: 'home', scenes: this.scenes, copyFrom: null, guestAccessEnabled: - this.type === "new" ? null : this.props.scene.guestAccessEnabled, + this.type === 'new' ? null : this.props.scene.guestAccessEnabled, }; } @@ -62,11 +62,11 @@ class SceneModal extends Component { } get type() { - return !this.props.id ? "new" : "modify"; + return !this.props.id ? 'new' : 'modify'; } addSceneModal = (e) => { - let data = { + const data = { name: this.state.name, icon: this.state.selectedIcon, }; @@ -77,11 +77,11 @@ class SceneModal extends Component { this.setInitialState(); this.closeModal(); }) - .catch((err) => console.error("error in creating room", err)); + .catch((err) => console.error('error in creating room', err)); }; modifySceneModal = (e) => { - let data = { + const data = { name: this.state.name, icon: this.state.selectedIcon, guestAccessEnabled: this.state.guestAccessEnabled, @@ -94,19 +94,19 @@ class SceneModal extends Component { this.setInitialState(); this.closeModal(); }) - .catch((err) => console.error("error in updating room", err)); + .catch((err) => console.error('error in updating room', err)); }; deleteScene = (e) => { this.props .deleteScene(this.props.id) .then(() => this.closeModal()) - .catch((err) => console.error("error in deleting room", err)); + .catch((err) => console.error('error in deleting room', err)); }; changeSomething = (event) => { - let nam = event.target.name; - let val = event.target.value; + const nam = event.target.name; + const val = event.target.value; this.setState({ [nam]: val }); }; @@ -133,16 +133,16 @@ class SceneModal extends Component { render() { const spaceDiv = { - background: "#f4f4f4", - padding: "10px 10px", - margin: "10px 0px", + background: '#f4f4f4', + padding: '10px 10px', + margin: '10px 0px', }; return (
{!this.props.nicolaStop ? (
- {this.type === "new" ? ( + {this.type === 'new' ? (
- {this.type === "new" && ( + {this.type === 'new' && ( )} - {this.type === "modify" ? ( + {this.type === 'modify' ? ( - + - this.setGuestAccessEnabled(val.checked) - } + onChange={(e, val) => this.setGuestAccessEnabled(val.checked)} /> ) : null} - {this.type === "modify" ? ( + {this.type === 'modify' ? ( @@ -273,9 +273,7 @@ class SceneModal extends Component { } } -const setActiveScene = (activeScene) => { - return (dispatch) => dispatch(appActions.setActiveScene(activeScene)); -}; +const setActiveScene = (activeScene) => (dispatch) => dispatch(appActions.setActiveScene(activeScene)); const mapStateToProps = (state, ownProps) => ({ scene: ownProps.id ? state.scenes[ownProps.id] : null, @@ -285,6 +283,6 @@ const SceneModalContainer = connect( mapStateToProps, { ...RemoteService, setActiveScene }, null, - { forwardRef: true } + { forwardRef: true }, )(SceneModal); export default SceneModalContainer; diff --git a/smart-hut/src/components/SelectIcons.js b/smart-hut/src/components/SelectIcons.js index 3722168..fa6cce6 100644 --- a/smart-hut/src/components/SelectIcons.js +++ b/smart-hut/src/components/SelectIcons.js @@ -1,5 +1,5 @@ -import React, { Component } from "react"; -import { Button, Grid } from "semantic-ui-react"; +import React, { Component } from 'react'; +import { Button, Grid } from 'semantic-ui-react'; export default class SelectIcons extends Component { constructor(props) { @@ -11,7 +11,7 @@ export default class SelectIcons extends Component { selectIcon = (e) => { let el = e.target.name; - if (e.target.tagName === "I") { + if (e.target.tagName === 'I') { el = e.target.parentNode.name; } this.props.updateIcon(el); @@ -20,36 +20,32 @@ export default class SelectIcons extends Component { render() { const myicons = [ - ["home", "coffee", "beer", "glass martini", "film", "video"], - ["music", "headphones", "fax", "phone", "laptop", "bath"], - ["shower", "bed", "child", "warehouse", "car", "bicycle"], - ["motorcycle", "archive", "boxes", "cubes", "chess", "gamepad"], - ["futbol", "table tennis", "server", "tv", "heart", "camera"], - ["trophy", "wrench", "image", "book", "university", "medkit"], - ["paw", "tree", "utensils", "male", "female", "life ring outline"], + ['home', 'coffee', 'beer', 'glass martini', 'film', 'video'], + ['music', 'headphones', 'fax', 'phone', 'laptop', 'bath'], + ['shower', 'bed', 'child', 'warehouse', 'car', 'bicycle'], + ['motorcycle', 'archive', 'boxes', 'cubes', 'chess', 'gamepad'], + ['futbol', 'table tennis', 'server', 'tv', 'heart', 'camera'], + ['trophy', 'wrench', 'image', 'book', 'university', 'medkit'], + ['paw', 'tree', 'utensils', 'male', 'female', 'life ring outline'], ]; return ( - {myicons.map((e, i) => { - return ( - - {e.map((e, i) => { - return ( - - ); } @@ -499,7 +487,7 @@ class AutomationSaveModal extends Component { onClose={this.closeModal} > -
+
{this.state.editName ? ( this.setEditName((prev) => !prev)} - style={{ display: "inline" }} + style={{ display: 'inline' }} circular size="small" - icon={this.state.editName ? "save" : "edit"} + icon={this.state.editName ? 'save' : 'edit'} /> @@ -527,10 +515,10 @@ class AutomationSaveModal extends Component {
Create Triggers
- {this.state.triggerList.length > 0 && - this.state.triggerList.map((trigger, i) => { + {this.state.triggerList.length > 0 + && this.state.triggerList.map((trigger, i) => { const deviceName = this.deviceList.filter( - (d) => d.id === trigger.device + (d) => d.id === trigger.device, )[0].name; const key = this._generateKey(trigger); return ( @@ -558,7 +546,7 @@ class AutomationSaveModal extends Component {
{this.props.scenes.length > 0 ? ( - + <>
Activate Scenes
))} -
+ ) : ( - + <>
-
+ )}
@@ -592,9 +580,9 @@ class AutomationSaveModal extends Component {
- + @@ -612,6 +600,6 @@ const mapStateToProps = (state, ownProps) => ({ }); const AutomationSaveModalContainer = connect( mapStateToProps, - RemoteService + RemoteService, )(AutomationSaveModal); export default AutomationSaveModalContainer; diff --git a/smart-hut/src/components/dashboard/AutomationsPanel.js b/smart-hut/src/components/dashboard/AutomationsPanel.js index 8530213..81163d0 100644 --- a/smart-hut/src/components/dashboard/AutomationsPanel.js +++ b/smart-hut/src/components/dashboard/AutomationsPanel.js @@ -1,7 +1,7 @@ -import React, { Component } from "react"; -import { connect } from "react-redux"; -import { RemoteService } from "../../remote"; -import "./Automations.css"; +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import { RemoteService } from '../../remote'; +import './Automations.css'; import { Segment, @@ -11,52 +11,54 @@ import { List, Divider, Menu, -} from "semantic-ui-react"; -import CreateAutomation, { operands } from "./AutomationCreationModal"; +} from 'semantic-ui-react'; +import CreateAutomation, { operands } from './AutomationCreationModal'; -const Automation = ({ automation, devices, scenes, removeAutomation }) => { +const Automation = ({ + automation, devices, scenes, removeAutomation, +}) => { const { triggers } = automation; const scenePriorities = automation.scenes; - const getOperator = (operand) => - operands.filter((o) => o.key === operand)[0].text; + const getOperator = (operand) => operands.filter((o) => o.key === operand)[0].text; return ( - -
+ <> +
{automation.name}
- {this.props.stateOrDevice.kind === "smartPlug" ? ( + {this.props.stateOrDevice.kind === 'smartPlug' ? ( - } + )} closeIcon >
@@ -31,7 +37,7 @@ const SettingsForm = (props) => { setValues({ ...values, [name]: value }); }; - const [values, setValues] = useState({ name: "" }); + const [values, setValues] = useState({ name: '' }); return ( @@ -69,7 +75,7 @@ class DeviceSettingsModal extends Component { this.updateDevice = this.updateDevice.bind(this); this.deleteDevice = this.deleteDevice.bind(this); - //this.useExternalTempSensor = this.useExternalTempSensor.bind(this); + // this.useExternalTempSensor = this.useExternalTempSensor.bind(this); } closeModal = (e) => { @@ -82,18 +88,18 @@ class DeviceSettingsModal extends Component { updateDevice(values) { console.log(values, this.external); - let name = values.name; + let { name } = values; if (values.name.length === 0) { name = this.props.device.name; } - let data = { + const data = { ...this.props.device, - name: name, + name, }; - if (this.props.device.kind === "thermostat") { - let external = values.external + if (this.props.device.kind === 'thermostat') { + const external = values.external ? values.external : this.props.device.useExternalSensors; console.log(external); @@ -103,27 +109,24 @@ class DeviceSettingsModal extends Component { this.props .saveDevice(data) .then(() => this.setState({ openModal: false })) - .catch((err) => - console.error( + .catch((err) => console.error( `settings modal for device ${this.props.id} deletion error`, - err - ) - ); + err, + )); } deleteDevice() { this.props .deleteDevice(this.props.device) .then(() => this.setState({ openModal: false })) - .catch((err) => - console.error( + .catch((err) => console.error( `settings modal for device ${this.props.id} deletion error`, - err - ) - ); + err, + )); } _editForm = null; + get editForm() { this._editForm = this._editForm || ( - Settings of {this.props.device.name} + +Settings of + {this.props.device.name} + {this.editForm} ); @@ -153,6 +159,6 @@ const DeviceSettingsModalContainer = connect( mapStateToProps, RemoteService, null, - { forwardRef: true } + { forwardRef: true }, )(DeviceSettingsModal); export default DeviceSettingsModalContainer; diff --git a/smart-hut/src/components/dashboard/devices/Dimmer.js b/smart-hut/src/components/dashboard/devices/Dimmer.js index 60fdc32..f8652db 100644 --- a/smart-hut/src/components/dashboard/devices/Dimmer.js +++ b/smart-hut/src/components/dashboard/devices/Dimmer.js @@ -5,20 +5,21 @@ • A dimmer without state can just increase or decrease the intensity of a light. <-- DefualtDimmer The user can change the state of a dimmer through an intuitive UI in SmartHut . - **/ + * */ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { CircularInput, CircularProgress, CircularThumb, -} from "react-circular-input"; +} from 'react-circular-input'; +import { connect } from 'react-redux'; import { ButtonDimmerContainer, MinusPanel, PlusPanel, ThumbText, -} from "./styleComponents"; +} from './styleComponents'; import { CircularThumbStyle, KnobDimmerStyle, @@ -26,22 +27,21 @@ import { textStyle, knobIcon, knobContainer, -} from "./DimmerStyle"; -import { RemoteService } from "../../../remote"; -import { connect } from "react-redux"; -import mapStateToProps from "../../../deviceProps"; +} from './DimmerStyle'; +import { RemoteService } from '../../../remote'; +import mapStateToProps from '../../../deviceProps'; export class ButtonDimmerComponent extends Component { increaseIntensity = () => { this.props - .buttonDimmerDim(this.props.id, "UP") - .catch((err) => console.error("button dimmer increase error", err)); + .buttonDimmerDim(this.props.id, 'UP') + .catch((err) => console.error('button dimmer increase error', err)); }; decreaseIntensity = () => { this.props - .buttonDimmerDim(this.props.id, "DOWN") - .catch((err) => console.error("button dimmer decrease error", err)); + .buttonDimmerDim(this.props.id, 'DOWN') + .catch((err) => console.error('button dimmer decrease error', err)); }; render() { @@ -96,7 +96,7 @@ export class KnobDimmerComponent extends Component { const val = Math.round(this.state.intensity); this.props .knobDimmerDimTo(this.props.id, val) - .catch((err) => console.error("knob dimmer set intensity error", err)); + .catch((err) => console.error('knob dimmer set intensity error', err)); } render() { @@ -104,7 +104,7 @@ export class KnobDimmerComponent extends Component {
- + Knob Icon
diff --git a/smart-hut/src/components/dashboard/devices/DimmerStyle.js b/smart-hut/src/components/dashboard/devices/DimmerStyle.js index a8b3260..25e8f2b 100644 --- a/smart-hut/src/components/dashboard/devices/DimmerStyle.js +++ b/smart-hut/src/components/dashboard/devices/DimmerStyle.js @@ -1,72 +1,72 @@ export const KnobDimmerStyle = { - cursor: "pointer", - marginTop: "1rem", - width: "9rem", - height: "9rem", - fill: "#1a2849", + cursor: 'pointer', + marginTop: '1rem', + width: '9rem', + height: '9rem', + fill: '#1a2849', }; export const KnobHolder = { - marginTop: "1rem", - cursor: "pointer", - padding: "3rem", - backgroundColor: "white", - width: "10rem", - height: "10rem", + marginTop: '1rem', + cursor: 'pointer', + padding: '3rem', + backgroundColor: 'white', + width: '10rem', + height: '10rem', }; export const KnobCircularTrack = { - fill: "white", - stroke: "#1a2849", + fill: 'white', + stroke: '#1a2849', }; export const KnobIcon = { - fill: "#1a2849", + fill: '#1a2849', }; export const KnobProgress = { - stroke: "#1a2849", - strokeWidth: "3rem", + stroke: '#1a2849', + strokeWidth: '3rem', }; export const ValueStyle = { - pointerEvents: "none", - fill: "#1a2849", - fontSize: "1.3rem", - fontFamily: "Lato", - textAnchor: "middle", - userSelect: "none", + pointerEvents: 'none', + fill: '#1a2849', + fontSize: '1.3rem', + fontFamily: 'Lato', + textAnchor: 'middle', + userSelect: 'none', }; export const CircularThumbStyle = { - fill: "white", - stroke: "#1a2849", - strokeWidth: ".2rem", - r: "1.4rem", + fill: 'white', + stroke: '#1a2849', + strokeWidth: '.2rem', + r: '1.4rem', }; export const textStyle = { - position: "absolute", - fill: "#1a2849", - fontSize: "1.5rem", - fontFamily: "Lato", - overflow: "hidden", - whiteSpace: "nowrap", - textOverflow: "ellipsis", - userSelect: "none", + position: 'absolute', + fill: '#1a2849', + fontSize: '1.5rem', + fontFamily: 'Lato', + overflow: 'hidden', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + userSelect: 'none', }; export const knobIcon = { - position: "absolute", - left: "50%", - top: "30%", - transform: "translateX(-50%)", - width: "2rem", - height: "2rem", + position: 'absolute', + left: '50%', + top: '30%', + transform: 'translateX(-50%)', + width: '2rem', + height: '2rem', }; export const knobContainer = { - position: "relative", - width: "9rem", - height: "9rem", + position: 'relative', + width: '9rem', + height: '9rem', }; diff --git a/smart-hut/src/components/dashboard/devices/Light.js b/smart-hut/src/components/dashboard/devices/Light.js index 911f155..919b167 100644 --- a/smart-hut/src/components/dashboard/devices/Light.js +++ b/smart-hut/src/components/dashboard/devices/Light.js @@ -7,19 +7,20 @@ * Lights have an internal state that can be changed and it must * be shown accordingly in the SmartHut views (house view and room views). */ -import React, { Component } from "react"; +import React, { Component } from 'react'; +import { Image } from 'semantic-ui-react'; +import { + CircularInput, + CircularProgress, + CircularThumb, +} from 'react-circular-input'; +import { connect } from 'react-redux'; import { iconStyle, StyledDiv, BottomPanel, ThumbText, -} from "./styleComponents"; -import { Image } from "semantic-ui-react"; -import { - CircularInput, - CircularProgress, - CircularThumb, -} from "react-circular-input"; +} from './styleComponents'; import { LightDimmerContainer, LightDimmerStyle, @@ -28,10 +29,9 @@ import { KnobProgress, CircularThumbStyle, knobIcon, -} from "./LightStyle"; -import { RemoteService } from "../../../remote"; -import { connect } from "react-redux"; -import mapStateToProps from "../../../deviceProps"; +} from './LightStyle'; +import { RemoteService } from '../../../remote'; +import mapStateToProps from '../../../deviceProps'; class Light extends Component { constructor(props) { @@ -41,8 +41,8 @@ class Light extends Component { timeout: null, }; - this.iconOn = "/img/lightOn.svg"; - this.iconOff = "/img/lightOff.svg"; + this.iconOn = '/img/lightOn.svg'; + this.iconOff = '/img/lightOff.svg'; this.setIntensity = this.setIntensity.bind(this); } @@ -68,34 +68,30 @@ class Light extends Component { onClickDevice = () => { const on = !this.turnedOn; - if (this.props.tab !== "Scenes") { + if (this.props.tab !== 'Scenes') { this.props .saveDevice( { ...this.props.stateOrDevice, on }, - this.props.tab === "Hosts" ? this.props.activeHost : null + this.props.tab === 'Hosts' ? this.props.activeHost : null, ) - .catch((err) => console.error("regular light update error", err)); - } else { - if (this.props.device.kind === "regularLight") { + .catch((err) => console.error('regular light update error', err)); + } else if (this.props.device.kind === 'regularLight') { this.props .updateState( { id: this.props.stateOrDevice.id, - on: on, + on, sceneId: this.props.stateOrDevice.sceneId, }, - this.props.stateOrDevice.kind + this.props.stateOrDevice.kind, ) .then((res) => { console.log(res); }); } - } }; - getIcon = () => { - return this.turnedOn ? this.iconOn : this.iconOff; - }; + getIcon = () => (this.turnedOn ? this.iconOn : this.iconOff); setIntensity(intensity) { intensity *= 100; @@ -118,18 +114,18 @@ class Light extends Component { saveIntensity = () => { const intensity = Math.round(this.state.intensity); - if (this.props.tab !== "Scenes") { + if (this.props.tab !== 'Scenes') { this.props .saveDevice( { ...this.props.stateOrDevice, intensity }, - this.props.tab === "Hosts" ? this.props.activeHost : null + this.props.tab === 'Hosts' ? this.props.activeHost : null, ) - .catch((err) => console.error("dimmable light update error", err)); + .catch((err) => console.error('dimmable light update error', err)); } else { this.props .updateState( - { id: this.props.stateOrDevice.id, intensity: intensity }, - this.props.stateOrDevice.kind + { id: this.props.stateOrDevice.id, intensity }, + this.props.stateOrDevice.kind, ) .then((res) => { console.log(res, this.props.stateOrDevice.kind); @@ -142,7 +138,7 @@ class Light extends Component {
@@ -163,7 +159,7 @@ class Light extends Component { }} /> - +
@@ -173,7 +169,7 @@ class Light extends Component {
- +
Light
@@ -182,7 +178,7 @@ class Light extends Component { return (
- {this.props.device.kind === "dimmableLight" + {this.props.device.kind === 'dimmableLight' ? intensityLightView : normalLightView}
diff --git a/smart-hut/src/components/dashboard/devices/LightStyle.js b/smart-hut/src/components/dashboard/devices/LightStyle.js index 54ebc5d..d6b33d6 100644 --- a/smart-hut/src/components/dashboard/devices/LightStyle.js +++ b/smart-hut/src/components/dashboard/devices/LightStyle.js @@ -1,69 +1,69 @@ export const valueStyle = { - fill: "#3e99ff", - fontSize: "2.5rem", - fontFamily: "Lato", - textShadow: "1px 1px 0.5px rgba(0, 0, 0, .2)", + fill: '#3e99ff', + fontSize: '2.5rem', + fontFamily: 'Lato', + textShadow: '1px 1px 0.5px rgba(0, 0, 0, .2)', }; export const intensityLightStyle = { - fill: "#ffd31d", - fontSize: "1.2rem", - fontFamily: "Lato", - textShadow: "1px 1px 0.5px rgba(0, 0, 0, .2)", + fill: '#ffd31d', + fontSize: '1.2rem', + fontFamily: 'Lato', + textShadow: '1px 1px 0.5px rgba(0, 0, 0, .2)', }; export const textStyle = { - position: "absolute", - fill: "#ffd31d", - fontSize: "1.5rem", - fontFamily: "Lato", - overflow: "hidden", - whiteSpace: "nowrap", - textOverflow: "ellipsis", - userSelect: "none", + position: 'absolute', + fill: '#ffd31d', + fontSize: '1.5rem', + fontFamily: 'Lato', + overflow: 'hidden', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + userSelect: 'none', }; export const nameStyle = { - fontSize: "1rem", - position: "absolute", - top: "30%", - left: "50%", - transform: "translateX(-50%)", - color: "white", - userSelect: "none", + fontSize: '1rem', + position: 'absolute', + top: '30%', + left: '50%', + transform: 'translateX(-50%)', + color: 'white', + userSelect: 'none', }; export const LightDimmerStyle = { - cursor: "pointer", - marginTop: "1rem", - width: "9rem", - height: "9rem", - fill: "#ffd31d", + cursor: 'pointer', + marginTop: '1rem', + width: '9rem', + height: '9rem', + fill: '#ffd31d', }; export const LightDimmerContainer = { - position: "relative", - width: "9rem", - height: "9rem", + position: 'relative', + width: '9rem', + height: '9rem', }; export const CircularThumbStyle = { - fill: "white", - stroke: "#ffd31d", - strokeWidth: ".2rem", - r: "1.4rem", + fill: 'white', + stroke: '#ffd31d', + strokeWidth: '.2rem', + r: '1.4rem', }; export const KnobProgress = { - stroke: "#ffd31d", - strokeWidth: "3rem", + stroke: '#ffd31d', + strokeWidth: '3rem', }; export const knobIcon = { - position: "absolute", - left: "50%", - top: "30%", - transform: "translateX(-50%)", - width: "2rem", - height: "2rem", + position: 'absolute', + left: '50%', + top: '30%', + transform: 'translateX(-50%)', + width: '2rem', + height: '2rem', }; diff --git a/smart-hut/src/components/dashboard/devices/NewDevice.js b/smart-hut/src/components/dashboard/devices/NewDevice.js index c384282..2002750 100644 --- a/smart-hut/src/components/dashboard/devices/NewDevice.js +++ b/smart-hut/src/components/dashboard/devices/NewDevice.js @@ -1,5 +1,5 @@ -import React, { Component } from "react"; -import styled from "styled-components"; +import React, { Component } from 'react'; +import styled from 'styled-components'; import { Button, Dropdown, @@ -8,9 +8,9 @@ import { Image, Input, Modal, -} from "semantic-ui-react"; -import { RemoteService } from "../../../remote"; -import { connect } from "react-redux"; +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import { RemoteService } from '../../../remote'; const StyledDiv = styled.div` background-color: #505bda; @@ -38,7 +38,7 @@ class NewDevice extends Component { step: 1, openModal: false, motion: false, - deviceName: "", + deviceName: '', }; this.baseState = this.state; this.createDevice = this.createDevice.bind(this); @@ -47,6 +47,7 @@ class NewDevice extends Component { handleOpen = () => { this.setState({ openModal: true }); }; + handleClose = () => { this.setState({ openModal: false }); }; @@ -59,12 +60,13 @@ class NewDevice extends Component { nextStep = () => { this.setState((prevState) => ({ step: prevState.step + 1 })); }; + previousStep = () => { this.setState((prevState) => ({ step: prevState.step - 1 })); }; setTypeOfDevice = (e, d) => { - if (d.value === "dimmableLight") { + if (d.value === 'dimmableLight') { this.setState({ typeOfDevice: d.value, intensity: 0 }); } else { this.setState({ typeOfDevice: d.value }); @@ -77,7 +79,7 @@ class NewDevice extends Component { setTypeOfSensor = (e, d) => { console.log(d.value); - if (d.value === "motionSensor") { + if (d.value === 'motionSensor') { this.setState({ typeOfSensor: d.value, motion: true }); } else { this.setState({ typeOfSensor: d.value }); @@ -94,59 +96,59 @@ class NewDevice extends Component { id: null, roomId: this.props.activeRoom, name: this.state.deviceName, - kind: this.state.motion ? "motionSensor" : this.state.typeOfDevice, + kind: this.state.motion ? 'motionSensor' : this.state.typeOfDevice, }; let outputs = null; const defaultNames = { - regularLight: "New regular light", - dimmableLight: "New intensity light", - smartPlug: "New smart Plug", - sensor: "New sensor", - switch: "New switch", - buttonDimmer: "New button dimmer", - knobDimmer: "New knob dimmer", - securityCamera: "New security camera", - thermostat: "New thermostat", - curtains: "New curtains", + regularLight: 'New regular light', + dimmableLight: 'New intensity light', + smartPlug: 'New smart Plug', + sensor: 'New sensor', + switch: 'New switch', + buttonDimmer: 'New button dimmer', + knobDimmer: 'New knob dimmer', + securityCamera: 'New security camera', + thermostat: 'New thermostat', + curtains: 'New curtains', }; - if (this.state.deviceName === "") { + if (this.state.deviceName === '') { data.name = defaultNames[this.state.typeOfDevice]; } - console.log("-------------------------"); + console.log('-------------------------'); console.log(this.state.typeOfDevice); switch (this.state.typeOfDevice) { - //trying to make securityCamera work - //case "securityCamera": + // trying to make securityCamera work + // case "securityCamera": // data.path="/security_camera_videos/security_camera_1.mp4"; // data.on=false; - //break; - //trying to make thermostat work - case "thermostat": + // break; + // trying to make thermostat work + case 'thermostat': data.targetTemperature = 0; data.measuredTemperature = 0; break; - case "dimmableLight": + case 'dimmableLight': data.intensity = 0; break; - case "sensor": + case 'sensor': if (!this.state.motion) { data.sensor = this.state.typeOfSensor; data.value = 0; } break; - case "switch": - case "buttonDimmer": - case "knobDimmer": + case 'switch': + case 'buttonDimmer': + case 'knobDimmer': outputs = this.state.lightsAttached; if ( - this.state.lightsAttached === undefined || - this.state.lightsAttached.length === 0 + this.state.lightsAttached === undefined + || this.state.lightsAttached.length === 0 ) { alert( - "No lights attached to this switch! Please, add a light a first." + 'No lights attached to this switch! Please, add a light a first.', ); return; } @@ -156,114 +158,114 @@ class NewDevice extends Component { } try { - let newDevice = await this.props.saveDevice(data); + const newDevice = await this.props.saveDevice(data); if (outputs) { await this.props.connectOutputs(newDevice, outputs); } this.resetState(); } catch (e) { - console.error("device creation error: ", e); + console.error('device creation error: ', e); } } render() { const deviceOptions = [ - //stuff + // stuff { - key: "thermostat", - text: "Thermostat", - value: "thermostat", - image: { avatar: true, src: "/img/thermostat-icon.png" }, + key: 'thermostat', + text: 'Thermostat', + value: 'thermostat', + image: { avatar: true, src: '/img/thermostat-icon.png' }, }, { - key: "curtains", - text: "Curtain", - value: "curtains", - image: { avatar: true, src: "/img/curtains-icon.png" }, + key: 'curtains', + text: 'Curtain', + value: 'curtains', + image: { avatar: true, src: '/img/curtains-icon.png' }, }, - //stuff ends + // stuff ends { - key: "light", - text: "Normal Light", - value: "regularLight", - image: { avatar: true, src: "/img/lightOn.svg" }, + key: 'light', + text: 'Normal Light', + value: 'regularLight', + image: { avatar: true, src: '/img/lightOn.svg' }, }, { - key: "intensity-light", - text: "Intensity Light", - value: "dimmableLight", - image: { avatar: true, src: "/img/intensity-light.svg" }, + key: 'intensity-light', + text: 'Intensity Light', + value: 'dimmableLight', + image: { avatar: true, src: '/img/intensity-light.svg' }, }, { - key: "smart-plug", - text: "Smart Plug", - value: "smartPlug", - image: { avatar: true, src: "/img/smart-plug.svg" }, + key: 'smart-plug', + text: 'Smart Plug', + value: 'smartPlug', + image: { avatar: true, src: '/img/smart-plug.svg' }, }, { - key: "sensor", - text: "Sensor", - value: "sensor", - image: { avatar: true, src: "/img/sensorOn.svg" }, + key: 'sensor', + text: 'Sensor', + value: 'sensor', + image: { avatar: true, src: '/img/sensorOn.svg' }, }, { - key: "switch", - text: "Switch", - value: "switch", - image: { avatar: true, src: "/img/switchOn.svg" }, + key: 'switch', + text: 'Switch', + value: 'switch', + image: { avatar: true, src: '/img/switchOn.svg' }, }, { - key: "knobDimmer", - text: "Knob Dimmer", - value: "knobDimmer", - image: { avatar: true, src: "/img/knob.svg" }, + key: 'knobDimmer', + text: 'Knob Dimmer', + value: 'knobDimmer', + image: { avatar: true, src: '/img/knob.svg' }, }, { - key: "buttonDimmer", - text: "Button Dimmer", - value: "buttonDimmer", - image: { avatar: true, src: "/img/plusMinus.svg" }, + key: 'buttonDimmer', + text: 'Button Dimmer', + value: 'buttonDimmer', + image: { avatar: true, src: '/img/plusMinus.svg' }, }, { - key: "securityCamera", - text: "Security Camera", - value: "securityCamera", - image: { avatar: true, src: "/img/security-icon.png" }, + key: 'securityCamera', + text: 'Security Camera', + value: 'securityCamera', + image: { avatar: true, src: '/img/security-icon.png' }, }, ]; const sensorOptions = [ { - key: "temperature", - text: "Temperature Sensor", - value: "TEMPERATURE", - image: { avatar: true, src: "/img/temperature-sensor.svg" }, + key: 'temperature', + text: 'Temperature Sensor', + value: 'TEMPERATURE', + image: { avatar: true, src: '/img/temperature-sensor.svg' }, }, { - key: "humidity", - text: "Humidity Sensor", - value: "HUMIDITY", - image: { avatar: true, src: "/img/humidity-sensor.svg" }, + key: 'humidity', + text: 'Humidity Sensor', + value: 'HUMIDITY', + image: { avatar: true, src: '/img/humidity-sensor.svg' }, }, { - key: "light", - text: "Light Sensor", - value: "LIGHT", - image: { avatar: true, src: "/img/light-sensor.svg" }, + key: 'light', + text: 'Light Sensor', + value: 'LIGHT', + image: { avatar: true, src: '/img/light-sensor.svg' }, }, { - key: "motion", - text: "Motion Sensor", - value: "motionSensor", - image: { avatar: true, src: "/img/sensorOn.svg" }, + key: 'motion', + text: 'Motion Sensor', + value: 'motionSensor', + image: { avatar: true, src: '/img/sensorOn.svg' }, }, ]; const availableSwitchDevices = []; const availableDimmerDevices = []; this.props.devices.forEach((d) => { if ( - d.kind === "regularLight" || - d.kind === "dimmableLight" || - d.kind === "smartPlug" + d.kind === 'regularLight' + || d.kind === 'dimmableLight' + || d.kind === 'smartPlug' ) { availableSwitchDevices.push({ key: d.id, @@ -271,7 +273,7 @@ class NewDevice extends Component { value: d.id, }); } - if (d.kind === "dimmableLight") { + if (d.kind === 'dimmableLight') { availableDimmerDevices.push({ key: d.id, text: d.name, @@ -296,7 +298,7 @@ class NewDevice extends Component { ); const sensorForm = ( - + ); const switchOptions = ( - + ); const dimmerOptions = ( - + {deviceName} - {this.state.typeOfDevice === "sensor" ? sensorForm : ""} - {this.state.typeOfDevice === "switch" ? switchOptions : ""} - {this.state.typeOfDevice === "buttonDimmer" || - this.state.typeOfDevice === "knobDimmer" + {this.state.typeOfDevice === 'sensor' ? sensorForm : ''} + {this.state.typeOfDevice === 'switch' ? switchOptions : ''} + {this.state.typeOfDevice === 'buttonDimmer' + || this.state.typeOfDevice === 'knobDimmer' ? dimmerOptions - : ""} + : ''} ); }; @@ -361,19 +363,19 @@ class NewDevice extends Component { closeIcon open={this.state.openModal} onClose={this.resetState} - trigger={ + trigger={( - + - } - centered={true} + )} + centered > Add a New Device {steps[this.state.step - 1]} @@ -389,7 +391,7 @@ class NewDevice extends Component { Back ) : ( - "" + '' )} {this.state.step < steps.length ? ( ) : ( - "" + '' )} {this.state.step === steps.length ? (
@@ -164,13 +171,13 @@ class Thermostats extends Component { const mapStateToProps2 = (state, ownProps) => ({ ...mapStateToProps(state, ownProps), get tempSensorsInRoom() { - if (state.active.activeTab !== "Devices") return false; + 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" + (d) => d.kind === 'sensor' && d.sensor === 'TEMPERATURE', ); return sensors.length > 0; }, @@ -178,6 +185,6 @@ const mapStateToProps2 = (state, ownProps) => ({ const ThermostatContainer = connect( mapStateToProps2, - RemoteService + RemoteService, )(Thermostats); export default ThermostatContainer; diff --git a/smart-hut/src/components/dashboard/devices/TypesOfDevices.js b/smart-hut/src/components/dashboard/devices/TypesOfDevices.js index 6f3e2ba..1882afc 100644 --- a/smart-hut/src/components/dashboard/devices/TypesOfDevices.js +++ b/smart-hut/src/components/dashboard/devices/TypesOfDevices.js @@ -1,24 +1,24 @@ export const LightDevice = { - img: "/img/lightOff.svg", - imgClick: "/img/lightOn.svg", + img: '/img/lightOff.svg', + imgClick: '/img/lightOn.svg', }; export const SmartPlugDevice = { - img: "/img/smart-plug.svg", - imgClick: "/img/smart-plug-off.svg", + img: '/img/smart-plug.svg', + imgClick: '/img/smart-plug-off.svg', }; export const TemperatureSensor = { - type: "temperature_sensor", - img: "", - imgClick: "", - units: "ºC", + type: 'temperature_sensor', + img: '', + imgClick: '', + units: 'ºC', }; export const deviceList = [ - "Light", - "Dimmer", - "Switcher", - "Smart Plug", - "Sensor", + 'Light', + 'Dimmer', + 'Switcher', + 'Smart Plug', + 'Sensor', ]; diff --git a/smart-hut/src/components/dashboard/devices/Videocam.js b/smart-hut/src/components/dashboard/devices/Videocam.js index 75dee30..736fd9a 100644 --- a/smart-hut/src/components/dashboard/devices/Videocam.js +++ b/smart-hut/src/components/dashboard/devices/Videocam.js @@ -1,13 +1,13 @@ // vim: set ts=2 sw=2 et tw=80: -import React, { Component } from "react"; -import { StyledDivCamera } from "./styleComponents"; -import { Grid, Checkbox } from "semantic-ui-react"; -import { RemoteService } from "../../../remote"; -import { endpointURL } from "../../../endpoint"; -import { connect } from "react-redux"; -import VideocamModal from "./VideocamModal"; -import mapStateToProps from "../../../deviceProps"; +import React, { Component } from 'react'; +import { Grid, Checkbox } from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import { StyledDivCamera } from './styleComponents'; +import { RemoteService } from '../../../remote'; +import { endpointURL } from '../../../endpoint'; +import VideocamModal from './VideocamModal'; +import mapStateToProps from '../../../deviceProps'; class Videocam extends Component { constructor(props) { @@ -18,30 +18,24 @@ class Videocam extends Component { } openModal = () => { - this.setState((state) => { - return { selectedVideo: true }; - }); + this.setState((state) => ({ selectedVideo: true })); }; closeModal = () => { - this.setState((state) => { - return { selectedVideo: undefined }; - }); + this.setState((state) => ({ selectedVideo: undefined })); }; setOnOff(onOff) { const turn = onOff; - if (this.props.tab === "Devices" || this.props.tab === "Hosts") { + if (this.props.tab === 'Devices' || this.props.tab === 'Hosts') { this.props .saveDevice({ ...this.props.device, on: turn }) - .then((res) => - turn ? this.refs.vidRef.play() : this.refs.vidRef.pause() - ) - .catch((err) => console.error("videocamera update error", err)); + .then((res) => (turn ? this.refs.vidRef.play() : this.refs.vidRef.pause())) + .catch((err) => console.error('videocamera update error', err)); } else { this.props.updateState( { id: this.props.stateOrDevice.id, on: turn }, - this.props.stateOrDevice.kind + this.props.stateOrDevice.kind, ); } } diff --git a/smart-hut/src/components/dashboard/devices/VideocamModal.js b/smart-hut/src/components/dashboard/devices/VideocamModal.js index 1062fac..e9a6e03 100644 --- a/smart-hut/src/components/dashboard/devices/VideocamModal.js +++ b/smart-hut/src/components/dashboard/devices/VideocamModal.js @@ -1,20 +1,20 @@ -import React from "react"; -import Modal from "react-modal"; -import { Button } from "semantic-ui-react"; +import React from 'react'; +import Modal from 'react-modal'; +import { Button } from 'semantic-ui-react'; const modal = { opacity: 0, - alignItems: "center", - display: "flex", - justifyContent: "center", - transition: "opacity 200ms ease-in-out", - background: "grey", - color: "white", - maxWidth: "2rem", - outline: "none", - padding: "2rem", - textAlign: "center", - maxHeight: "50vh", + alignItems: 'center', + display: 'flex', + justifyContent: 'center', + transition: 'opacity 200ms ease-in-out', + background: 'grey', + color: 'white', + maxWidth: '2rem', + outline: 'none', + padding: '2rem', + textAlign: 'center', + maxHeight: '50vh', }; const VideocamModal = (props) => ( diff --git a/smart-hut/src/components/dashboard/devices/styleComponents.js b/smart-hut/src/components/dashboard/devices/styleComponents.js index 9750404..f388f83 100644 --- a/smart-hut/src/components/dashboard/devices/styleComponents.js +++ b/smart-hut/src/components/dashboard/devices/styleComponents.js @@ -1,105 +1,105 @@ -import styled from "styled-components"; -import { useCircularInputContext } from "react-circular-input"; -import { ValueStyle } from "./DimmerStyle"; -import React from "react"; +import styled from 'styled-components'; +import { useCircularInputContext } from 'react-circular-input'; +import React from 'react'; +import { ValueStyle } from './DimmerStyle'; export const editButtonStyle = { - position: "absolute", - top: "0", - right: "0", - backgroundColor: "#505bda", - borderRadius: "0 0 0 20px", - border: "none", - padding: ".4rem 1.2rem", - outline: "none", - color: "white", - fontFamily: "Lato", - textTransform: "uppercase", + position: 'absolute', + top: '0', + right: '0', + backgroundColor: '#505bda', + borderRadius: '0 0 0 20px', + border: 'none', + padding: '.4rem 1.2rem', + outline: 'none', + color: 'white', + fontFamily: 'Lato', + textTransform: 'uppercase', }; export const panelStyle = { - backgroundColor: "#fafafa", - height: "85vh", - padding: "0rem 3rem", - color: "#000000", - overflow: "auto", - maxHeight: "75vh", + backgroundColor: '#fafafa', + height: '85vh', + padding: '0rem 3rem', + color: '#000000', + overflow: 'auto', + maxHeight: '75vh', }; export const mobilePanelStyle = { - backgroundColor: "#fafafa", - minHeight: "100vh", - padding: "0rem 3rem", - color: "#000000", + backgroundColor: '#fafafa', + minHeight: '100vh', + padding: '0rem 3rem', + color: '#000000', }; export const editModeStyle = { - position: "absolute", - top: "15%", - right: "0", - width: "1.5rem", - height: "1.5rem", - backgroundColor: "black", - borderRadius: "100%", - zIndex: "1000", - cursor: "pointer", + position: 'absolute', + top: '15%', + right: '0', + width: '1.5rem', + height: '1.5rem', + backgroundColor: 'black', + borderRadius: '100%', + zIndex: '1000', + cursor: 'pointer', }; export const editModeStyleLeft = { - position: "absolute", - top: "15%", - left: "0", - width: "1.5rem", - height: "1.5rem", - backgroundColor: "white", - borderRadius: "100%", - zIndex: "1000", - cursor: "pointer", + position: 'absolute', + top: '15%', + left: '0', + width: '1.5rem', + height: '1.5rem', + backgroundColor: 'white', + borderRadius: '100%', + zIndex: '1000', + cursor: 'pointer', }; export const editModeIconStyle = { - position: "absolute", - top: "50%", - left: "50%", - transform: "translate(-50%, -50%)", - width: "0.75rem", - height: "0.75rem", - borderRadius: "20%", - zIndex: "101", + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '0.75rem', + height: '0.75rem', + borderRadius: '20%', + zIndex: '101', }; export const iconStyle = { - width: "3.5rem", - height: "auto", - position: "absolute", - top: "10%", - left: "50%", - transform: "translateX(-50%)", - userSelect: "none", + width: '3.5rem', + height: 'auto', + position: 'absolute', + top: '10%', + left: '50%', + transform: 'translateX(-50%)', + userSelect: 'none', }; export const nameStyle = { - position: "absolute", - top: "50%", - left: "50%", - transform: "translateX(-50%)", + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translateX(-50%)', }; export const formStyle = { - position: "absolute", - zIndex: "1000", - width: "80rem", - height: "10rem", - padding: "1rem", - margin: "1rem", - borderRadius: "10%", - boxShadow: "1px 1px 5px 2px #5d5d5d", - backgroundColor: "#3e99ff", + position: 'absolute', + zIndex: '1000', + width: '80rem', + height: '10rem', + padding: '1rem', + margin: '1rem', + borderRadius: '10%', + boxShadow: '1px 1px 5px 2px #5d5d5d', + backgroundColor: '#3e99ff', }; export const addDeviceFormStyle = { - maxWidth: "400px", - background: "#3e99ff", - paddingRight: "5rem", + maxWidth: '400px', + background: '#3e99ff', + paddingRight: '5rem', }; export const StyledDiv = styled.div` diff --git a/smart-hut/src/deviceProps.js b/smart-hut/src/deviceProps.js index 352e017..f79de98 100644 --- a/smart-hut/src/deviceProps.js +++ b/smart-hut/src/deviceProps.js @@ -1,24 +1,24 @@ function getStateOrDevice(state, ownProps) { switch (state.active.activeTab) { - case "Devices": + case 'Devices': return state.devices[ownProps.id]; - case "Scenes": + case 'Scenes': return state.sceneStates[ownProps.id]; - case "Hosts": + case 'Hosts': return state.hostDevices[ownProps.hostId][ownProps.id]; default: throw new Error( - `stateOrDevice has no value in tab "${state.active.activeTab}"` + `stateOrDevice has no value in tab "${state.active.activeTab}"`, ); } } function getDevice(state, ownProps) { switch (state.active.activeTab) { - case "Scenes": + case 'Scenes': return state.devices[getStateOrDevice(state, ownProps).deviceId]; - case "Devices": - case "Hosts": + case 'Devices': + case 'Hosts': return getStateOrDevice(state, ownProps); default: throw new Error(`device has no value in tab "${state.active.activeTab}"`); @@ -27,18 +27,18 @@ function getDevice(state, ownProps) { function getRoomName(state, ownProps) { switch (state.active.activeTab) { - case "Scenes": - case "Devices": + case 'Scenes': + case 'Devices': return (state.rooms[getDevice(state, ownProps).roomId] || {}).name; - case "Hosts": + case 'Hosts': const hostRooms = state.hostRooms[ownProps.hostId]; - if (!hostRooms) return ""; + if (!hostRooms) return ''; const room = hostRooms[getDevice(state, ownProps).roomId]; - if (!room) return ""; + if (!room) return ''; return room.name; default: throw new Error( - `room name has no value in tab "${state.active.activeTab}"` + `room name has no value in tab "${state.active.activeTab}"`, ); } } @@ -60,9 +60,9 @@ export default function mapStateToProps(state, ownProps) { }, get disabled() { return ( - ownProps.tab === "Hosts" && - ["dimmableLight", "light"].indexOf(getDevice(state, ownProps).kind) === - -1 + ownProps.tab === 'Hosts' + && ['dimmableLight', 'light'].indexOf(getDevice(state, ownProps).kind) + === -1 ); }, }; diff --git a/smart-hut/src/endpoint.js b/smart-hut/src/endpoint.js index 6dbc3b0..32a15e7 100644 --- a/smart-hut/src/endpoint.js +++ b/smart-hut/src/endpoint.js @@ -3,17 +3,17 @@ * @returns {String} endpoint URL */ export function endpointURL() { - return window.BACKEND_URL !== "__BACKEND_URL__" + return window.BACKEND_URL !== '__BACKEND_URL__' ? window.BACKEND_URL - : "http://localhost:8080"; + : 'http://localhost:8080'; } export function socketURL(token) { const httpURL = new URL(endpointURL()); - const isSecure = httpURL.protocol === "https:"; - const protocol = isSecure ? "wss:" : "ws:"; + const isSecure = httpURL.protocol === 'https:'; + const protocol = isSecure ? 'wss:' : 'ws:'; const port = httpURL.port || (isSecure ? 443 : 80); const url = `${protocol}//${httpURL.hostname}:${port}/sensor-socket?token=${token}`; - console.log("socket url: ", url); + console.log('socket url: ', url); return url; } diff --git a/smart-hut/src/index.js b/smart-hut/src/index.js index 111847a..2aa57e9 100644 --- a/smart-hut/src/index.js +++ b/smart-hut/src/index.js @@ -1,9 +1,9 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import App from "./App"; -import * as serviceWorker from "./serviceWorker"; -import { Provider } from "react-redux"; -import smartHutStore from "./store"; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; +import App from './App'; +import * as serviceWorker from './serviceWorker'; +import smartHutStore from './store'; const index = ( @@ -11,5 +11,5 @@ const index = ( ); -ReactDOM.render(index, document.getElementById("root")); +ReactDOM.render(index, document.getElementById('root')); serviceWorker.unregister(); diff --git a/smart-hut/src/remote.js b/smart-hut/src/remote.js index 42a5841..582731a 100644 --- a/smart-hut/src/remote.js +++ b/smart-hut/src/remote.js @@ -1,8 +1,8 @@ -import smartHutStore from "./store"; -import actions from "./storeActions"; -import axios from "axios"; -import { endpointURL, socketURL } from "./endpoint"; -import { connect, disconnect } from "@giantmachines/redux-websocket"; +import axios from 'axios'; +import { connect, disconnect } from '@giantmachines/redux-websocket'; +import smartHutStore from './store'; +import actions from './storeActions'; +import { endpointURL, socketURL } from './endpoint'; /** * An object returned by promise rejections in remoteservice @@ -15,8 +15,8 @@ class RemoteError extends Error { constructor(messages) { super( messages && Array.isArray(messages) - ? messages.join(" - ") - : JSON.stringify(messages, null, 2) + ? messages.join(' - ') + : JSON.stringify(messages, null, 2), ); this.messages = messages; } @@ -45,23 +45,22 @@ const Endpoint = { */ send: (method, route, query = {}, body = null) => { if (!Endpoint.token) { - throw new Error("No token while performing authenticated request"); + throw new Error('No token while performing authenticated request'); } return Endpoint.axiosInstance(route, { - method: method, + method, params: query, - data: ["put", "post"].indexOf(method) !== -1 ? body : null, + data: ['put', 'post'].indexOf(method) !== -1 ? body : null, headers: { Authorization: `Bearer ${Endpoint.token}`, }, }).then((res) => { - if (!res.data && method !== "delete") { - console.error("Response body is empty"); + if (!res.data && method !== 'delete') { + console.error('Response body is empty'); return null; - } else { - return res; } + return res; }); }, @@ -72,20 +71,17 @@ const Endpoint = { * @param {[String]String} query query ('?') parameters (no params by default) * @param {any} body the JSON request body */ - sendNA: (method, route, query = {}, body = null) => { - return Endpoint.axiosInstance(route, { - method: method, + sendNA: (method, route, query = {}, body = null) => Endpoint.axiosInstance(route, { + method, params: query, - data: ["put", "post"].indexOf(method) !== -1 ? body : null, + data: ['put', 'post'].indexOf(method) !== -1 ? body : null, }).then((res) => { if (!res.data) { - console.error("Response body is empty"); + console.error('Response body is empty'); return null; - } else { - return res; } - }); - }, + return res; + }), /** * Performs login @@ -94,26 +90,24 @@ const Endpoint = { * @returns {Promise} promise that resolves to the token string * and rejects to the axios error. */ - login: (usernameOrEmail, password) => { - return Endpoint.axiosInstance - .post(`/auth/login`, { + login: (usernameOrEmail, password) => Endpoint.axiosInstance + .post('/auth/login', { usernameOrEmail, password, }) .then((res) => { - localStorage.setItem("token", res.data.jwttoken); - localStorage.setItem("exp", new Date().getTime() + 5 * 60 * 60 * 1000); + localStorage.setItem('token', res.data.jwttoken); + localStorage.setItem('exp', new Date().getTime() + 5 * 60 * 60 * 1000); return res.data.jwttoken; - }); - }, + }), /** * Returns an immediately resolved promise for the socket logouts * @return {Promise} An always-resolved promise */ logout: () => { - localStorage.removeItem("token"); - localStorage.removeItem("exp"); + localStorage.removeItem('token'); + localStorage.removeItem('exp'); return Promise.resolve(void 0); }, @@ -124,7 +118,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ get(route, query = {}) { - return this.send("get", route, query); + return this.send('get', route, query); }, /** @@ -135,7 +129,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ post(route, query, body) { - return this.send("post", route, query, body); + return this.send('post', route, query, body); }, /** @@ -146,7 +140,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ postNA(route, query, body) { - return this.sendNA("post", route, query, body); + return this.sendNA('post', route, query, body); }, /** @@ -157,7 +151,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ put(route, query = {}, body = {}) { - return this.send("put", route, query, body); + return this.send('put', route, query, body); }, /** @@ -168,7 +162,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ putNA(route, query = {}, body = {}) { - return this.sendNA("put", route, query, body); + return this.sendNA('put', route, query, body); }, /** @@ -179,7 +173,7 @@ const Endpoint = { * @returns {Promise<*, *>} The Axios-generated promise */ delete(route, query = {}) { - return this.send("delete", route, query); + return this.send('delete', route, query); }, }; @@ -191,17 +185,17 @@ const Endpoint = { */ function parseValidationErrors(err) { if ( - err.response && - err.response.status === 400 && - err.response.data && - Array.isArray(err.response.data.errors) + err.response + && err.response.status === 400 + && err.response.data + && Array.isArray(err.response.data.errors) ) { throw new RemoteError([ ...new Set(err.response.data.errors.map((e) => e.defaultMessage)), ]); } else { - console.warn("Non validation error", err); - throw new RemoteError(["Network error"]); + console.warn('Non validation error', err); + throw new RemoteError(['Network error']); } } @@ -213,64 +207,49 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - login: (usernameOrEmail, password) => { - return (dispatch) => { - return Endpoint.login(usernameOrEmail, password) + login: (usernameOrEmail, password) => (dispatch) => Endpoint.login(usernameOrEmail, password) .then((token) => { dispatch(actions.loginSuccess(token)); dispatch(connect(socketURL(token))); }) .catch((err) => { - console.warn("login error", err); + console.warn('login error', err); throw new RemoteError([ err.response && err.response.status === 401 - ? "Wrong credentials" - : "An error occurred while logging in", + ? 'Wrong credentials' + : 'An error occurred while logging in', ]); - }); - }; - }, + }), /** * Performs logout */ - logout: () => { - return (dispatch) => - Endpoint.logout().then(() => { + logout: () => (dispatch) => Endpoint.logout().then(() => { dispatch(disconnect()); dispatch(actions.logout()); - }); - }, + }), /** * Fetches user information via REST calls, if it is logged in * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - userPermissions: (data) => { - return (dispatch) => { - return Endpoint.put("/user/permissions", {}, data).catch((err) => { - console.warn("Fetch user info error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + userPermissions: (data) => (dispatch) => Endpoint.put('/user/permissions', {}, data).catch((err) => { + console.warn('Fetch user info error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches user information via REST calls, if it is logged in * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchUserInfo: () => { - return (dispatch) => { - return Endpoint.get("/auth/profile") + fetchUserInfo: () => (dispatch) => Endpoint.get('/auth/profile') .then((res) => void dispatch(actions.userInfoUpdate(res.data))) .catch((err) => { - console.warn("Fetch user info error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.warn('Fetch user info error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches all rooms that belong to this user. This call does not @@ -280,23 +259,18 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchAllRooms: (hostId = null) => { - return (dispatch) => { - return Endpoint.get("/room", hostId ? { hostId } : null) + fetchAllRooms: (hostId = null) => (dispatch) => Endpoint.get('/room', hostId ? { hostId } : null) .then( - (res) => - void dispatch( + (res) => void dispatch( hostId ? actions.hostRoomsUpdate(hostId, res.data) - : actions.roomsUpdate(res.data) - ) + : actions.roomsUpdate(res.data), + ), ) .catch((err) => { - console.error("Fetch all rooms error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.error('Fetch all rooms error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches all scenes that belong to this user. This call does not @@ -304,23 +278,18 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchAllScenes: (hostId = null) => { - return (dispatch) => { - return Endpoint.get("/scene", hostId ? { hostId } : {}) + fetchAllScenes: (hostId = null) => (dispatch) => Endpoint.get('/scene', hostId ? { hostId } : {}) .then( - (res) => - void dispatch( + (res) => void dispatch( !hostId ? actions.scenesUpdate(res.data) - : actions.hostScenesUpdate(hostId, res.data) - ) + : actions.hostScenesUpdate(hostId, res.data), + ), ) .catch((err) => { - console.error("Fetch all scenes error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.error('Fetch all scenes error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches all devices in a particular room, or fetches all devices. @@ -332,42 +301,33 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchDevices: (roomId = null, hostId = null) => { - return (dispatch) => { - return Endpoint.get( - roomId ? `/room/${roomId}/device` : "/device", - hostId ? { hostId } : null + fetchDevices: (roomId = null, hostId = null) => (dispatch) => Endpoint.get( + roomId ? `/room/${roomId}/device` : '/device', + hostId ? { hostId } : null, ) .then( - (res) => - void dispatch( + (res) => void dispatch( !hostId ? actions.devicesUpdate(roomId, res.data, hostId) - : actions.hostDevicesUpdate(hostId, res.data) - ) + : actions.hostDevicesUpdate(hostId, res.data), + ), ) .catch((err) => { console.error(`Fetch devices roomId=${roomId} error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + throw new RemoteError(['Network error']); + }), /** * Fetches all the automations * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchAutomations: () => { - return (dispatch) => { - return Endpoint.get("/automation/") + fetchAutomations: () => (dispatch) => Endpoint.get('/automation/') .then((res) => void dispatch(actions.automationsUpdate(res.data))) .catch((err) => { - console.error(`Fetch automations error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.error('Fetch automations error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches all devices in a particular scene, or fetches all devices. @@ -377,48 +337,36 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchStates: (sceneId) => { - return (dispatch) => { - return Endpoint.get(`/scene/${sceneId}/states`) + fetchStates: (sceneId) => (dispatch) => Endpoint.get(`/scene/${sceneId}/states`) .then((res) => void dispatch(actions.statesUpdate(sceneId, res.data))) .catch((err) => { console.error(`Fetch devices sceneId=${sceneId} error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + throw new RemoteError(['Network error']); + }), /** * Fetches all hosts of a particular user. * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchHosts: () => { - return (dispatch) => { - return Endpoint.get(`/user/hosts`) + fetchHosts: () => (dispatch) => Endpoint.get('/user/hosts') .then((res) => void dispatch(actions.hostsUpdate(res.data))) .catch((err) => { - console.error(`Fetch hosts error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.error('Fetch hosts error', err); + throw new RemoteError(['Network error']); + }), /** * Fetches all guests of a particular user. * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - fetchGuests: () => { - return (dispatch) => { - return Endpoint.get(`/user/guests`) + fetchGuests: () => (dispatch) => Endpoint.get('/user/guests') .then((res) => void dispatch(actions.guestsUpdate(res.data))) .catch((err) => { - console.error(`Fetch guests error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.error('Fetch guests error', err); + throw new RemoteError(['Network error']); + }), /** * Adds the current user as a guest to another user @@ -427,16 +375,12 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - updateGuests: (userIds) => { - return (dispatch) => { - return Endpoint.put(`/user/guests`, {}, { ids: userIds }) + updateGuests: (userIds) => (dispatch) => Endpoint.put('/user/guests', {}, { ids: userIds }) .then((res) => void dispatch(actions.guestsUpdate(res.data))) .catch((err) => { - console.error(`Guest save error`, err); - throw new RemoteError(["Network Error"]); - }); - }; - }, + console.error('Guest save error', err); + throw new RemoteError(['Network Error']); + }), /** * Creates/Updates a room with the given data @@ -447,8 +391,7 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - saveRoom: (data, roomId = null) => { - return (dispatch) => { + saveRoom: (data, roomId = null) => (dispatch) => { data = { name: data.name, icon: data.icon, @@ -457,12 +400,11 @@ export const RemoteService = { return (roomId ? Endpoint.put(`/room/${roomId}`, {}, data) - : Endpoint.post(`/room`, {}, data) + : Endpoint.post('/room', {}, data) ) .then((res) => void dispatch(actions.roomSave(res.data))) .catch(parseValidationErrors); - }; - }, + }, /** * Creates/Updates a scene with the given data @@ -473,8 +415,7 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - saveScene: (data, sceneId = null, copyFrom = null) => { - return (dispatch) => { + saveScene: (data, sceneId = null, copyFrom = null) => (dispatch) => { copyFrom = sceneId === null ? copyFrom : null; data = { name: data.name, @@ -484,7 +425,7 @@ export const RemoteService = { return (sceneId ? Endpoint.put(`/scene/${sceneId}`, {}, data) - : Endpoint.post(`/scene`, {}, data) + : Endpoint.post('/scene', {}, data) ) .then(async (res) => { let states = []; @@ -493,12 +434,12 @@ export const RemoteService = { const sceneId = res.data.id; try { const res = await Endpoint.post( - `/scene/${sceneId}/copyFrom/${copyFrom}` + `/scene/${sceneId}/copyFrom/${copyFrom}`, ); states = res.data; } catch (e) { - console.warn("Error in state cloning from scene " + copyFrom, e); - throw new RemoteError(["Network error"]); + console.warn(`Error in state cloning from scene ${copyFrom}`, e); + throw new RemoteError(['Network error']); } } @@ -508,16 +449,14 @@ export const RemoteService = { } }) .catch(parseValidationErrors); - }; - }, + }, - updateState: (data, type) => { - return (dispatch) => { + updateState: (data, type) => (dispatch) => { let url; if (data.on !== undefined) { - url = "/switchableState"; + url = '/switchableState'; } else { - url = "/dimmableState"; + url = '/dimmableState'; } return Endpoint.put(url, {}, data) @@ -526,50 +465,43 @@ export const RemoteService = { return res.data; }) .catch((err) => { - console.warn("Update device: ", data, "error: ", err); - throw new RemoteError(["Network error"]); + console.warn('Update device: ', data, 'error: ', err); + throw new RemoteError(['Network error']); }); - }; - }, + }, - deleteState: (id, type) => { - return (dispatch) => { + deleteState: (id, type) => (dispatch) => { let url; - if (type === "dimmableState") { - url = "/dimmableState"; + if (type === 'dimmableState') { + url = '/dimmableState'; } else { - url = "/switchableState"; + url = '/switchableState'; } - return Endpoint.delete(url + `/${id}`) + return Endpoint.delete(`${url}/${id}`) .then((_) => dispatch(actions.stateDelete(id))) .catch((err) => { - console.warn("state delete error", err); - throw new RemoteError(["Network error"]); + console.warn('state delete error', err); + throw new RemoteError(['Network error']); }); - }; - }, + }, - sceneApply: (id, hostId = null) => { - return (dispatch) => { + sceneApply: (id, hostId = null) => (dispatch) => { let url = `/scene/${id}/apply`; if (hostId) { - url = url + "?hostId=" + hostId; + url = `${url}?hostId=${hostId}`; } return Endpoint.post(url) - .then((res) => - dispatch( + .then((res) => dispatch( hostId ? actions.hostDevicesUpdate(hostId, res.data, true) - : actions.deviceOperationUpdate(res.data) - ) - ) + : actions.deviceOperationUpdate(res.data), + )) .catch((err) => { - console.warn("scene apply error", err); - throw new RemoteError(["Network error"]); + console.warn('scene apply error', err); + throw new RemoteError(['Network error']); }); - }; - }, + }, /** * Creates/Updates a device with the given data. If @@ -583,43 +515,37 @@ export const RemoteService = { * @returns {Promise} promise that resolves to the saved device and rejects * with user-fiendly errors as a RemoteError */ - saveDevice: (data, hostId = null) => { - return (dispatch) => { - let url = "/device"; - if ((data.id && data.flowType === "OUTPUT") || !data.id) { - url = "/" + data.kind; + saveDevice: (data, hostId = null) => (dispatch) => { + let url = '/device'; + if ((data.id && data.flowType === 'OUTPUT') || !data.id) { + url = `/${data.kind}`; } - return Endpoint[data.id ? "put" : "post"]( + return Endpoint[data.id ? 'put' : 'post']( url, hostId ? { hostId } : {}, - data + data, ) .then((res) => { dispatch( hostId ? actions.hostDeviceSave(hostId, res.data) - : actions.deviceSave(res.data) + : actions.deviceSave(res.data), ); return res.data; }) .catch((err) => { - console.warn("Update device: ", data, "error: ", err); - throw new RemoteError(["Network error"]); + console.warn('Update device: ', data, 'error: ', err); + throw new RemoteError(['Network error']); }); - }; - }, + }, - fastUpdateAutomation: (automation) => { - return (dispatch) => { - return Endpoint.put("/automation/fast", {}, automation) + fastUpdateAutomation: (automation) => (dispatch) => Endpoint.put('/automation/fast', {}, automation) .then((res) => dispatch(actions.automationSave(res.data))) .catch((err) => { - console.warn("Update automation: ", automation, "error: ", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.warn('Update automation: ', automation, 'error: ', err); + throw new RemoteError(['Network error']); + }), /** * Creates/Updates an automation with the given data. If @@ -631,68 +557,66 @@ export const RemoteService = { */ saveAutomation: (data) => { const { automation, triggerList, order } = data; - console.log("automation: ", automation, triggerList, order); + console.log('automation: ', automation, triggerList, order); automation.triggers = []; automation.scenes = []; return (dispatch) => { - let urlAutomation = "/automation"; - let urlBooleanTrigger = "/booleanTrigger"; - let urlRangeTrigger = "/rangeTrigger"; - let urlScenePriority = "/scenePriority"; + const urlAutomation = '/automation'; + const urlBooleanTrigger = '/booleanTrigger'; + const urlRangeTrigger = '/rangeTrigger'; + const urlScenePriority = '/scenePriority'; - let rangeTriggerList = triggerList.filter((trigger) => - trigger.hasOwnProperty("operand") - ); - let booleanTriggerList = triggerList.filter( - (trigger) => !trigger.hasOwnProperty("operand") + const rangeTriggerList = triggerList.filter((trigger) => trigger.hasOwnProperty('operand')); + const booleanTriggerList = triggerList.filter( + (trigger) => !trigger.hasOwnProperty('operand'), ); - return Endpoint["post"](urlAutomation, {}, automation).then( + return Endpoint.post(urlAutomation, {}, automation).then( async (automationRes) => { const { id } = automationRes.data; // Introduce the range triggers in the automation - for (let t of rangeTriggerList) { + for (const t of rangeTriggerList) { const trigger = { automationId: id, deviceId: t.device, operator: t.operand, range: t.value, }; - let resRange = await Endpoint.post(urlRangeTrigger, {}, trigger); + const resRange = await Endpoint.post(urlRangeTrigger, {}, trigger); automation.triggers.push(resRange.data); } - for (let t of booleanTriggerList) { + for (const t of booleanTriggerList) { const trigger = { automationId: id, deviceId: t.device, on: t.value, }; - let resBoolean = await Endpoint.post( + const resBoolean = await Endpoint.post( urlBooleanTrigger, {}, - trigger + trigger, ); automation.triggers.push(resBoolean.data); - console.log("TRIGGERS: ", automation); + console.log('TRIGGERS: ', automation); } - for (let [priority, sceneId] of order.entries()) { + for (const [priority, sceneId] of order.entries()) { const scenePriority = { automationId: id, priority, sceneId, }; - let resScenes = await Endpoint["post"]( + const resScenes = await Endpoint.post( urlScenePriority, {}, - scenePriority + scenePriority, ); automation.scenes.push(resScenes.data); } automation.id = id; dispatch(actions.automationSave(automation)); - } + }, ); }; }, @@ -709,22 +633,19 @@ export const RemoteService = { * @returns {Promise} promise that resolves to the saved device and rejects * with user-fiendly errors as a RemoteError */ - saveState: (data) => { - return (dispatch) => { - let url = - "/" + data.kind + "/" + data.id + "/state?sceneId=" + data.sceneId; + saveState: (data) => (dispatch) => { + const url = `/${data.kind}/${data.id}/state?sceneId=${data.sceneId}`; - return Endpoint["post"](url, {}, data) + return Endpoint.post(url, {}, data) .then((res) => { dispatch(actions.stateSave(res.data)); return res.data; }) .catch((err) => { - console.warn("Update device: ", data, "error: ", err); - throw new RemoteError(["Network error"]); + console.warn('Update device: ', data, 'error: ', err); + throw new RemoteError(['Network error']); }); - }; - }, + }, /** * Connetcs a series of output devices to an input device. @@ -739,9 +660,8 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - connectOutputs: (newDevice, outputs) => { - return (dispatch) => { - let url = `/${newDevice.kind}/${newDevice.id}/lights`; + connectOutputs: (newDevice, outputs) => (dispatch) => { + const url = `/${newDevice.kind}/${newDevice.id}/lights`; return Endpoint.post(url, {}, outputs) .then((res) => { @@ -750,34 +670,29 @@ export const RemoteService = { }) .catch((err) => { console.warn( - "ConnectOutputs of ", + 'ConnectOutputs of ', newDevice.id, - " with outputs: ", + ' with outputs: ', outputs, - "error: ", - err + 'error: ', + err, ); - throw new RemoteError(["Network error"]); + throw new RemoteError(['Network error']); }); - }; - }, + }, - _operateInput: (url, getUrl, action) => { - return (dispatch) => { - return Endpoint.put(url, {}, action) + _operateInput: (url, getUrl, action) => (dispatch) => Endpoint.put(url, {}, action) .then(async (res) => { const inputDevice = await Endpoint.get(getUrl); delete inputDevice.outputs; dispatch( - actions.deviceOperationUpdate([...res.data, inputDevice.data]) + actions.deviceOperationUpdate([...res.data, inputDevice.data]), ); }) .catch((err) => { console.warn(`${url} error`, err); - throw new RemoteError(["Network error"]); - }); - }; - }, + throw new RemoteError(['Network error']); + }), /** * Changes the state of a switch, by turning it on, off or toggling it. @@ -789,16 +704,14 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - switchOperate: (switchId, type) => { - return RemoteService._operateInput( - "/switch/operate", + switchOperate: (switchId, type) => RemoteService._operateInput( + '/switch/operate', `/switch/${switchId}`, { type: type.toUpperCase(), id: switchId, - } - ); - }, + }, + ), /** * Turns a knob dimmer to a specific amount @@ -808,16 +721,14 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - knobDimmerDimTo: (dimmerId, intensity) => { - return RemoteService._operateInput( - "/knobDimmer/dimTo", + knobDimmerDimTo: (dimmerId, intensity) => RemoteService._operateInput( + '/knobDimmer/dimTo', `/knobDimmer/${dimmerId}`, { intensity, id: dimmerId, - } - ); - }, + }, + ), /** * Turns a button dimmer up or down @@ -829,16 +740,14 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - buttonDimmerDim: (dimmerId, dimType) => { - return RemoteService._operateInput( - "/buttonDimmer/dim", + buttonDimmerDim: (dimmerId, dimType) => RemoteService._operateInput( + '/buttonDimmer/dim', `/buttonDimmer/${dimmerId}`, { dimType, id: dimmerId, - } - ); - }, + }, + ), /** * Resets the meter on a smart plug @@ -848,14 +757,12 @@ export const RemoteService = { * with user-fiendly errors as a RemoteError */ smartPlugReset(smartPlugId) { - return (dispatch) => { - return Endpoint.delete(`/smartPlug/${smartPlugId}/meter`) + return (dispatch) => Endpoint.delete(`/smartPlug/${smartPlugId}/meter`) .then((res) => dispatch(actions.deviceOperationUpdate([res.data]))) .catch((err) => { - console.warn(`Smartplug reset error`, err); - throw new RemoteError(["Network error"]); + console.warn('Smartplug reset error', err); + throw new RemoteError(['Network error']); }); - }; }, /** * Deletes a room @@ -863,27 +770,21 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - deleteRoom: (roomId) => { - return (dispatch) => { - return Endpoint.delete(`/room/${roomId}`) + deleteRoom: (roomId) => (dispatch) => Endpoint.delete(`/room/${roomId}`) .then((_) => dispatch(actions.roomDelete(roomId))) .catch((err) => { - console.warn("Room deletion error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.warn('Room deletion error', err); + throw new RemoteError(['Network error']); + }), deleteAutomation: (id) => { - console.log("ID OF AUTO ", id); - return (dispatch) => { - return Endpoint.delete(`/automation/${id}`) + console.log('ID OF AUTO ', id); + return (dispatch) => Endpoint.delete(`/automation/${id}`) .then((_) => dispatch(actions.automationDelete(id))) .catch((err) => { - console.warn("Automation deletion error", err); - throw new RemoteError(["Network error"]); + console.warn('Automation deletion error', err); + throw new RemoteError(['Network error']); }); - }; }, /** @@ -892,16 +793,12 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - deleteScene: (sceneId) => { - return (dispatch) => { - return Endpoint.delete(`/scene/${sceneId}`) + deleteScene: (sceneId) => (dispatch) => Endpoint.delete(`/scene/${sceneId}`) .then((_) => dispatch(actions.sceneDelete(sceneId))) .catch((err) => { - console.warn("Scene deletion error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.warn('Scene deletion error', err); + throw new RemoteError(['Network error']); + }), /** * Deletes a device @@ -909,16 +806,12 @@ export const RemoteService = { * @returns {Promise} promise that resolves to void and rejects * with user-fiendly errors as a RemoteError */ - deleteDevice: (device) => { - return (dispatch) => { - return Endpoint.delete(`/${device.kind}/${device.id}`) + deleteDevice: (device) => (dispatch) => Endpoint.delete(`/${device.kind}/${device.id}`) .then((_) => dispatch(actions.deviceDelete(device.id))) .catch((err) => { - console.warn("Device deletion error", err); - throw new RemoteError(["Network error"]); - }); - }; - }, + console.warn('Device deletion error', err); + throw new RemoteError(['Network error']); + }), }; for (const key in RemoteService) { @@ -927,11 +820,11 @@ for (const key in RemoteService) { export class Forms { static fetchAllUsers() { - return Endpoint.get(`/user`) + return Endpoint.get('/user') .then((res) => res.data) .catch((err) => { - console.error(`Fetch users error`, err); - throw new RemoteError(["Network error"]); + console.error('Fetch users error', err); + throw new RemoteError(['Network error']); }); } @@ -948,14 +841,14 @@ export class Forms { */ static submitRegistration(data) { return Endpoint.postNA( - "/register", + '/register', {}, { username: data.username, password: data.password, name: data.name, email: data.email, - } + }, ) .then((_) => void 0) .catch(parseValidationErrors); @@ -971,16 +864,16 @@ export class Forms { */ static submitInitResetPassword(email) { return Endpoint.postNA( - "/register/init-reset-password", + '/register/init-reset-password', {}, { - email: email, - } + email, + }, ) .then((_) => void 0) .catch((err) => { - console.warn("Init reset password failed", err); - throw new RemoteError(["Network error"]); + console.warn('Init reset password failed', err); + throw new RemoteError(['Network error']); }); } @@ -996,12 +889,12 @@ export class Forms { */ static submitResetPassword(confirmationToken, password) { return Endpoint.putNA( - "/register/reset-password", + '/register/reset-password', {}, { confirmationToken, password, - } + }, ) .then((_) => void 0) .catch(parseValidationErrors); diff --git a/smart-hut/src/serviceWorker.js b/smart-hut/src/serviceWorker.js index c7cd666..a034430 100644 --- a/smart-hut/src/serviceWorker.js +++ b/smart-hut/src/serviceWorker.js @@ -11,17 +11,17 @@ // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( - window.location.hostname === "localhost" || + window.location.hostname === 'localhost' // [::1] is the IPv6 localhost address. - window.location.hostname === "[::1]" || + || window.location.hostname === '[::1]' // 127.0.0.0/8 are considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + || window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/, + ), ); export function register(config) { - if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { @@ -31,7 +31,7 @@ export function register(config) { return; } - window.addEventListener("load", () => { + window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { @@ -42,8 +42,8 @@ export function register(config) { // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( - "This web app is being served cache-first by a service " + - "worker. To learn more, visit https://bit.ly/CRA-PWA" + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://bit.ly/CRA-PWA', ); }); } else { @@ -64,14 +64,14 @@ function registerValidSW(swUrl, config) { return; } installingWorker.onstatechange = () => { - if (installingWorker.state === "installed") { + if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( - "New content is available and will be used when all " + - "tabs for this page are closed. See https://bit.ly/CRA-PWA." + 'New content is available and will be used when all ' + + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.', ); // Execute callback @@ -82,7 +82,7 @@ function registerValidSW(swUrl, config) { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. - console.log("Content is cached for offline use."); + console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { @@ -94,21 +94,21 @@ function registerValidSW(swUrl, config) { }; }) .catch((error) => { - console.error("Error during service worker registration:", error); + console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl, { - headers: { "Service-Worker": "script" }, + headers: { 'Service-Worker': 'script' }, }) .then((response) => { // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get("content-type"); + const contentType = response.headers.get('content-type'); if ( - response.status === 404 || - (contentType != null && contentType.indexOf("javascript") === -1) + response.status === 404 + || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then((registration) => { @@ -123,13 +123,13 @@ function checkValidServiceWorker(swUrl, config) { }) .catch(() => { console.log( - "No internet connection found. App is running in offline mode." + 'No internet connection found. App is running in offline mode.', ); }); } export function unregister() { - if ("serviceWorker" in navigator) { + if ('serviceWorker' in navigator) { navigator.serviceWorker.ready .then((registration) => { registration.unregister(); diff --git a/smart-hut/src/setupTests.js b/smart-hut/src/setupTests.js index 5fdf001..74b1a27 100644 --- a/smart-hut/src/setupTests.js +++ b/smart-hut/src/setupTests.js @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom/extend-expect"; +import '@testing-library/jest-dom/extend-expect'; diff --git a/smart-hut/src/store.js b/smart-hut/src/store.js index ecfa94a..60b9e9f 100644 --- a/smart-hut/src/store.js +++ b/smart-hut/src/store.js @@ -1,11 +1,12 @@ -import { createStore, applyMiddleware, compose } from "redux"; -import thunk from "redux-thunk"; -import update from "immutability-helper"; -import reduxWebSocket, { connect } from "@giantmachines/redux-websocket"; -import { socketURL } from "./endpoint"; +import { createStore, applyMiddleware, compose } from 'redux'; +import thunk from 'redux-thunk'; +import update from 'immutability-helper'; +import reduxWebSocket, { connect } from '@giantmachines/redux-websocket'; +import { socketURL } from './endpoint'; function reducer(previousState, action) { - let newState, change; + let newState; let +change; const createOrUpdateRoom = (room) => { if (!newState.rooms[room.id]) { @@ -89,21 +90,21 @@ function reducer(previousState, action) { }; switch (action.type) { - case "LOGIN_UPDATE": + case 'LOGIN_UPDATE': newState = update(previousState, { login: { $set: action.login } }); break; - case "USER_INFO_UPDATE": + case 'USER_INFO_UPDATE': newState = update(previousState, { userInfo: { $set: action.userInfo }, }); break; - case "ROOMS_UPDATE": + case 'ROOMS_UPDATE': newState = previousState; for (const room of action.rooms) { createOrUpdateRoom(room); } break; - case "HOST_ROOMS_UPDATE": + case 'HOST_ROOMS_UPDATE': change = { hostRooms: { [action.hostId]: { $set: {} }, @@ -117,13 +118,13 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "SCENES_UPDATE": + case 'SCENES_UPDATE': newState = previousState; for (const scene of action.scenes) { createOrUpdateScene(scene); } break; - case "HOST_SCENES_UPDATE": + case 'HOST_SCENES_UPDATE': change = { hostScenes: { [action.hostId]: { $set: action.scenes }, // stored as array @@ -132,8 +133,8 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "STATES_UPDATE": - //console.log(action.sceneStates); + case 'STATES_UPDATE': + // console.log(action.sceneStates); change = null; // if scene is given, delete all sceneStates in that scene @@ -169,11 +170,9 @@ function reducer(previousState, action) { } if (sceneState.sceneId in newState.scenes) { - change.scenes[sceneState.sceneId] = - change.scenes[sceneState.sceneId] || {}; - change.scenes[sceneState.sceneId].sceneStates = - change.scenes[sceneState.sceneId].sceneStates || {}; - const sceneStates = change.scenes[sceneState.sceneId].sceneStates; + change.scenes[sceneState.sceneId] = change.scenes[sceneState.sceneId] || {}; + change.scenes[sceneState.sceneId].sceneStates = change.scenes[sceneState.sceneId].sceneStates || {}; + const { sceneStates } = change.scenes[sceneState.sceneId]; sceneStates.$add = sceneStates.$add || []; sceneStates.$add.push(sceneState.id); } else { @@ -186,7 +185,7 @@ function reducer(previousState, action) { }; } else { change.pendingJoins.scenes[sceneState.sceneId].$set.add( - sceneState.id + sceneState.id, ); } } @@ -195,7 +194,7 @@ function reducer(previousState, action) { newState = update(newState, change); break; - case "DEVICES_UPDATE": + case 'DEVICES_UPDATE': change = null; // if room is given, delete all devices in that room @@ -225,7 +224,7 @@ function reducer(previousState, action) { for (const device of action.devices) { if (!previousState.devices[device.id]) continue; change.devices.$unset.push(device.id); - const roomId = previousState.devices[device.id].roomId; + const { roomId } = previousState.devices[device.id]; if (roomId in previousState.rooms) { change.rooms[roomId] = change.rooms[roomId] || { @@ -265,9 +264,8 @@ function reducer(previousState, action) { if (device.roomId in newState.rooms) { change.rooms[device.roomId] = change.rooms[device.roomId] || {}; - change.rooms[device.roomId].devices = - change.rooms[device.roomId].devices || {}; - const devices = change.rooms[device.roomId].devices; + change.rooms[device.roomId].devices = change.rooms[device.roomId].devices || {}; + const { devices } = change.rooms[device.roomId]; devices.$add = devices.$add || []; devices.$add.push(device.id); } else { @@ -286,14 +284,13 @@ function reducer(previousState, action) { newState = update(newState, change); break; - case "HOST_DEVICES_UPDATE": + case 'HOST_DEVICES_UPDATE': newState = action.partial ? previousState : update(previousState, { hostDevices: { [action.hostId]: { $set: {} } }, }); - newState.hostDevices[action.hostId] = - newState.hostDevices[action.hostId] || {}; + newState.hostDevices[action.hostId] = newState.hostDevices[action.hostId] || {}; change = { hostDevices: { [action.hostId]: {}, @@ -307,7 +304,7 @@ function reducer(previousState, action) { newState = update(newState, change); break; - case "AUTOMATION_UPDATE": + case 'AUTOMATION_UPDATE': const automations = {}; for (const automation of action.automations) { automations[automation.id] = automation; @@ -318,15 +315,15 @@ function reducer(previousState, action) { }; newState = update(previousState, change); break; - case "ROOM_SAVE": + case 'ROOM_SAVE': newState = previousState; createOrUpdateRoom(action.room); break; - case "SCENE_SAVE": + case 'SCENE_SAVE': newState = previousState; createOrUpdateScene(action.scene); break; - case "DEVICE_SAVE": + case 'DEVICE_SAVE': change = { devices: { [action.device.id]: { $set: action.device } }, }; @@ -350,7 +347,7 @@ function reducer(previousState, action) { } newState = update(previousState, change); break; - case "HOST_DEVICE_SAVE": + case 'HOST_DEVICE_SAVE': change = { hostDevices: { [action.hostId]: { @@ -362,7 +359,7 @@ function reducer(previousState, action) { }; newState = update(previousState, change); break; - case "HOST_DEVICES_DELETE": + case 'HOST_DEVICES_DELETE': change = { hostDevices: { [action.hostId]: { @@ -373,7 +370,7 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "AUTOMATION_SAVE": + case 'AUTOMATION_SAVE': change = { automations: { [action.automation.id]: { $set: action.automation }, @@ -384,7 +381,7 @@ function reducer(previousState, action) { break; - case "STATE_SAVE": + case 'STATE_SAVE': change = { sceneStates: { [action.sceneState.id]: { $set: action.sceneState }, @@ -410,7 +407,7 @@ function reducer(previousState, action) { } newState = update(previousState, change); break; - case "ROOM_DELETE": + case 'ROOM_DELETE': if (!(action.roomId in previousState.rooms)) { console.warn(`Room to delete ${action.roomId} does not exist`); break; @@ -434,14 +431,14 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "AUTOMATION_DELETE": + case 'AUTOMATION_DELETE': change = { automations: { $unset: [action.id] }, }; newState = update(previousState, change); break; - case "SCENE_DELETE": + case 'SCENE_DELETE': if (!(action.sceneId in previousState.scenes)) { console.warn(`Scene to delete ${action.sceneId} does not exist`); break; @@ -464,7 +461,7 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "STATE_DELETE": + case 'STATE_DELETE': if (!(action.stateId in previousState.sceneStates)) { console.warn(`State to delete ${action.stateId} does not exist`); break; @@ -487,7 +484,7 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "DEVICE_DELETE": + case 'DEVICE_DELETE': if (!(action.deviceId in previousState.devices)) { console.warn(`Device to delete ${action.deviceId} does not exist`); break; @@ -507,10 +504,10 @@ function reducer(previousState, action) { newState = update(previousState, change); break; - case "LOGOUT": + case 'LOGOUT': newState = update(initState, {}); break; - case "SET_ACTIVE": + case 'SET_ACTIVE': newState = update(previousState, { active: { [action.key]: { @@ -519,17 +516,16 @@ function reducer(previousState, action) { }, }); break; - case "REDUX_WEBSOCKET::MESSAGE": + case 'REDUX_WEBSOCKET::MESSAGE': const allDevices = JSON.parse(action.payload.message); const devices = allDevices.filter( - (d) => - (d.fromHostId === null || d.fromHostId === undefined) && !d.deleted + (d) => (d.fromHostId === null || d.fromHostId === undefined) && !d.deleted, ); const hostDevicesMapByHostId = allDevices .filter((d) => d.fromHostId) .reduce((a, e) => { const hostId = e.fromHostId; - //delete e.fromHostId; + // delete e.fromHostId; a[hostId] = a[hostId] || { updated: [], deletedIds: [] }; if (e.deleted) { a[hostId].deletedIds.push(e.id); @@ -539,21 +535,22 @@ function reducer(previousState, action) { return a; }, {}); newState = reducer(previousState, { - type: "DEVICES_UPDATE", + type: 'DEVICES_UPDATE', partial: true, devices, }); for (const hostId in hostDevicesMapByHostId) { - if (hostDevicesMapByHostId[hostId].updated.length > 0) - newState = reducer(newState, { - type: "HOST_DEVICES_UPDATE", + if (hostDevicesMapByHostId[hostId].updated.length > 0) { + newState = reducer(newState, { + type: 'HOST_DEVICES_UPDATE', devices: hostDevicesMapByHostId[hostId].updated, partial: true, hostId, }); +} if (hostDevicesMapByHostId[hostId].deletedIds.length > 0) { newState = reducer(newState, { - type: "HOST_DEVICES_DELETE", + type: 'HOST_DEVICES_DELETE', deviceIds: hostDevicesMapByHostId[hostId].deletedIds, partial: true, hostId, @@ -561,7 +558,7 @@ function reducer(previousState, action) { } } break; - case "HG_UPDATE": + case 'HG_UPDATE': newState = update(previousState, { [action.key]: { $set: action.value }, }); @@ -581,7 +578,7 @@ const initState = { }, active: { activeRoom: -1, - activeTab: "Devices", + activeTab: 'Devices', activeScene: -1, activeAutomation: -1, activeHost: -1, @@ -613,8 +610,8 @@ const initState = { }; function createSmartHutStore() { - const token = localStorage.getItem("token"); - const exp = localStorage.getItem("exp"); + const token = localStorage.getItem('token'); + const exp = localStorage.getItem('exp'); const initialState = update(initState, { login: { @@ -624,15 +621,15 @@ function createSmartHutStore() { }); if (!initialState.login.loggedIn) { - localStorage.removeItem("token"); - localStorage.removeItem("exp"); + localStorage.removeItem('token'); + localStorage.removeItem('exp'); initialState.login.token = null; } const store = createStore( reducer, initialState, - compose(applyMiddleware(thunk), applyMiddleware(reduxWebSocket())) + compose(applyMiddleware(thunk), applyMiddleware(reduxWebSocket())), ); if (initialState.login.loggedIn) { store.dispatch(connect(socketURL(token))); diff --git a/smart-hut/src/storeActions.js b/smart-hut/src/storeActions.js index 6a4e4e4..77ca199 100644 --- a/smart-hut/src/storeActions.js +++ b/smart-hut/src/storeActions.js @@ -1,134 +1,134 @@ const actions = { loginSuccess: (token) => ({ - type: "LOGIN_UPDATE", + type: 'LOGIN_UPDATE', login: { loggedIn: true, token, }, }), logout: () => ({ - type: "LOGOUT", + type: 'LOGOUT', }), userInfoUpdate: (userInfo) => ({ - type: "USER_INFO_UPDATE", + type: 'USER_INFO_UPDATE', userInfo, }), roomSave: (room) => ({ - type: "ROOM_SAVE", + type: 'ROOM_SAVE', room, }), sceneSave: (scene) => ({ - type: "SCENE_SAVE", + type: 'SCENE_SAVE', scene, }), deviceSave: (device) => ({ - type: "DEVICE_SAVE", + type: 'DEVICE_SAVE', device, }), hostDeviceSave: (hostId, device) => ({ - type: "HOST_DEVICE_SAVE", + type: 'HOST_DEVICE_SAVE', hostId, device, }), triggerSave: (automation) => ({ - type: "TRIGGER_SAVE", + type: 'TRIGGER_SAVE', automation, }), scenePrioritySave: (automation) => ({ - type: "SCENE_PRIORITY_SAVE", + type: 'SCENE_PRIORITY_SAVE', automation, }), automationSave: (automation) => ({ - type: "AUTOMATION_SAVE", + type: 'AUTOMATION_SAVE', automation, }), automationsUpdate: (automations) => ({ - type: "AUTOMATION_UPDATE", + type: 'AUTOMATION_UPDATE', automations, }), stateSave: (sceneState) => ({ - type: "STATE_SAVE", + type: 'STATE_SAVE', sceneState, }), statesUpdate: (sceneId, sceneStates) => ({ - type: "STATES_UPDATE", + type: 'STATES_UPDATE', sceneId, sceneStates, }), devicesUpdate: (roomId, devices, partial = false) => ({ - type: "DEVICES_UPDATE", + type: 'DEVICES_UPDATE', roomId, devices, partial, }), hostDevicesUpdate: (hostId, devices, partial = false) => ({ - type: "HOST_DEVICES_UPDATE", + type: 'HOST_DEVICES_UPDATE', hostId, partial, devices, }), stateDelete: (stateId) => ({ - type: "STATE_DELETE", + type: 'STATE_DELETE', stateId, }), deviceOperationUpdate: (devices) => ({ - type: "DEVICES_UPDATE", + type: 'DEVICES_UPDATE', devices, partial: true, }), roomsUpdate: (rooms) => ({ - type: "ROOMS_UPDATE", + type: 'ROOMS_UPDATE', rooms, }), hostRoomsUpdate: (hostId, rooms) => ({ - type: "HOST_ROOMS_UPDATE", + type: 'HOST_ROOMS_UPDATE', hostId, rooms, }), roomDelete: (roomId) => ({ - type: "ROOM_DELETE", + type: 'ROOM_DELETE', roomId, }), automationDelete: (id) => ({ - type: "AUTOMATION_DELETE", + type: 'AUTOMATION_DELETE', id, }), sceneDelete: (sceneId) => ({ - type: "SCENE_DELETE", + type: 'SCENE_DELETE', sceneId, }), scenesUpdate: (scenes) => ({ - type: "SCENES_UPDATE", + type: 'SCENES_UPDATE', scenes, }), hostScenesUpdate: (hostId, scenes) => ({ - type: "HOST_SCENES_UPDATE", + type: 'HOST_SCENES_UPDATE', hostId, scenes, }), deviceDelete: (deviceId) => ({ - type: "DEVICE_DELETE", + type: 'DEVICE_DELETE', deviceId, }), hostsUpdate: (hosts) => ({ - type: "HG_UPDATE", - key: "hosts", + type: 'HG_UPDATE', + key: 'hosts', value: hosts, }), guestsUpdate: (hosts) => ({ - type: "HG_UPDATE", - key: "guests", + type: 'HG_UPDATE', + key: 'guests', value: hosts, }), getHostDevices: (host) => ({ - type: "GET_HOST_DEVICES", + type: 'GET_HOST_DEVICES', host, }), guestUpdate: (guests) => ({ - type: "HG_UPDATE", - key: "guests", + type: 'HG_UPDATE', + key: 'guests', value: guests, }), }; @@ -136,23 +136,23 @@ const actions = { export const appActions = { // -1 for home view setActiveRoom: (activeRoom = -1) => ({ - type: "SET_ACTIVE", - key: "activeRoom", + type: 'SET_ACTIVE', + key: 'activeRoom', value: activeRoom, }), setActiveTab: (activeTab) => ({ - type: "SET_ACTIVE", - key: "activeTab", + type: 'SET_ACTIVE', + key: 'activeTab', value: activeTab, }), setActiveScene: (activeScene = -1) => ({ - type: "SET_ACTIVE", - key: "activeScene", + type: 'SET_ACTIVE', + key: 'activeScene', value: activeScene, }), setActiveHost: (activeHost = -1) => ({ - type: "SET_ACTIVE", - key: "activeHost", + type: 'SET_ACTIVE', + key: 'activeHost', value: activeHost, }), }; diff --git a/smart-hut/src/views/Confirm.js b/smart-hut/src/views/Confirm.js index 463e66a..2003fdf 100644 --- a/smart-hut/src/views/Confirm.js +++ b/smart-hut/src/views/Confirm.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Image, Grid, @@ -6,31 +6,34 @@ import { Icon, Header, Container, -} from "semantic-ui-react"; +} from 'semantic-ui-react'; export default class Confirm extends Component { render() { return ( - -
- Congratulation! + + {' '} +Congratulation!

{this.props.msg}

-
+ ); } } diff --git a/smart-hut/src/views/ConfirmForgotPassword.js b/smart-hut/src/views/ConfirmForgotPassword.js index c025a75..7459df7 100644 --- a/smart-hut/src/views/ConfirmForgotPassword.js +++ b/smart-hut/src/views/ConfirmForgotPassword.js @@ -1,8 +1,7 @@ -import React, { Component } from "react"; -import Confirm from "./Confirm"; +import React, { Component } from 'react'; +import Confirm from './Confirm'; -const msg = - "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; +const msg = "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; export default class ConfirmForgotPasswrod extends Component { render() { return ; diff --git a/smart-hut/src/views/ConfirmRegistration.js b/smart-hut/src/views/ConfirmRegistration.js index 1eb3c12..8c13b3a 100644 --- a/smart-hut/src/views/ConfirmRegistration.js +++ b/smart-hut/src/views/ConfirmRegistration.js @@ -1,8 +1,7 @@ -import React, { Component } from "react"; -import Confirm from "./Confirm"; +import React, { Component } from 'react'; +import Confirm from './Confirm'; -const msg = - "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; +const msg = "An E-mail has been sent to your address, confirm your registration by following the enclosed link. If you don't find the E-mail please check also the spam folder."; export default class ConfirmRegistration extends Component { render() { return ; diff --git a/smart-hut/src/views/ConfirmResetPassword.js b/smart-hut/src/views/ConfirmResetPassword.js index c11ab29..798e9af 100644 --- a/smart-hut/src/views/ConfirmResetPassword.js +++ b/smart-hut/src/views/ConfirmResetPassword.js @@ -1,6 +1,7 @@ -import React, { Component } from "react"; -import Confirm from "./Confirm"; -const msg = "Your password has been successfully reset."; +import React, { Component } from 'react'; +import Confirm from './Confirm'; + +const msg = 'Your password has been successfully reset.'; export default class ConfirmResetPassword extends Component { render() { diff --git a/smart-hut/src/views/Dashboard.js b/smart-hut/src/views/Dashboard.js index cac1298..4cb70b9 100644 --- a/smart-hut/src/views/Dashboard.js +++ b/smart-hut/src/views/Dashboard.js @@ -1,24 +1,26 @@ -import React, { Component } from "react"; -import DevicePanel from "../components/dashboard/DevicePanel"; -import ScenesPanel from "../components/dashboard/ScenesPanel"; -import AutomationsPanel from "../components/dashboard/AutomationsPanel"; -import HostsPanel from "../components/dashboard/HostsPanel"; -import Navbar from "./Navbar"; -import ScenesNavbar from "./ScenesNavbar"; -import HostsNavbar from "./HostsNavbar"; -import MyHeader from "../components/HeaderController"; -import { Grid, Responsive, Button, Menu } from "semantic-ui-react"; -import { mobilePanelStyle } from "../components/dashboard/devices/styleComponents"; +import React, { Component } from 'react'; +import { + Grid, Responsive, Button, Menu, +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import DevicePanel from '../components/dashboard/DevicePanel'; +import ScenesPanel from '../components/dashboard/ScenesPanel'; +import AutomationsPanel from '../components/dashboard/AutomationsPanel'; +import HostsPanel from '../components/dashboard/HostsPanel'; +import Navbar from './Navbar'; +import ScenesNavbar from './ScenesNavbar'; +import HostsNavbar from './HostsNavbar'; +import MyHeader from '../components/HeaderController'; +import { mobilePanelStyle } from '../components/dashboard/devices/styleComponents'; -import { RemoteService } from "../remote"; -import { connect } from "react-redux"; -import { appActions } from "../storeActions"; +import { RemoteService } from '../remote'; +import { appActions } from '../storeActions'; class Dashboard extends Component { constructor(props) { super(props); this.state = this.initialState; - this.activeTab = "Devices"; + this.activeTab = 'Devices'; this.selectTab = this.selectTab.bind(this); } @@ -47,13 +49,13 @@ class Dashboard extends Component { renderTab(tab) { switch (tab) { - case "Devices": + case 'Devices': return ; - case "Scenes": + case 'Scenes': return ; - case "Automations": + case 'Automations': return ; - case "Hosts": + case 'Hosts': return ; default: return

ERROR

; @@ -62,11 +64,11 @@ class Dashboard extends Component { renderNavbar(tab) { switch (tab) { - case "Devices": + case 'Devices': return ; - case "Scenes": + case 'Scenes': return ; - case "Hosts": + case 'Hosts': return ; default: return

ERROR

; @@ -74,21 +76,21 @@ class Dashboard extends Component { } get hasNavbar() { - return this.state.activeTab !== "Automations"; + return this.state.activeTab !== 'Automations'; } render() { // needed to correctly assign the background image - //in case a room has one. + // in case a room has one. let backgroundImageHelper; - if (this.activeTab === "Devices") { + if (this.activeTab === 'Devices') { backgroundImageHelper = this.props.backgroundImage; } else { backgroundImageHelper = null; } - //console.log("helper is",helper) + // console.log("helper is",helper) return ( -
+
@@ -102,25 +104,25 @@ class Dashboard extends Component {
@@ -134,13 +136,13 @@ class Dashboard extends Component {
{this.renderTab(this.activeTab)} @@ -162,33 +164,33 @@ class Dashboard extends Component { basic name="Devices" content="Devices" - active={this.activeTab === "Devices"} - color={this.activeTab === "Devices" ? "yellow" : "grey"} + active={this.activeTab === 'Devices'} + color={this.activeTab === 'Devices' ? 'yellow' : 'grey'} onClick={this.selectTab} /> ); } diff --git a/smart-hut/src/views/Forgot-password.js b/smart-hut/src/views/Forgot-password.js index bf3064e..47797c4 100644 --- a/smart-hut/src/views/Forgot-password.js +++ b/smart-hut/src/views/Forgot-password.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Button, Form, @@ -7,15 +7,15 @@ import { Image, Icon, Message, -} from "semantic-ui-react"; -import { Redirect } from "react-router-dom"; -import { Forms } from "../remote"; +} from 'semantic-ui-react'; +import { Redirect } from 'react-router-dom'; +import { Forms } from '../remote'; export default class ForgotPass extends Component { constructor(props) { super(props); this.state = { - user: "", + user: '', error: { state: false, message: [], @@ -27,8 +27,8 @@ export default class ForgotPass extends Component { } onChangeHandler = (event) => { - let nam = event.target.name; - let val = event.target.value; + const nam = event.target.name; + const val = event.target.value; this.setState({ [nam]: val }); }; @@ -37,9 +37,7 @@ export default class ForgotPass extends Component { Forms.submitInitResetPassword(this.state.user) .then(() => this.setState({ success: true })) - .catch((err) => - this.setState({ error: { state: true, message: err.messages } }) - ); + .catch((err) => this.setState({ error: { state: true, message: err.messages } })); }; handleChangePassword = (e) => { @@ -47,18 +45,16 @@ export default class ForgotPass extends Component { this.setState({ error: { state: true, - message: "Passwords do not match.", + message: 'Passwords do not match.', }, }); } Forms.submitResetPassword(this.props.query.token, this.state.password) .then(() => this.setState({ success: true })) - .catch((err) => - this.setState({ - error: { state: true, message: err.messages.join(" - ") }, - }) - ); + .catch((err) => this.setState({ + error: { state: true, message: err.messages.join(' - ') }, + })); }; render() { @@ -67,23 +63,26 @@ export default class ForgotPass extends Component { return ; } return ( - -
- Reset Password + + {' '} +Reset Password
@@ -96,8 +95,8 @@ export default class ForgotPass extends Component { ))} - {this.props.type === "FPassword1" ? ( - + {this.props.type === 'FPassword1' ? ( + <> Send E-mail - + ) : ( - + <> Confirm password - + )}
-
+ ); } } diff --git a/smart-hut/src/views/FourOhFour.js b/smart-hut/src/views/FourOhFour.js index 14ae7af..f6f52e8 100644 --- a/smart-hut/src/views/FourOhFour.js +++ b/smart-hut/src/views/FourOhFour.js @@ -1,35 +1,37 @@ -import React, { Component } from "react"; -import { Grid, Button, Segment, Responsive, Image } from "semantic-ui-react"; -import { Link } from "react-router-dom"; -import MyHeader from "../components/HeaderController"; +import React, { Component } from 'react'; +import { + Grid, Button, Segment, Responsive, Image, +} from 'semantic-ui-react'; +import { Link } from 'react-router-dom'; +import MyHeader from '../components/HeaderController'; export default class FourOhFour extends Component { constructor(props) { super(props); const meme = [ - "1.jpeg", - "2.jpeg", - "3.png", - "4.jpeg", - "5.jpeg", - "6.jpg", - "7.jpg", - "8.jpg", - "9.jpeg", - "10.jpg", - "11.jpeg", - "12.gif", - "13.gif", - "14.gif", + '1.jpeg', + '2.jpeg', + '3.png', + '4.jpeg', + '5.jpeg', + '6.jpg', + '7.jpg', + '8.jpg', + '9.jpeg', + '10.jpg', + '11.jpeg', + '12.gif', + '13.gif', + '14.gif', ]; - var arrayNum = Math.floor(Math.random() * 13) + 1; - var path = "img/room_404_meme/" + meme[arrayNum]; + const arrayNum = Math.floor(Math.random() * 13) + 1; + const path = `img/room_404_meme/${meme[arrayNum]}`; this.state = { meme: path }; } render() { return ( -
+
@@ -59,7 +61,7 @@ export default class FourOhFour extends Component { our main room! ...or refresh this page some times...

@@ -103,7 +105,7 @@ export default class FourOhFour extends Component { our main room! ...or refresh this page some times...

diff --git a/smart-hut/src/views/Home.js b/smart-hut/src/views/Home.js index 1347c0a..a846d9b 100644 --- a/smart-hut/src/views/Home.js +++ b/smart-hut/src/views/Home.js @@ -1,6 +1,5 @@ -import PropTypes from "prop-types"; -import React, { Component } from "react"; -import HomeNavbar from "./../components/HomeNavbar"; +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; import { Button, Container, @@ -14,13 +13,14 @@ import { Segment, Sidebar, Visibility, -} from "semantic-ui-react"; +} from 'semantic-ui-react'; +import HomeNavbar from '../components/HomeNavbar'; // Heads up! // We using React Static to prerender our docs with server side rendering, this is a quite simple solution. // For more advanced usage please check Responsive docs under the "Usage" section. const getWidth = () => { - const isSSR = typeof window === "undefined"; + const isSSR = typeof window === 'undefined'; return isSSR ? Responsive.onlyTablet.minWidth : window.innerWidth; }; @@ -35,10 +35,10 @@ const HomepageHeading = ({ mobile }) => ( content="SmartHut" inverted style={{ - fontSize: mobile ? "2em" : "4em", - fontWeight: "normal", + fontSize: mobile ? '2em' : '4em', + fontWeight: 'normal', marginBottom: 0, - marginTop: mobile ? "1.5em" : "3em", + marginTop: mobile ? '1.5em' : '3em', }} />
( content="Keep your Home fully Connected" inverted style={{ - fontSize: mobile ? "1.5em" : "1.7em", - fontWeight: "normal", - marginTop: mobile ? "0.5em" : "1.5em", + fontSize: mobile ? '1.5em' : '1.7em', + fontWeight: 'normal', + marginTop: mobile ? '0.5em' : '1.5em', }} /> - @@ -184,20 +186,20 @@ ResponsiveContainer.propTypes = { const Home = () => ( - + -
+
We help you keep your home connected
-

+

In a few steps your home will be fully connected with SmartHut.

-
+
Choose between a wide range of devices
-

+

SmartHut is a leading worldwide company in technology innovation. Explore our website to find the best devices for each room of your home! @@ -210,12 +212,12 @@ const Home = () => ( - + -

+
Have you ever dreamt about a smart home?
-

+

Let us carrying you into the future. With SmartHut, being at home will be a refreshing experience. With just a few clicks, you will be able the set the illumination of your entire place. Follow the intelligent @@ -224,7 +226,7 @@ const Home = () => ( - + diff --git a/smart-hut/src/views/HostsNavbar.js b/smart-hut/src/views/HostsNavbar.js index 0158346..a5d5e52 100644 --- a/smart-hut/src/views/HostsNavbar.js +++ b/smart-hut/src/views/HostsNavbar.js @@ -1,9 +1,11 @@ -import React, { Component } from "react"; -import { Menu, Grid, Responsive, Dropdown } from "semantic-ui-react"; -import HostModal from "../components/HostModal"; -import { RemoteService } from "../remote"; -import { connect } from "react-redux"; -import { appActions } from "../storeActions"; +import React, { Component } from 'react'; +import { + Menu, Grid, Responsive, Dropdown, +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import HostModal from '../components/HostModal'; +import { RemoteService } from '../remote'; +import { appActions } from '../storeActions'; class HostsNavbar extends Component { constructor(props) { @@ -29,7 +31,7 @@ class HostsNavbar extends Component { } get activeItemHostsName() { - if (this.props.activeItem === -1) return "Home"; + if (this.props.activeItem === -1) return 'Home'; return this.props.hosts[this.props.activeHost].name; } @@ -37,7 +39,7 @@ class HostsNavbar extends Component { return (

- + Hosts - {Object.values(this.props.hosts).map((e, i) => { - return ( - - {e.name} - - ); - })} + {Object.values(this.props.hosts).map((e, i) => ( + + {e.name} + + ))} @@ -84,19 +84,17 @@ class HostsNavbar extends Component { Hosts - {Object.values(this.props.hosts).map((e, i) => { - return ( - - {e.name} - - ); - })} + {Object.values(this.props.hosts).map((e, i) => ( + + {e.name} + + ))} @@ -106,9 +104,7 @@ class HostsNavbar extends Component { } } -const setActiveHost = (activeHost) => { - return (dispatch) => dispatch(appActions.setActiveHost(activeHost)); -}; +const setActiveHost = (activeHost) => (dispatch) => dispatch(appActions.setActiveHost(activeHost)); const mapStateToProps = (state, _) => ({ hosts: state.hosts, diff --git a/smart-hut/src/views/Instruction.js b/smart-hut/src/views/Instruction.js index 5dd4923..2da364f 100644 --- a/smart-hut/src/views/Instruction.js +++ b/smart-hut/src/views/Instruction.js @@ -1,6 +1,8 @@ -import React, { Component } from "react"; -import HomeNavbar from "./../components/HomeNavbar"; -import { Container, Header, Divider, Grid } from "semantic-ui-react"; +import React, { Component } from 'react'; +import { + Container, Header, Divider, Grid, +} from 'semantic-ui-react'; +import HomeNavbar from '../components/HomeNavbar'; const ContainerExampleAlignment = () => (
diff --git a/smart-hut/src/views/Login.js b/smart-hut/src/views/Login.js index 3a0bf71..a68d499 100644 --- a/smart-hut/src/views/Login.js +++ b/smart-hut/src/views/Login.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Button, Form, @@ -8,19 +8,19 @@ import { Message, Icon, Input, -} from "semantic-ui-react"; -import { RemoteService } from "../remote"; -import { withRouter } from "react-router-dom"; -import { connect } from "react-redux"; +} from 'semantic-ui-react'; +import { withRouter } from 'react-router-dom'; +import { connect } from 'react-redux'; +import { RemoteService } from '../remote'; class Login extends Component { constructor(props) { super(props); this.state = { - user: "", - password: "", + user: '', + password: '', fireRedirect: false, - error: { state: false, message: "" }, + error: { state: false, message: '' }, }; } @@ -29,42 +29,43 @@ class Login extends Component { this.props .login(this.state.user, this.state.password) - .then(() => this.props.history.push("/dashboard")) + .then(() => this.props.history.push('/dashboard')) .catch((err) => { this.setState({ - error: { state: true, message: err.messages.join(" - ") }, + error: { state: true, message: err.messages.join(' - ') }, }); }); }; onChangeHandler = (event) => { - let nam = event.target.name; - let val = event.target.value; + const nam = event.target.name; + const val = event.target.value; this.setState({ [nam]: val }); }; - toggle = () => - this.setState((prevState) => ({ rememberme: !prevState.rememberme })); + toggle = () => this.setState((prevState) => ({ rememberme: !prevState.rememberme })); render() { return ( - -
- Log-in to SmartHut + + {' '} +Log-in to SmartHut
Forgot Password?

- New to us? Sign Up + New to us? + {' '} + Sign Up

- + ); } } @@ -117,6 +120,6 @@ class Login extends Component { const mapStateToProps = (state, _) => ({ loggedIn: state.login.loggedIn }); const LoginContainer = connect( mapStateToProps, - RemoteService + RemoteService, )(withRouter(Login)); export default LoginContainer; diff --git a/smart-hut/src/views/Navbar.js b/smart-hut/src/views/Navbar.js index 3132aca..6927b91 100644 --- a/smart-hut/src/views/Navbar.js +++ b/smart-hut/src/views/Navbar.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component } from 'react'; import { Menu, Button, @@ -6,12 +6,12 @@ import { Icon, Responsive, Dropdown, -} from "semantic-ui-react"; -import { editButtonStyle } from "../components/dashboard/devices/styleComponents"; -import RoomModal from "../components/RoomModal"; -import { RemoteService } from "../remote"; -import { connect } from "react-redux"; -import { appActions } from "../storeActions"; +} from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import { editButtonStyle } from '../components/dashboard/devices/styleComponents'; +import RoomModal from '../components/RoomModal'; +import { RemoteService } from '../remote'; +import { appActions } from '../storeActions'; class Navbar extends Component { constructor(props) { @@ -40,7 +40,7 @@ class Navbar extends Component { } get activeItemName() { - if (this.props.activeRoom === -1) return "Home"; + if (this.props.activeRoom === -1) return 'Home'; return this.props.rooms[this.props.activeRoom].name; } @@ -62,7 +62,7 @@ class Navbar extends Component { return (
- +
- Sign-up to SmartHut + + {' '} +Sign-up to SmartHut
@@ -107,10 +108,10 @@ export default class Signup extends Component { iconPosition="left" placeholder="E-mail" onChange={this.onChangeHandler} - /*error={{ + /* error={{ content: 'Please enter a valid email address', pointing: 'below', - }}*/ + }} */ required />
- + ); } } diff --git a/smart-hut/src/views/TestHeaderController.js b/smart-hut/src/views/TestHeaderController.js index 3c8f681..181f65a 100644 --- a/smart-hut/src/views/TestHeaderController.js +++ b/smart-hut/src/views/TestHeaderController.js @@ -1,6 +1,6 @@ -import _ from "lodash"; -import React from "react"; -import HeaderController from "./../components/HeaderController"; +import _ from 'lodash'; +import React from 'react'; +import HeaderController from '../components/HeaderController'; export default class TestHeaderController extends React.Component { render() { diff --git a/smart-hut/src/views/Videocam.js b/smart-hut/src/views/Videocam.js index 45905ec..a294a7c 100644 --- a/smart-hut/src/views/Videocam.js +++ b/smart-hut/src/views/Videocam.js @@ -1,11 +1,12 @@ -import React from "react"; -import VideoTest from "../components/VideoTest"; +import React from 'react'; +import VideoTest from '../components/VideoTest'; export default class TestHeaderController extends React.Component { render() { return (
- ; + +;
); }