summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/nav/viewer.router.js
blob: 651bbb6c997455b1aa58a95b4b566cd641808e52 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'

import { timestampToSeconds } from 'app/utils'
import { getSection } from 'app/utils/viewer.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 'carousel':
        actions.viewer.seekToSection(getSection(1))
        break
      case 'vitrine':
        actions.viewer.seekToSection(getSection(2))
        break
      case 'gallery':
        actions.viewer.seekToSection(getSection(3))
        break
      case 'video':
        actions.viewer.seekToSection(getSection(4))
        break
      case 'credits':
        actions.viewer.showCredits()
        break
      case 'footnotes':
        actions.viewer.showComponent('nav')
        actions.viewer.showComponent('footnotes')
        break
      case 'end':
        break
    }
  }
  render() {
    return null
  }
}

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

export default connect(mapStateToProps)(ViewerRouter)