summaryrefslogtreecommitdiff
path: root/app/client/dashboard/dashboardHeader.component.js
blob: 492dfd89f070b14b3703c3265d629bbfd7ac0154 (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
import { h, Component } from 'preact'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as liveActions from '../live/actions'

import * as util from '../util'

class DashboardHeader extends Component {
  constructor(props){
    super(props)
    this.handleClick = this.handleClick.bind(this)
  }
  handleClick(e){
    this.props.onClick && this.props.onClick()
  }
  render() {
    const { currentTask, site } = this.props
    const eta = ((currentTask.epochs - currentTask.epoch) * 180 / 60) + " minutes"
    return (
	    <div class='dashboardHeader heading'>
	      <h3>{site.name}</h3>
	      Currently {util.gerund(currentTask.activity)} {currentTask.library} on {currentTask.dataset}<br/>
	      Epoch: {currentTask.epoch} / {currentTask.epochs}, ETA {eta}<br/>
	      <br/>
	      Want to play live? <button>Pause at the end of this epoch</button>
	    </div>
    )
  }
}

const mapStateToProps = state => ({
	currentTask: state.system.currentTask,
	site: state.system.site,
})

const mapDispatchToProps = (dispatch, ownProps) => ({
})

export default connect(mapStateToProps, mapDispatchToProps)(DashboardHeader)