summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/paragraph/components/paragraph.list.js
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/paragraph/components/paragraph.list.js')
-rw-r--r--animism-align/frontend/app/views/paragraph/components/paragraph.list.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/animism-align/frontend/app/views/paragraph/components/paragraph.list.js b/animism-align/frontend/app/views/paragraph/components/paragraph.list.js
index 1a83569..fdb0f85 100644
--- a/animism-align/frontend/app/views/paragraph/components/paragraph.list.js
+++ b/animism-align/frontend/app/views/paragraph/components/paragraph.list.js
@@ -36,21 +36,20 @@ class ParagraphList extends Component {
setCurrentAnnotation(paragraph, play_ts) {
const { id: currentParagraph, annotations } = paragraph
+ const possibleAnnotations = annotations.filter(a => a.type !== 'footnote')
let currentAnnotation
let annotation
let i = 0, next_i
- let len = annotations.length
+ let len = possibleAnnotations.length
for (let i = 0; i < len - 1; i++) {
next_i = i + 1
- if (annotations[next_i].type === 'footnote') next_i += 1
- if (next_i < len && floatLT(play_ts, annotations[next_i].start_ts)) {
- currentAnnotation = annotations[i].id
+ if (next_i < len && floatLT(play_ts, possibleAnnotations[next_i].start_ts)) {
+ currentAnnotation = possibleAnnotations[i].id
break
}
}
- console.log(currentAnnotation)
if (!currentAnnotation) {
- currentAnnotation = annotations[len-1].id
+ currentAnnotation = possibleAnnotations[len-1].id
}
this.setState({ currentParagraph, currentAnnotation })
}
@@ -62,6 +61,7 @@ class ParagraphList extends Component {
onAnnotationClick, onParagraphDoubleClick,
} = this.props
const { currentParagraph, currentAnnotation } = this.state
+ console.log(currentParagraph, currentAnnotation)
return paragraphs.map((paragraph, i) => {
if (selectedParagraph && selectedParagraph.id === paragraph.id) {
paragraph = selectedParagraph