diff options
Diffstat (limited to 'app/client/common/header.component.js')
| -rw-r--r-- | app/client/common/header.component.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/app/client/common/header.component.js b/app/client/common/header.component.js index 29c3713..5c1c145 100644 --- a/app/client/common/header.component.js +++ b/app/client/common/header.component.js @@ -1,36 +1,41 @@ import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' import { Link } from 'react-router-dom'; import { connect } from 'react-redux' -function Header(props) { - const tools = "pix2pix samplernn style_transfer_video style_transfer_audio".split(" ").map((s,i) => { - return <option value={s}>{s}</option> +import * as systemActions from '../system/system.actions' + +import modules from '../modules' + +function Header({ fps, app, actions }) { + const tool_list = Object.keys(modules).map((name, i) => { + const label = name.replace(/_/, " ") + return <option value={name} key={i}>{label}</option> }) + const Links = modules[app.tool].links return ( <header> <b>live cortex</b> <span> - <select> - {tools} + <select onChange={e => actions.changeTool(e.target.value)} value={app.tool}> + {tool_list} </select> </span> <span><Link to="/system">system</Link></span> <span><Link to="/dashboard">dashboard</Link></span> - <span>checkpoints</span> - <span>datasets</span> - <span>results</span> - <span><Link to="/live">live</Link></span> - <span>{props.fps} fps</span> + <Links /> + <span>{fps} fps</span> </header> ) } const mapStateToProps = state => ({ + app: state.system.app, fps: state.live.fps, - frame: state.live.frame, }) const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(systemActions, dispatch), }) export default connect(mapStateToProps, mapDispatchToProps)(Header) |
