First sketch of ui types
This commit is contained in:
parent
82081e7c83
commit
b22e28dc44
8 changed files with 221 additions and 105 deletions
|
|
@ -10,6 +10,7 @@ import * as Colors from "material-ui/colors";
|
|||
import SideBar from "components/SideBar";
|
||||
import ControlMap from "components/ControlMap";
|
||||
import TopBar from "components/TopBar";
|
||||
import UiItemList from "components/UiItemList";
|
||||
|
||||
export type AppProps = {
|
||||
config: Config
|
||||
|
|
@ -27,7 +28,10 @@ class App extends React.Component<AppProps & Classes, AppState> {
|
|||
this.state = {
|
||||
selectedControl: null,
|
||||
drawerOpened: false,
|
||||
mqttState: _.map(props.topics, ({defaultValue}) => defaultValue)
|
||||
mqttState: _.map(props.topics, topic => ({
|
||||
actual: topic.defaultValue,
|
||||
internal: topic.values[topic.defaultValue]
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +68,11 @@ class App extends React.Component<AppProps & Classes, AppState> {
|
|||
connected={false} />
|
||||
<SideBar open={this.state.drawerOpened}
|
||||
control={this.state.selectedControl}
|
||||
onCloseRequest={this.closeDrawer.bind(this)} />
|
||||
onCloseRequest={this.closeDrawer.bind(this)}
|
||||
>
|
||||
{this.state.selectedControl == null
|
||||
|| <UiItemList state={this.state.mqttState} controls={this.state.selectedControl.ui} />}
|
||||
</SideBar>
|
||||
</div>
|
||||
</MuiThemeProvider>
|
||||
<ControlMap width={1000} height={700} zoom={0}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue