summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/components/timeline/playCursor.component.js
blob: e03d2127265c8803e7ead3ee4df69e5281b475cd (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
import React, { Component } from 'react'
// import { Link } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import { ZOOM_STEPS } from '../../constants'
import { timestamp } from '../../../../util'

const PlayCursor = ({ timeline, audio }) => {
  const { start_ts, zoom, duration } = timeline
  const { play_ts } = audio
  const secondsPerPixel = ZOOM_STEPS[zoom] * 0.1
  const y = (play_ts - start_ts) / secondsPerPixel
  // console.log(play_ts, y)
  return (
    <div
      className='cursor playCursor'
      style={{
        top: y,
      }}
    >
      <div className='line' />
    </div>
  )
}

const mapStateToProps = state => ({
  timeline: state.align.timeline,
  audio: state.audio,
})

const mapDispatchToProps = dispatch => ({
  // alignActions: bindActionCreators({ ...alignActions }, dispatch),
})

export default connect(mapStateToProps, mapDispatchToProps)(PlayCursor)