From 4bb72b9f6d2a56fc6bd67f4248fcabfcc8166493 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 17 Jul 2020 18:52:24 +0200 Subject: refactor annotation and paragraph types --- .../components/annotations/annotation.form.js | 43 ++++++++-------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'animism-align/frontend/views/align/components/annotations/annotation.form.js') diff --git a/animism-align/frontend/views/align/components/annotations/annotation.form.js b/animism-align/frontend/views/align/components/annotations/annotation.form.js index 53f640f..01b1663 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.form.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.form.js @@ -11,8 +11,13 @@ import { clamp, timestamp, capitalize } from '../../../../util' import { timeToPosition } from '../../align.util' import { Select } from '../../../../common' +import { + AnnotationFormVideo, + AnnotationFormImage, +} from './annotationForms' + const ANNOTATION_TYPES = [ - 'sentence', 'header', 'paragraph_end', 'video', + 'sentence', 'header', 'paragraph_end', 'video', 'image', 'image_carousel', ].map(name => ({ name, label: capitalize(name.replace('_', ' ')) })) class AnnotationForm extends Component { @@ -105,7 +110,7 @@ class AnnotationForm extends Component { } } render() { - const { timeline, annotation } = this.props + const { timeline, annotation, media } = this.props if (!annotation.start_ts) return
return (
+ } + {annotation.type === 'image' && + + } + {annotation.type === 'image_carousel' && + + }
) } @@ -156,30 +169,6 @@ class AnnotationForm extends Component { ) } - renderVideo() { - const { annotation, media } = this.props - if (!media.lookup) return
- const { lookup, order } = media - const video_list_items = order.filter(id => lookup[id].type === 'video').map(id => { - const video = lookup[id] - return { - name: video.id, - label: video.author + ' - ' + video.title - } - }) - return ( -
-