diff options
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 5d6775f..097f01b 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -156,10 +156,6 @@ const makeFullscreenEvent = (index, annotation) => { return event } -export const setCurrentSection = (currentSection, nextSection) => dispatch => { - dispatch({ type: types.viewer.set_current_section, currentSection, nextSection }) -} - export const setNavStyle = color => dispatch => { dispatch({ type: types.viewer.set_nav_style, color }) } @@ -176,13 +172,32 @@ export const toggleComponent = key => dispatch => { dispatch({ type: types.viewer.toggle_component, key, value: !store.getState().viewer[key] }) } +const getNextSection = section => { + const { sections } = store.getState().viewer + if (section.index === sections.length - 1) { + return null + } + return sections[section.index + 1] +} + +export const reachedEndOfSection = () => dispatch => { + actions.audio.pause() + dispatch({ type: types.viewer.reached_end_of_section }) +} + +export const setCurrentSection = (currentSection, nextSection) => dispatch => { + dispatch({ type: types.viewer.set_current_section, currentSection, nextSection }) +} + export const seekToSection = section => dispatch => { + actions.viewer.setCurrentSection(section, getNextSection(section)) actions.audio.seek(section.start_ts) actions.audio.play() actions.viewer.hideComponent('nav') } -export const seekToMediaItem = mediaItem => dispatch => { +export const seekToMediaItem = (section, mediaItem) => dispatch => { + actions.viewer.setCurrentSection(section, getNextSection(section)) actions.audio.seek(mediaItem.start_ts) actions.audio.play() actions.viewer.hideComponent('nav') |
