From d2cb17038b8537a609be06be2ed7013dbe27117e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 8 Mar 2021 22:11:55 +0100 Subject: beginning the BIG refactor. moving editor stuff into per-episode hierarchy --- .../containers/paragraphEditor.container.js | 93 ---------------------- 1 file changed, 93 deletions(-) delete mode 100644 animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js (limited to 'animism-align/frontend/app/views/paragraph/containers/paragraphEditor.container.js') 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 ( -
-
- - {selectedParagraph && - - } -
-
- ) - } -} - -const mapStateToProps = state => ({ - paragraph: state.paragraph.index, - paragraphs: state.paragraph.paragraphs, -}) - -const mapDispatchToProps = dispatch => ({ -}) - -export default connect(mapStateToProps, mapDispatchToProps)(ParagraphEditor) -- cgit v1.2.3-70-g09d2