summaryrefslogtreecommitdiff
path: root/app/client/common/header.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
commit2664eb3e474f5d03d1782c15673b774d68fb2c58 (patch)
tree1f1e58a6090f6befa75d8f6915388ddee30df04d /app/client/common/header.component.js
parent3a8d99c5e4f64a9426585943c40635eb183b47ae (diff)
textInput/fileUpload
Diffstat (limited to 'app/client/common/header.component.js')
-rw-r--r--app/client/common/header.component.js27
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)