From 28f18bdb5734bac07e549c6a8b1f314982efc9a8 Mon Sep 17 00:00:00 2001 From: feeling Date: Tue, 12 Jan 2021 14:15:10 +0100 Subject: [PATCH] update project --- interface/src/project/FanCtlControl.tsx | 77 ++++++++++++++++++++++++ interface/src/project/FanCtlProject.tsx | 35 +++++++++++ interface/src/project/ProjectMenu.tsx | 4 +- interface/src/project/ProjectRouting.tsx | 6 +- interface/src/project/types.ts | 6 ++ 5 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 interface/src/project/FanCtlControl.tsx create mode 100644 interface/src/project/FanCtlProject.tsx diff --git a/interface/src/project/FanCtlControl.tsx b/interface/src/project/FanCtlControl.tsx new file mode 100644 index 0000000..b2bac3a --- /dev/null +++ b/interface/src/project/FanCtlControl.tsx @@ -0,0 +1,77 @@ +import React, { Component } from 'react'; +import { Typography, Box, List, ListItem, ListItemText } from '@material-ui/core'; +import { SectionContent } from '../components'; + +class FanCtlControl extends Component { + + render() { + return ( + + + This simple demo project allows you to control the built-in LED. + It demonstrates how the esp8266-react framework may be extended for your own IoT project. + + + It is recommended that you keep your project interface code under the project directory. + This serves to isolate your project code from the from the rest of the user interface which should + simplify merges should you wish to update your project with future framework changes. + + + The demo project interface code is stored in the 'interface/src/project' directory: + + + + + + + + + + + + + + + + + + + + + + + + + + + See the project README for a full description of the demo project. + + + + ) + } + +} + +export default FanCtlControl; diff --git a/interface/src/project/FanCtlProject.tsx b/interface/src/project/FanCtlProject.tsx new file mode 100644 index 0000000..2bc67c4 --- /dev/null +++ b/interface/src/project/FanCtlProject.tsx @@ -0,0 +1,35 @@ +import React, { Component } from 'react'; +import { Redirect, Switch, RouteComponentProps } from 'react-router-dom' + +import { Tabs, Tab } from '@material-ui/core'; + +import { PROJECT_PATH } from '../api'; +import { MenuAppBar } from '../components'; +import { AuthenticatedRoute } from '../authentication'; +import FanCtlControl from './FanCtlControl'; + +class FanCtlProject extends Component { + + handleTabChange = (event: React.ChangeEvent<{}>, path: string) => { + this.props.history.push(path); + }; + + render() { + return ( + + + + + + + + + + + + ) + } + +} + +export default FanCtlProject; diff --git a/interface/src/project/ProjectMenu.tsx b/interface/src/project/ProjectMenu.tsx index b7d2739..0b4869b 100644 --- a/interface/src/project/ProjectMenu.tsx +++ b/interface/src/project/ProjectMenu.tsx @@ -12,11 +12,11 @@ class ProjectMenu extends Component { const path = this.props.match.url; return ( - + - + ) diff --git a/interface/src/project/ProjectRouting.tsx b/interface/src/project/ProjectRouting.tsx index fc378e6..9d5f756 100644 --- a/interface/src/project/ProjectRouting.tsx +++ b/interface/src/project/ProjectRouting.tsx @@ -4,7 +4,7 @@ import { Redirect, Switch } from 'react-router'; import { PROJECT_PATH } from '../api'; import { AuthenticatedRoute } from '../authentication'; -import DemoProject from './DemoProject'; +import FanCtlProject from './FanCtlProject'; class ProjectRouting extends Component { @@ -16,14 +16,14 @@ class ProjectRouting extends Component { * Add your project page routing below. */ } - + { /* * The redirect below caters for the default project route and redirecting invalid paths. * The "to" property must match one of the routes above for this to work correctly. */ } - + ) } diff --git a/interface/src/project/types.ts b/interface/src/project/types.ts index 3221255..af78b40 100644 --- a/interface/src/project/types.ts +++ b/interface/src/project/types.ts @@ -7,3 +7,9 @@ export interface LightMqttSettings { name: string; mqtt_path : string; } + +export interface FanStatus { + fan_speed : number; + temperature_thres_low : number; + temperature_thres_high : number; +} \ No newline at end of file