blob: 02d48b92b214b710f4aa7c333cd4e1f105434589 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router-dom';
import { connect } from 'react-redux'
import * as systemActions from '../system/system.actions'
import modules from '../modules'
function Header({ app, fps, playing, 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 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>
<Links />
{playing && <span>{fps} fps</span>}
</header>
)
}
const mapStateToProps = state => ({
app: state.system.app,
fps: state.live.fps,
playing: state.live.playing,
})
const mapDispatchToProps = (dispatch, ownProps) => ({
actions: bindActionCreators(systemActions, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(Header)
|