summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/nav/viewer.router.js
blob: 837bd5e5ae3bdcc8c4a4d0b72857a3e7be54f299 (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
43
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'

import { timestampToSeconds } from 'app/utils'
import actions from 'app/actions'

class ViewerRouter extends Component {
  componentDidMount() {
    this.route()
  }
  route() {
    // console.log(this.props.match.params.component)
    switch (this.props.match.params.component) {
      case 'transcript':
        actions.viewer.showComponent('transcript')
        break
      case 'nav':
        actions.viewer.showComponent('nav')
        break
      case 'checklist':
        actions.viewer.showComponent('checklist')
        break
      case 'vitrine':
        actions.audio.seek(timestampToSeconds('7:36'))
        break
      case 'gallery':
        actions.audio.seek(timestampToSeconds('27:36'))
        break
      case 'end':
        break
    }
  }
  render() {
    return null
  }
}

const mapStateToProps = state => ({
  viewer: state.viewer,
})

export default connect(mapStateToProps)(ViewerRouter)