diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-24 22:26:07 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-24 22:26:07 +0200 |
| commit | f2d612de04da968a74efe94d0b448b465869d6e0 (patch) | |
| tree | 4594409298eb1a0453a5714f539ee0ee8696efad /animism-align/frontend/app/views/viewer/viewer.actions.js | |
| parent | 0f4d8d0d9601f6f2794c28e67ef8b0d4aad9fc86 (diff) | |
navigate to media
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index aa5124f..563b18f 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -11,7 +11,10 @@ const newSection = (annotation, index, mediaIndex) => ({ }) export const loadSections = () => dispatch => { - let sections = [], currentSection, mediaIndex = 0 + let sections = [] + let currentSection + let mediaIndex = 0 + let mediaTypes = {} const state = store.getState() const { order: annotationOrder, lookup: annotationLookup } = state.annotation.index const { lookup: mediaLookup } = state.media.index @@ -19,13 +22,20 @@ export const loadSections = () => dispatch => { annotationOrder.forEach((annotation_id, i) => { const annotation = annotationLookup[annotation_id] if (annotation.type === 'header') { + if (currentSection) { + currentSection.mediaTypes = Object.keys(mediaTypes).join(', ') + mediaTypes = {} + } currentSection = newSection(annotation, sections.length, mediaIndex) sections.push(currentSection) } if (MEDIA_TYPES.has(annotation.type)) { if (currentSection) { const media = mediaLookup[annotation.settings.media_id] - currentSection.media.push(media) + currentSection.media.push({ + start_ts: annotation.start_ts, + media + }) mediaIndex += 1 } else { console.error("media found before first section") @@ -33,6 +43,10 @@ export const loadSections = () => dispatch => { } }) + if (currentSection) { + currentSection.mediaTypes = Object.keys(mediaTypes).join(', ') + } + // console.log(sections) dispatch({ type: types.viewer.load_sections, data: sections }) |
