From 3e2c1d432d73823e66e19d0081b498ace467b231 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 2 Jul 2020 00:35:06 +0200 Subject: display the form --- .../components/annotations/annotation.form.js | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 animism-align/frontend/views/align/components/annotations/annotation.form.js (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 new file mode 100644 index 0000000..9b02478 --- /dev/null +++ b/animism-align/frontend/views/align/components/annotations/annotation.form.js @@ -0,0 +1,95 @@ +import React, { Component } from 'react' +// import { Link } from 'react-router-dom' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import actions from '../../../../actions' +// import * as alignActions from '../align.actions' + +import { ZOOM_STEPS } from '../../constants' +import { clamp } from '../../../../util' +import { timeToPosition } from '../../align.util' +import { Select } from '../../../../common' + +const TIMESTAMP_TYPES = ['sentence', 'header'].map(name => ({ name, label: name })) + +class AnnotationForm extends Component { + state = { + data: {}, + } + constructor(props){ + super(props) + this.handleChange = this.handleChange.bind(this) + this.handleSelect = this.handleSelect.bind(this) + } + componentDidMount(){ + this.setState({ + data: { ...this.props.annotation }, + }) + } + componentDidUpdate(prevProps){ + if (this.props.annotation !== prevProps.annotation) { + this.setState({ + data: { ...this.props.annotation }, + }) + } + } + handleChange(e) { + const { name, value } = e.target + this.handleSelect(name, value) + } + handleSelect(name, value) { + this.setState({ + data: { + ...this.state.data, + [name]: value, + } + }) + } + render() { + const { timeline } = this.props + const { data } = this.state + if (!data.start_ts) return
+ return ( +
+
+