From a17b76ac75f506f5da6fe8adf9c36632b60d4226 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 26 Sep 2020 14:56:02 +0200 Subject: refactor to use app-rooted js imports --- frontend/views/graph/graph.container.js | 82 --------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 frontend/views/graph/graph.container.js (limited to 'frontend/views/graph/graph.container.js') diff --git a/frontend/views/graph/graph.container.js b/frontend/views/graph/graph.container.js deleted file mode 100644 index 7f53d64..0000000 --- a/frontend/views/graph/graph.container.js +++ /dev/null @@ -1,82 +0,0 @@ -import React, { Component } from 'react' -import { Route } from 'react-router-dom' -import { bindActionCreators } from 'redux' -import { connect } from 'react-redux' - -import './graph.css' - -import actions from '../../actions' -import { Loader } from '../../common' - -// import * as uploadActions from './upload.actions' - -import PageNew from './components/page.new' -import PageEdit from './components/page.edit' - -import GraphHeader from './components/graph.header' -import GraphEditor from './components/graph.editor' - -class GraphContainer extends Component { - componentDidMount() { - if (this.shouldShowGraph()) this.load() - } - componentDidUpdate(prevProps) { - if (this.shouldLoadGraph(prevProps)) this.load() - } - shouldShowGraph() { - const { graph_name, page_name } = this.props.match.params - return (graph_name && !page_name && graph_name !== 'index') - } - shouldLoadGraph(prevProps) { - const { graph, location } = this.props - const { key } = location - if (key === prevProps.location.key) return false - if (!this.shouldShowGraph()) return false - return (graph.show.name === prevProps.graph.show.name) - } - load() { - actions.site.setSiteTitle("loading " + this.props.match.params.graph_name + "...") - actions.graph.show('name/' + this.props.match.params.graph_name) - .then(data => { - actions.site.setSiteTitle(data.res.title) - }) - } - render() { - if (!this.shouldShowGraph()) return
- if (!this.props.graph.show.res || this.props.graph.show.loading) { - return ( -
- -
-
- -
-
-
- ) - } - return ( -
- -
- -
- {this.props.graph.editor.addingPage && } - {this.props.graph.editor.editingPage && } -
-
-
- ) - } -} - -// -const mapStateToProps = state => ({ - graph: state.graph, -}) - -const mapDispatchToProps = dispatch => ({ - // uploadActions: bindActionCreators({ ...uploadActions }, dispatch), -}) - -export default connect(mapStateToProps, mapDispatchToProps)(GraphContainer) -- cgit v1.2.3-70-g09d2