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(props){ const { site, app, fps, playing, actions, location } = props const tool_list = Object.keys(modules).map((name, i) => { const label = name.replace(/_/, " ") return }) const tool = modules[app.tool] const links = tool.links().map((link,i) => { let name = link.url === location.pathname ? {link.name} : link.name return ( {link.url ? {name} : name} ) }) return (
{site.name} cortex system dashboard {links} {playing && {fps} fps}
) } const mapStateToProps = state => ({ site: state.system.site, 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)