summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/viewer.actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
-rw-r--r--animism-align/frontend/app/views/viewer/viewer.actions.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js
index 563b18f..73e34fd 100644
--- a/animism-align/frontend/app/views/viewer/viewer.actions.js
+++ b/animism-align/frontend/app/views/viewer/viewer.actions.js
@@ -1,6 +1,6 @@
import * as types from 'app/types'
import { store, history, dispatch } from 'app/store'
-import { MEDIA_TYPES } from 'app/constants'
+import { MEDIA_TYPES, MEDIA_LABEL_TYPES } from 'app/constants'
const newSection = (annotation, index, mediaIndex) => ({
start_ts: annotation.start_ts,
@@ -14,7 +14,7 @@ export const loadSections = () => dispatch => {
let sections = []
let currentSection
let mediaIndex = 0
- let mediaTypes = {}
+ let mediaLabels = {}
const state = store.getState()
const { order: annotationOrder, lookup: annotationLookup } = state.annotation.index
const { lookup: mediaLookup } = state.media.index
@@ -23,8 +23,8 @@ export const loadSections = () => dispatch => {
const annotation = annotationLookup[annotation_id]
if (annotation.type === 'header') {
if (currentSection) {
- currentSection.mediaTypes = Object.keys(mediaTypes).join(', ')
- mediaTypes = {}
+ currentSection.mediaLabels = Object.keys(mediaLabels).join(', ')
+ mediaLabels = {}
}
currentSection = newSection(annotation, sections.length, mediaIndex)
sections.push(currentSection)
@@ -36,6 +36,9 @@ export const loadSections = () => dispatch => {
start_ts: annotation.start_ts,
media
})
+ if (media.type in MEDIA_LABEL_TYPES) {
+ mediaLabels[MEDIA_LABEL_TYPES[media.type]] = true
+ }
mediaIndex += 1
} else {
console.error("media found before first section")
@@ -43,8 +46,8 @@ export const loadSections = () => dispatch => {
}
})
- if (currentSection) {
- currentSection.mediaTypes = Object.keys(mediaTypes).join(', ')
+ if (currentSection && Object.keys(mediaLabels).length) {
+ currentSection.mediaLabels = Object.keys(mediaLabels).join(', ')
}
// console.log(sections)