summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-07-27 17:27:49 +0200
committerJules Laplace <julescarbon@gmail.com>2020-07-27 17:27:49 +0200
commitbab55fb2b208e978ff52459f643cad53f01af08e (patch)
tree8946744937e01bbab0d6e60ee821793d63352e91 /animism-align/frontend/app/views/viewer
parent0f0aadf430546819cfcf55f7106a1247190e674c (diff)
media labels..
Diffstat (limited to 'animism-align/frontend/app/views/viewer')
-rw-r--r--animism-align/frontend/app/views/viewer/sections/viewer.sections.js2
-rw-r--r--animism-align/frontend/app/views/viewer/viewer.actions.js15
2 files changed, 10 insertions, 7 deletions
diff --git a/animism-align/frontend/app/views/viewer/sections/viewer.sections.js b/animism-align/frontend/app/views/viewer/sections/viewer.sections.js
index cd5b4f0..085749f 100644
--- a/animism-align/frontend/app/views/viewer/sections/viewer.sections.js
+++ b/animism-align/frontend/app/views/viewer/sections/viewer.sections.js
@@ -37,7 +37,7 @@ class ViewerSections extends Component {
{section.title}
</div>
<div className="section-media">
- {section.mediaTypes}
+ {section.mediaLabels}
</div>
</div>
</div>
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)