update branch

This commit is contained in:
britea 2020-05-23 16:11:25 +02:00
parent 747bd370cc
commit a184333579
8 changed files with 369 additions and 363 deletions

View file

@ -1,15 +1,15 @@
import React from 'react'
import { Dropdown } from 'semantic-ui-react'
import React from 'react';
import { Dropdown } from 'semantic-ui-react';
const options = [
{ key: 'Living Room', text: 'Living Room', value: 'Living Room' },
{ key: 'Kitchen', text: 'Kitchen', value: 'Kitchen' },
{ key: 'Garden', text: 'Garden', value: 'Garden' },
{ key: 'Bedroom 1', text: 'Bedroom 1', value: 'Bedroom 1' },
]
];
const DropdownSimulation = () => (
<Dropdown placeholder='Skills' fluid multiple selection options={options} />
)
<Dropdown placeholder="Skills" fluid multiple selection options={options} />
);
export default DropdownSimulation
export default DropdownSimulation;

View file

@ -1,12 +1,5 @@
import React from "react";
import Modal from "react-modal";
import SliderTemperature from "./SliderTemperature.js";
import SliderTempRange from "./SliderTempRange.js";
import SliderHumidty from "./SliderHumidity.js";
import SliderLight from "./SliderLight.js";
import SliderLightRange from "./SliderLightRange.js";
import SliderMotion from "./SliderMotion.js";
import DropdownSimulation from "./DropdownSimulation.js";
import React from 'react';
import Modal from 'react-modal';
import {
Grid,
Divider,
@ -17,8 +10,15 @@ import {
Image,
GridColumn,
Header,
Segment
} from "semantic-ui-react";
Segment,
} from 'semantic-ui-react';
import SliderTemperature from './SliderTemperature.js';
import SliderTempRange from './SliderTempRange.js';
import SliderHumidty from './SliderHumidity.js';
import SliderLight from './SliderLight.js';
import SliderLightRange from './SliderLightRange.js';
import SliderMotion from './SliderMotion.js';
import DropdownSimulation from './DropdownSimulation.js';
const SimulationPanel = (props) => (
@ -34,7 +34,7 @@ const SimulationPanel = (props) => (
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0,0,0,0.5)'
backgroundColor: 'rgba(0,0,0,0.5)',
},
content: {
position: 'absolute',
@ -49,8 +49,8 @@ const SimulationPanel = (props) => (
borderRadius: '4px',
outline: 'none',
padding: '20px',
backgroundColor: 'rgb(65, 67, 69)'
}
backgroundColor: 'rgb(65, 67, 69)',
},
}}
>
{props.simulationPanel}
@ -58,7 +58,7 @@ const SimulationPanel = (props) => (
{/* TITLE */}
<Grid.Row textAlign="center">
<h1 style={{ color: "white", padding:"1rem", fontFamily: "Arial"}}>
<h1 style={{ color: 'white', padding: '1rem', fontFamily: 'Arial' }}>
Welcome in the Simulation Panel
</h1>
</Grid.Row>
@ -68,23 +68,23 @@ const SimulationPanel = (props) => (
<Grid.Column width={6} textAlign="center">
<Divider
style={{
marginTop: "3rem",
marginBottom: "auto"
marginTop: '3rem',
marginBottom: 'auto',
}}
/>
<Image
src='./../img/thermo-simulation.png'
src="./../img/thermo-simulation.png"
style={{
width: "60px",
height: "auto",
display:"block",
marginLeft:"auto",
marginRight:"auto",
marginTop: "1rem",
marginBottom: "1rem"
width: '60px',
height: 'auto',
display: 'block',
marginLeft: 'auto',
marginRight: 'auto',
marginTop: '1rem',
marginBottom: '1rem',
}}
/>
<p style={{ color: "white", padding:"0.5rem"}}>
<p style={{ color: 'white', padding: '0.5rem' }}>
Temperature Sensor
</p>
<Divider />
@ -95,8 +95,8 @@ const SimulationPanel = (props) => (
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderTemperature />
@ -104,8 +104,8 @@ const SimulationPanel = (props) => (
<Divider />
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderTempRange />
@ -118,23 +118,23 @@ const SimulationPanel = (props) => (
<Grid.Column width={6} textAlign="center">
<Divider
style={{
marginTop: "3rem",
marginBottom: "auto"
marginTop: '3rem',
marginBottom: 'auto',
}}
/>
<Image
src='./../img/humidity-simulation.png'
src="./../img/humidity-simulation.png"
style={{
width: "60px",
height: "auto",
display:"block",
marginLeft:"auto",
marginRight:"auto",
marginTop: "1rem",
marginBottom: "1rem"
width: '60px',
height: 'auto',
display: 'block',
marginLeft: 'auto',
marginRight: 'auto',
marginTop: '1rem',
marginBottom: '1rem',
}}
/>
<p style={{ color: "white", padding:"0.5rem"}}>
<p style={{ color: 'white', padding: '0.5rem' }}>
Humidity Sensor
</p>
<Divider />
@ -145,8 +145,8 @@ const SimulationPanel = (props) => (
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderHumidty />
@ -154,8 +154,8 @@ const SimulationPanel = (props) => (
<Divider />
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderTempRange />
@ -168,23 +168,23 @@ const SimulationPanel = (props) => (
<Grid.Column width={6} textAlign="center">
<Divider
style={{
marginTop: "3rem",
marginBottom: "auto"
marginTop: '3rem',
marginBottom: 'auto',
}}
/>
<Image
src='./../img/light-simulation.png'
src="./../img/light-simulation.png"
style={{
width: "60px",
height: "auto",
display:"block",
marginLeft:"auto",
marginRight:"auto",
marginTop: "1rem",
marginBottom: "1rem"
width: '60px',
height: 'auto',
display: 'block',
marginLeft: 'auto',
marginRight: 'auto',
marginTop: '1rem',
marginBottom: '1rem',
}}
/>
<p style={{ color: "white", padding:"0.5rem"}}>
<p style={{ color: 'white', padding: '0.5rem' }}>
Light Sensor
</p>
<Divider />
@ -195,8 +195,8 @@ const SimulationPanel = (props) => (
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderLight />
@ -204,8 +204,8 @@ const SimulationPanel = (props) => (
<Divider />
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderLightRange />
@ -218,23 +218,23 @@ const SimulationPanel = (props) => (
<Grid.Column width={6} textAlign="center">
<Divider
style={{
marginTop: "3rem",
marginBottom: "auto"
marginTop: '3rem',
marginBottom: 'auto',
}}
/>
<Image
src='./../img/motion-simulation.png'
src="./../img/motion-simulation.png"
style={{
width: "60px",
height: "auto",
display:"block",
marginLeft:"auto",
marginRight:"auto",
marginTop: "1rem",
marginBottom: "1rem"
width: '60px',
height: 'auto',
display: 'block',
marginLeft: 'auto',
marginRight: 'auto',
marginTop: '1rem',
marginBottom: '1rem',
}}
/>
<p style={{ color: "white", padding:"0.5rem"}}>
<p style={{ color: 'white', padding: '0.5rem' }}>
Motion Sensor
</p>
<Divider />
@ -245,8 +245,8 @@ const SimulationPanel = (props) => (
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderMotion />
@ -254,8 +254,8 @@ const SimulationPanel = (props) => (
<Divider />
<div
style={{
display: "block",
marginLeft: "30%",
display: 'block',
marginLeft: '30%',
}}
>
<SliderTempRange />

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderHumidity extends Component {
@ -8,22 +9,22 @@ export default class SliderHumidity extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Humidity: ${duration} %`}
</p>
@ -31,14 +32,14 @@ export default class SliderHumidity extends Component {
<Form.Input
min={0}
max={100}
name='duration'
name="duration"
onChange={this.handleChange}
step={1}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderLight extends Component {
@ -8,22 +9,22 @@ export default class SliderLight extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Light intensity: ${duration} lm`}
</p>
@ -31,14 +32,14 @@ export default class SliderLight extends Component {
<Form.Input
min={0}
max={15000}
name='duration'
name="duration"
onChange={this.handleChange}
step={5}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderTempRange extends Component {
@ -8,22 +9,22 @@ export default class SliderTempRange extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Chosen tolerance: +/- ${duration}`}
</p>
@ -32,14 +33,14 @@ export default class SliderTempRange extends Component {
<Form.Input
min={0}
max={1000}
name='duration'
name="duration"
onChange={this.handleChange}
step={1}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderLight extends Component {
@ -8,22 +9,22 @@ export default class SliderLight extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Range: ${duration} meters`}
</p>
@ -31,14 +32,14 @@ export default class SliderLight extends Component {
<Form.Input
min={0}
max={15}
name='duration'
name="duration"
onChange={this.handleChange}
step={5}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderTempRange extends Component {
@ -8,22 +9,22 @@ export default class SliderTempRange extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Chosen tolerance: +/- ${duration}`}
</p>
@ -32,14 +33,14 @@ export default class SliderTempRange extends Component {
<Form.Input
min={0}
max={10}
name='duration'
name="duration"
onChange={this.handleChange}
step={1}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react'
import { Form, Grid, Image, Transition, Divider } from 'semantic-ui-react'
import React, { Component } from 'react';
import {
Form, Grid, Image, Transition, Divider,
} from 'semantic-ui-react';
export default class SliderTemperature extends Component {
@ -8,22 +9,22 @@ export default class SliderTemperature extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleVisibility = () =>
this.setState((prevState) => ({ visible: !prevState.visible }))
handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible }))
render() {
const { duration } = this.state
const { duration } = this.state;
return (
<Grid columns={2}>
<Grid.Column as={Form} textAlign="center">
<p
style={{
color: "white",
padding:"0.5rem",
display:"block",
marinLeft:"auto",
marginRight:"auto",}}
color: 'white',
padding: '0.5rem',
display: 'block',
marinLeft: 'auto',
marginRight: 'auto',
}}
>
{`Heat: ${duration} Celsius Degrees`}
</p>
@ -31,14 +32,14 @@ export default class SliderTemperature extends Component {
<Form.Input
min={10}
max={35}
name='duration'
name="duration"
onChange={this.handleChange}
step={1}
type='range'
type="range"
value={duration}
/>
</Grid.Column>
</Grid>
)
);
}
}