diff --git a/smart-hut/src/components/dashboard/devices/Device.js b/smart-hut/src/components/dashboard/devices/Device.js index 6ad0ac4..5ee6399 100644 --- a/smart-hut/src/components/dashboard/devices/Device.js +++ b/smart-hut/src/components/dashboard/devices/Device.js @@ -4,6 +4,7 @@ import SmartPlug from "./SmartPlug"; import Sensor from "./Sensor"; import { ButtonDimmer, KnobDimmer } from "./Dimmer"; import Switcher from "./Switch"; +import Videocam from "./Videocam"; import { Segment, Grid, Header, Button, Icon } from "semantic-ui-react"; import { RemoteService } from "../../../remote"; import { connect } from "react-redux"; @@ -30,6 +31,7 @@ class Device extends React.Component { } renderDeviceComponent() { + console.log(this.props.device) switch (this.props.device.kind) { case "regularLight": return ; @@ -47,6 +49,8 @@ class Device extends React.Component { return ; case "dimmableLight": return ; + case "securityCamera": + return ; default: throw new Error("Device type unknown"); } diff --git a/smart-hut/src/components/dashboard/devices/NewDevice.js b/smart-hut/src/components/dashboard/devices/NewDevice.js index fc12782..ff0ef72 100644 --- a/smart-hut/src/components/dashboard/devices/NewDevice.js +++ b/smart-hut/src/components/dashboard/devices/NewDevice.js @@ -106,6 +106,7 @@ class NewDevice extends Component { switch: "New switch", buttonDimmer: "New button dimmer", knobDimmer: "New knob dimmer", + securityCamera: "New security camera" }; if (this.state.deviceName === "") { @@ -186,6 +187,12 @@ class NewDevice extends Component { value: "buttonDimmer", image: { avatar: true, src: "/img/plusMinus.svg" }, }, + { + key: "securityCamera", + text: "Security Camera", + value: "securityCamera", + image: { avatar: true, src: "/img/plusMinus.svg" }, + } ]; const sensorOptions = [ { diff --git a/smart-hut/src/components/dashboard/devices/Videocam.js b/smart-hut/src/components/dashboard/devices/Videocam.js index 5f32dc1..f15bd4d 100644 --- a/smart-hut/src/components/dashboard/devices/Videocam.js +++ b/smart-hut/src/components/dashboard/devices/Videocam.js @@ -5,13 +5,13 @@ import React, { Component } from "react"; import { StyledDiv } from "./VideocmStyle"; -import { Checkbox, Embed, Button, Grid, Responsive, Segment } from "semantic-ui-react"; +import {Grid } from "semantic-ui-react"; import { RemoteService } from "../../../remote"; import { connect } from "react-redux"; import VideocamModal from "./VideocamModal"; -class Light extends Component { +class Videocam extends Component { constructor(props) { super(props); this.state = { selectedVideo: undefined}; @@ -32,7 +32,7 @@ class Light extends Component { render() { - const normalLightView = ( + const VideocamView = (
@@ -56,9 +56,7 @@ class Light extends Component { return (
- {this.props.device.kind === "dimmableLight" - ? console.log('err') - : normalLightView} + {VideocamView}
); } @@ -67,5 +65,5 @@ class Light extends Component { const mapStateToProps = (state, ownProps) => ({ device: state.devices[ownProps.id], }); -const LightContainer = connect(mapStateToProps, RemoteService)(Light); -export default LightContainer; +const VideocamContainer = connect(mapStateToProps, RemoteService)(Videocam); +export default VideocamContainer;