diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-08 23:52:06 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-08 23:52:06 +0200 |
| commit | 49fb1cf616b31792729a012eed9bf82e9fa91e8f (patch) | |
| tree | 627f150aa418202d7b443ef800dce16616b3739c /animism-align/frontend/views/align/components | |
| parent | 18472645a7879baf00332a7ee5be8c4338bb8d21 (diff) | |
displaying media annotations. delete annotations
Diffstat (limited to 'animism-align/frontend/views/align/components')
3 files changed, 31 insertions, 6 deletions
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 <div></div> @@ -122,7 +135,10 @@ class AnnotationForm extends Component { /> <div className='ts'>{timestamp(annotation.start_ts, 1, true)}</div> </div> - <button onClick={this.handleSubmit}>Save</button> + <div> + {annotation.id !== 'new' && <button onClick={this.handleDestroy}>Delete</button>} + <button onClick={this.handleSubmit}>Save</button> + </div> </div> ) } 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 ( + <div + className={className} + style={{ top: y }} + onClick={e => onClick(e, annotation)} + onDoubleClick={e => onDoubleClick(e, annotation)} + >LOADING...</div> + ) + } if (!(annotation.settings.media_id in media)) { return ( <div @@ -77,9 +88,7 @@ export const AnnotationVideo = ({ y, annotation, media, selected, onClick, onDou onDoubleClick={e => onDoubleClick(e, annotation)} > <div className='img'> - <Link to={"/media/" + data.id + "/edit/"}> - <img src={thumbnailURL(data)} alt={data.title} /> - </Link> + <img src={thumbnailURL(data)} alt={data.title} /> </div> <div className='meta center'> <div> |
