videocam connected to back end
This commit is contained in:
parent
840d5ab6a2
commit
f9d1d9d678
3 changed files with 17 additions and 8 deletions
|
@ -4,6 +4,7 @@ import SmartPlug from "./SmartPlug";
|
||||||
import Sensor from "./Sensor";
|
import Sensor from "./Sensor";
|
||||||
import { ButtonDimmer, KnobDimmer } from "./Dimmer";
|
import { ButtonDimmer, KnobDimmer } from "./Dimmer";
|
||||||
import Switcher from "./Switch";
|
import Switcher from "./Switch";
|
||||||
|
import Videocam from "./Videocam";
|
||||||
import { Segment, Grid, Header, Button, Icon } from "semantic-ui-react";
|
import { Segment, Grid, Header, Button, Icon } from "semantic-ui-react";
|
||||||
import { RemoteService } from "../../../remote";
|
import { RemoteService } from "../../../remote";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
@ -30,6 +31,7 @@ class Device extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDeviceComponent() {
|
renderDeviceComponent() {
|
||||||
|
console.log(this.props.device)
|
||||||
switch (this.props.device.kind) {
|
switch (this.props.device.kind) {
|
||||||
case "regularLight":
|
case "regularLight":
|
||||||
return <Light id={this.props.id} />;
|
return <Light id={this.props.id} />;
|
||||||
|
@ -47,6 +49,8 @@ class Device extends React.Component {
|
||||||
return <Switcher id={this.props.id} />;
|
return <Switcher id={this.props.id} />;
|
||||||
case "dimmableLight":
|
case "dimmableLight":
|
||||||
return <Light id={this.props.id} />;
|
return <Light id={this.props.id} />;
|
||||||
|
case "securityCamera":
|
||||||
|
return <Videocam id={this.props.id} />;
|
||||||
default:
|
default:
|
||||||
throw new Error("Device type unknown");
|
throw new Error("Device type unknown");
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ class NewDevice extends Component {
|
||||||
switch: "New switch",
|
switch: "New switch",
|
||||||
buttonDimmer: "New button dimmer",
|
buttonDimmer: "New button dimmer",
|
||||||
knobDimmer: "New knob dimmer",
|
knobDimmer: "New knob dimmer",
|
||||||
|
securityCamera: "New security camera"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.deviceName === "") {
|
if (this.state.deviceName === "") {
|
||||||
|
@ -186,6 +187,12 @@ class NewDevice extends Component {
|
||||||
value: "buttonDimmer",
|
value: "buttonDimmer",
|
||||||
image: { avatar: true, src: "/img/plusMinus.svg" },
|
image: { avatar: true, src: "/img/plusMinus.svg" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "securityCamera",
|
||||||
|
text: "Security Camera",
|
||||||
|
value: "securityCamera",
|
||||||
|
image: { avatar: true, src: "/img/plusMinus.svg" },
|
||||||
|
}
|
||||||
];
|
];
|
||||||
const sensorOptions = [
|
const sensorOptions = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,13 +5,13 @@ import React, { Component } from "react";
|
||||||
import {
|
import {
|
||||||
StyledDiv
|
StyledDiv
|
||||||
} from "./VideocmStyle";
|
} from "./VideocmStyle";
|
||||||
import { Checkbox, Embed, Button, Grid, Responsive, Segment } from "semantic-ui-react";
|
import {Grid } from "semantic-ui-react";
|
||||||
import { RemoteService } from "../../../remote";
|
import { RemoteService } from "../../../remote";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import VideocamModal from "./VideocamModal";
|
import VideocamModal from "./VideocamModal";
|
||||||
|
|
||||||
|
|
||||||
class Light extends Component {
|
class Videocam extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { selectedVideo: undefined};
|
this.state = { selectedVideo: undefined};
|
||||||
|
@ -32,7 +32,7 @@ class Light extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const normalLightView = (
|
const VideocamView = (
|
||||||
<div>
|
<div>
|
||||||
<StyledDiv>
|
<StyledDiv>
|
||||||
<div onClick={this.openModal}>
|
<div onClick={this.openModal}>
|
||||||
|
@ -56,9 +56,7 @@ class Light extends Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{this.props.device.kind === "dimmableLight"
|
{VideocamView}
|
||||||
? console.log('err')
|
|
||||||
: normalLightView}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,5 +65,5 @@ class Light extends Component {
|
||||||
const mapStateToProps = (state, ownProps) => ({
|
const mapStateToProps = (state, ownProps) => ({
|
||||||
device: state.devices[ownProps.id],
|
device: state.devices[ownProps.id],
|
||||||
});
|
});
|
||||||
const LightContainer = connect(mapStateToProps, RemoteService)(Light);
|
const VideocamContainer = connect(mapStateToProps, RemoteService)(Videocam);
|
||||||
export default LightContainer;
|
export default VideocamContainer;
|
||||||
|
|
Loading…
Reference in a new issue