From 2ebe47a0ec566be75522da533e76a2f491227a51 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Oct 2020 19:11:07 +0200 Subject: new annotations --- .../frontend/app/views/align/align.actions.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'animism-align/frontend/app/views/align/align.actions.js') diff --git a/animism-align/frontend/app/views/align/align.actions.js b/animism-align/frontend/app/views/align/align.actions.js index 6eca0a7..524de07 100644 --- a/animism-align/frontend/app/views/align/align.actions.js +++ b/animism-align/frontend/app/views/align/align.actions.js @@ -6,6 +6,7 @@ import throttle from 'lodash.throttle' import debounce from 'lodash.debounce' import { ZOOM_STEPS } from 'app/constants' +import { timestampToSeconds, post } from 'app/utils' import { cutFirstSentence } from 'app/utils/align.utils' export const setScrollPosition = start_ts => dispatch => ( @@ -90,3 +91,21 @@ export const hideAnnotationForm = () => dispatch => { data: {} }) } + + +export const spliceTime = start_ts => dispatch => { + let duration = timestampToSeconds(prompt("How many seconds to add or remove? Enter a positive / negative number")) + if (!duration) { + return + } + console.log(start_ts, duration) + const data = { + start_ts, duration, + } + post(dispatch, types.api, 'splice', '/api/v1/annotation/splice', data) + .then(res => { + console.log(res) + alert(res.count + ' records updated!') + actions.annotation.index() + }) +} \ No newline at end of file -- cgit v1.2.3-70-g09d2