summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-03-08 22:11:55 +0100
committerJules Laplace <julescarbon@gmail.com>2021-03-08 22:11:55 +0100
commitd2cb17038b8537a609be06be2ed7013dbe27117e (patch)
tree028ceac9edddafc03ce80c49d5a05981bec3fcbe /animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js
parentb5ceb782f40fc1e402d1e58bc1ced2e4038fd787 (diff)
beginning the BIG refactor. moving editor stuff into per-episode hierarchy
Diffstat (limited to 'animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js')
-rw-r--r--animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js93
1 files changed, 0 insertions, 93 deletions
diff --git a/animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js b/animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js
deleted file mode 100644
index 09ba70c..0000000
--- a/animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js
+++ /dev/null
@@ -1,93 +0,0 @@
-import React, { Component } from 'react'
-import { Route } from 'react-router-dom'
-import { bindActionCreators } from 'redux'
-import { connect } from 'react-redux'
-
-import actions from 'app/actions'
-import ParagraphForm from '../components/paragraph.form'
-import ParagraphList from '../components/paragraph.list'
-import { paragraphElementLookup } from '../components/paragraphTypes'
-
-class ParagraphEditor extends Component {
- state = {
- selectedParagraph: null,
- selectedParagraphOffset: 0,
- }
-
- constructor(props) {
- super(props)
- this.handleAnnotationClick = this.handleAnnotationClick.bind(this)
- this.handleParagraphDoubleClick = this.handleParagraphDoubleClick.bind(this)
- this.handleCloseParagraphForm = this.handleCloseParagraphForm.bind(this)
- this.updateSelectedParagraph = this.updateSelectedParagraph.bind(this)
- }
-
- componentDidMount() {
- actions.transcript.buildAllParagraphs()
- }
-
- componentDidUpdate(prevProps) {
- if (this.props.paragraph !== prevProps.paragraph) {
- actions.transcript.buildAllParagraphs()
- }
- }
-
- handleAnnotationClick(e, paragraph, annotation){
- actions.audio.seek(annotation.start_ts)
- }
-
- handleParagraphDoubleClick(e, paragraph) {
- let paragraphNode = e.target
- if (!paragraphNode.classList.contains('paragraph')) {
- paragraphNode = paragraphNode.parentNode
- }
- this.setState({
- selectedParagraph: { ...paragraph },
- selectedParagraphOffset: paragraphNode.offsetTop
- })
- }
-
- updateSelectedParagraph(selectedParagraph) {
- this.setState({ selectedParagraph })
- }
-
- handleCloseParagraphForm() {
- this.setState({ selectedParagraph: null })
- }
-
- render() {
- const { paragraphs } = this.props
- const { selectedParagraph, selectedParagraphOffset } = this.state
- return (
- <div className='paragraphs'>
- <div className='content'>
- <ParagraphList
- paragraphs={paragraphs}
- paragraphElementLookup={paragraphElementLookup}
- selectedParagraph={selectedParagraph}
- onAnnotationClick={this.handleAnnotationClick}
- onParagraphDoubleClick={this.handleParagraphDoubleClick}
- />
- {selectedParagraph &&
- <ParagraphForm
- paragraph={selectedParagraph}
- onUpdate={this.updateSelectedParagraph}
- onClose={this.handleCloseParagraphForm}
- y={selectedParagraphOffset}
- />
- }
- </div>
- </div>
- )
- }
-}
-
-const mapStateToProps = state => ({
- paragraph: state.paragraph.index,
- paragraphs: state.paragraph.paragraphs,
-})
-
-const mapDispatchToProps = dispatch => ({
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(ParagraphEditor)