From 49fb1cf616b31792729a012eed9bf82e9fa91e8f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 8 Jul 2020 23:52:06 +0200 Subject: displaying media annotations. delete annotations --- animism-align/frontend/views/align/align.css | 7 +++++-- .../align/components/annotations/annotation.form.js | 18 +++++++++++++++++- .../align/components/annotations/annotation.index.js | 4 ++-- .../align/components/annotations/annotation.types.js | 15 ++++++++++++--- 4 files changed, 36 insertions(+), 8 deletions(-) (limited to 'animism-align/frontend') diff --git a/animism-align/frontend/views/align/align.css b/animism-align/frontend/views/align/align.css index 38a2bc7..077799a 100644 --- a/animism-align/frontend/views/align/align.css +++ b/animism-align/frontend/views/align/align.css @@ -99,6 +99,7 @@ canvas { .script { align-self: flex-end; height: 100%; + z-index: 1; } /* Annotations */ @@ -144,7 +145,7 @@ canvas { /* Annotation index */ .annotationIndex { - width: 405px; + width: 800px; } .annotationIndex .annotation { position: absolute; @@ -165,7 +166,9 @@ canvas { z-index: 1; background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.4)); } - +.annotationIndex .annotation.media { + left: calc(405px + 0.5rem); +} .annotation.sentence.even { background-color: #83b; } 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 0a71233..eb5c0ad 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.form.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.form.js @@ -23,6 +23,7 @@ class AnnotationForm extends Component { this.handleSettingsSelect = this.handleSettingsSelect.bind(this) this.handleKeyDown = this.handleKeyDown.bind(this) this.handleSubmit = this.handleSubmit.bind(this) + this.handleDestroy = this.handleDestroy.bind(this) this.textareaRef = React.createRef() } componentDidMount() { @@ -91,6 +92,18 @@ class AnnotationForm extends Component { }) } } + handleDestroy() { + const { annotation } = this.props + if (annotation.id === 'new') { + actions.align.hideAnnotationForm() + } else { + actions.annotation.destroy(annotation) + .then(response => { + console.log(response) + actions.align.hideAnnotationForm() + }) + } + } render() { const { timeline, annotation } = this.props if (!annotation.start_ts) return
@@ -122,7 +135,10 @@ class AnnotationForm extends Component { />
{timestamp(annotation.start_ts, 1, true)}
- +
+ {annotation.id !== 'new' && } + +
) } diff --git a/animism-align/frontend/views/align/components/annotations/annotation.index.js b/animism-align/frontend/views/align/components/annotations/annotation.index.js index 3a78dd4..dae64df 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.index.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.index.js @@ -32,7 +32,7 @@ class AnnotationIndex extends Component { let secondsPerPixel = ZOOM_STEPS[zoom] * 0.1 // 0.1 sec / step let widthTimeDuration = INNER_HEIGHT * secondsPerPixel // secs per pixel - let timeMin = start_ts - 30.0 + let timeMin = start_ts - 50.0 let timeMax = Math.min(start_ts + widthTimeDuration, duration) const items = order.filter(id => { @@ -113,7 +113,7 @@ const mapStateToProps = state => ({ timeline: state.align.timeline, annotationInForm: state.align.annotation, index: state.annotation.index, - media: state.media.index, + media: state.media.index.lookup, }) const mapDispatchToProps = dispatch => ({ diff --git a/animism-align/frontend/views/align/components/annotations/annotation.types.js b/animism-align/frontend/views/align/components/annotations/annotation.types.js index b927a12..309e42e 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.types.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.types.js @@ -58,6 +58,17 @@ export const AnnotationParagraphEnd = ({ y, annotation, selected, onClick, onDou export const AnnotationVideo = ({ y, annotation, media, selected, onClick, onDoubleClick }) => { const { start_ts, text } = annotation const className = selected ? 'annotation media video selected' : 'annotation media video' + console.log(media) + if (!media) { + return ( +
onClick(e, annotation)} + onDoubleClick={e => onDoubleClick(e, annotation)} + >LOADING...
+ ) + } if (!(annotation.settings.media_id in media)) { return (
onDoubleClick(e, annotation)} >
- - {data.title} - + {data.title}
-- cgit v1.2.3-70-g09d2