From bf9919560a168f95c96b3894ee0d3f9af791c88d Mon Sep 17 00:00:00 2001 From: Fil Cesana Date: Sat, 9 May 2020 09:13:26 +0200 Subject: [PATCH] simulation panel now opens, it still misses the content --- smart-hut/src/components/HeaderController.js | 54 ++++++++++++++------ smart-hut/src/components/SimulationPanel.js | 42 +++++++++++++++ 2 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 smart-hut/src/components/SimulationPanel.js diff --git a/smart-hut/src/components/HeaderController.js b/smart-hut/src/components/HeaderController.js index 1d7ed2d..0094ad5 100644 --- a/smart-hut/src/components/HeaderController.js +++ b/smart-hut/src/components/HeaderController.js @@ -11,6 +11,7 @@ import { Segment, Image } from "semantic-ui-react"; import { RemoteService } from "../remote"; import { withRouter } from "react-router-dom"; import { connect } from "react-redux"; +import SimulationPanel from "./SimulationPanel"; const IconHomeImage = () => ( ; export class MyHeader extends React.Component { constructor(props) { super(props); - + this.state = { simulationPanel: undefined }; this.getInfo(); this.logout = this.logout.bind(this); } @@ -52,6 +53,19 @@ export class MyHeader extends React.Component { .catch((err) => console.error("Camera enabled", err)); } + openSimulationPanel = () => { + this.setState((state) => { + return { simulationPanel: true }; + }); + }; + + closeSimulationPanel = () => { + this.setState((state) => { + return { simulationPanel: undefined }; + }); + }; + + render() { return (
@@ -66,7 +80,13 @@ export class MyHeader extends React.Component { - +
+ +
+
@@ -114,20 +134,23 @@ export class MyHeader extends React.Component { - + + + - - + + + Share cameras} @@ -136,6 +159,7 @@ export class MyHeader extends React.Component { onChange={(e, val) => this.setCameraEnabled(val.checked)} /> + diff --git a/smart-hut/src/components/SimulationPanel.js b/smart-hut/src/components/SimulationPanel.js new file mode 100644 index 0000000..0a4b7b2 --- /dev/null +++ b/smart-hut/src/components/SimulationPanel.js @@ -0,0 +1,42 @@ +import React from "react"; +import Modal from "react-modal"; +import { Button } from "semantic-ui-react"; + +const ReactModalPortal = { + opacity: 0 +}; + +const ReactModal__Overlay = { + alignItems: 'center', + display: 'flex', + justifyContent: 'center', + transition: 'opacity 200ms ease-in-out' +}; + + +const modal = { + background: 'grey', + color: 'white', + maxWidth: '2rem', + outline: 'none', + padding: '2rem', + textAlign: 'center' +}; + +const SimulationPanel = (props) => ( + + {props.simulationPanel && ( +

hey man

+ )} + +
+); + +export default SimulationPanel;