From 1600ab3446f533a6824512d616131c7d02a037c7 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 20 Oct 2020 19:25:35 +0200 Subject: add footnote type and text plate type. keep track of footnotes when accumulating paragraphs. --- animism-align/frontend/app/views/viewer/viewer.actions.js | 12 +++++++++--- animism-align/frontend/app/views/viewer/viewer.reducer.js | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'animism-align/frontend/app/views/viewer') diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 6894b3a..d5ad61a 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -35,6 +35,7 @@ export const loadSections = () => dispatch => { // keep track of all annotations that constitute the "text" of the essay // these include sentences, headings, and inline media. used to build paragraphs, then reset. let sectionTextAnnotationOrder = [] + let footnoteList = [] // keep track of all annotations that constitute fullscreen events. // these include curtains, title cards, and fullscreen media. @@ -56,7 +57,9 @@ export const loadSections = () => dispatch => { // finish off the previous section. if (currentSection) { currentSection.mediaLabels = Object.keys(currentMediaLabels).sort().join(', ') - currentSection.paragraphs = buildParagraphs(sectionTextAnnotationOrder, currentSection.index) + let { paragraphs, footnotes } = buildParagraphs(sectionTextAnnotationOrder, currentSection.index, footnoteList.length) + currentSection.paragraphs = paragraphs + footnoteList = footnoteList.concat(footnotes) currentSection.end_ts = currentSection.paragraphs[currentSection.paragraphs.length - 1].end_ts } // create a new section and reset state variables @@ -136,7 +139,9 @@ export const loadSections = () => dispatch => { // finished processing all annotations. finish off the last section. if (currentSection) { currentSection.mediaLabels = Object.keys(currentMediaLabels).sort().join(', ') - currentSection.paragraphs = buildParagraphs(sectionTextAnnotationOrder, currentSection.index) + let { paragraphs, footnotes } = buildParagraphs(sectionTextAnnotationOrder, currentSection.index) + currentSection.paragraphs = paragraphs + footnoteList = footnoteList.concat(footnotes) currentSection.end_ts = timeline.duration } @@ -178,8 +183,9 @@ export const loadSections = () => dispatch => { } console.log(sections) + console.log(footnoteList) // console.log(fullscreenTimeline) - dispatch({ type: types.viewer.load_sections, sections }) + dispatch({ type: types.viewer.load_sections, sections, footnoteList }) } const newSection = (annotation, index, mediaIndex) => ({ diff --git a/animism-align/frontend/app/views/viewer/viewer.reducer.js b/animism-align/frontend/app/views/viewer/viewer.reducer.js index d8ffd34..29868aa 100644 --- a/animism-align/frontend/app/views/viewer/viewer.reducer.js +++ b/animism-align/frontend/app/views/viewer/viewer.reducer.js @@ -18,6 +18,7 @@ const initialState = { /* section look and navigation */ sections: { loading: true }, + footnoteList: [], currentSection: null, nextSection: null, autoAdvance: false, @@ -82,6 +83,7 @@ export default function viewerReducer(state = initialState, action) { return { ...state, sections: action.sections, + footnoteList: action.footnoteList, } case types.viewer.set_current_section: -- cgit v1.2.3-70-g09d2