diff --git a/smart-hut/src/components/HeaderController.js b/smart-hut/src/components/HeaderController.js
index 1d84c6b..6c797ab 100644
--- a/smart-hut/src/components/HeaderController.js
+++ b/smart-hut/src/components/HeaderController.js
@@ -1,5 +1,12 @@
import React from "react";
-import { Grid, Divider, Button, Label, Responsive } from "semantic-ui-react";
+import {
+ Grid,
+ Divider,
+ Button,
+ Label,
+ Responsive,
+ Checkbox,
+} from "semantic-ui-react";
import { Segment, Image } from "semantic-ui-react";
import { RemoteService } from "../remote";
import { withRouter } from "react-router-dom";
@@ -35,6 +42,16 @@ export class MyHeader extends React.Component {
.catch((err) => console.error("MyHeader fetch user info error", err));
}
+ setCameraEnabled(val) {
+ let enabled = {
+ cameraEnabled: val,
+ };
+ this.props
+ .userPermissions(enabled)
+ .then(() => this.getInfo())
+ .catch((err) => console.error("Camera enabled", err));
+ }
+
render() {
return (
@@ -60,6 +77,11 @@ export class MyHeader extends React.Component {
+
this.setCameraEnabled(val.checked)}
+ />
@@ -94,6 +116,7 @@ export class MyHeader extends React.Component {
const mapStateToProps = (state, _) => ({
username:
state.userInfo && state.userInfo.username ? state.userInfo.username : "",
+ cameraEnabled: state.userInfo ? state.userInfo.cameraEnabled : false,
});
const LoginContainer = connect(
mapStateToProps,
diff --git a/smart-hut/src/components/HostModal.js b/smart-hut/src/components/HostModal.js
index e262e3f..cd03809 100644
--- a/smart-hut/src/components/HostModal.js
+++ b/smart-hut/src/components/HostModal.js
@@ -22,8 +22,7 @@ class HostModal extends Component {
.then(() => {
this.setState({
...this.state,
- guests: this.props.guests
- .map((u) => u.id),
+ guests: this.props.guests.map((u) => u.id),
});
})
.catch(console.error);
@@ -32,11 +31,13 @@ class HostModal extends Component {
.then((users) =>
this.setState({
...this.state,
- users: users.filter(u => u.id !== this.props.currentUserId).map((u) => ({
- key: u.id,
- text: `@${u.username} (${u.name})`,
- value: u.id,
- })),
+ users: users
+ .filter((u) => u.id !== this.props.currentUserId)
+ .map((u) => ({
+ key: u.id,
+ text: `@${u.username} (${u.name})`,
+ value: u.id,
+ })),
})
)
.catch(console.error);
@@ -86,25 +87,20 @@ class HostModal extends Component {
-
-
-
-
-
-
-
-
+
+
+
+
+