blob: 53a1f5444199744cc7b9c48faefd2c66cdb453b8 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
import React, { Component } from 'react'
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)
const { component } = this.props.match.params
if (component.match('section_')) {
const sectionParts = component.split('_')
const sectionIndex = parseInt(sectionParts[1])
actions.viewer.seekToSection(getSection(sectionIndex))
const seek_ts = timestampToSeconds(sectionParts[2])
if (seek_ts) {
actions.audio.jump(seek_ts)
}
return
}
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('footnotes')
break
case 'subscribe':
actions.viewer.showComponent('nav')
actions.viewer.showNavComponent('subscribe')
break
case 'share':
actions.viewer.showComponent('nav')
actions.viewer.showNavComponent('share')
break
case 'textplate':
actions.viewer.seekToTimestamp(timestampToSeconds('44:39'))
break
case 'book':
actions.viewer.seekToTimestamp(timestampToSeconds('15:00'))
break
case 'end':
break
}
}
render() {
return null
}
}
const mapStateToProps = state => ({
viewer: state.viewer,
})
export default connect(mapStateToProps)(ViewerRouter)
|