summaryrefslogtreecommitdiff
path: root/frontend/views/graph/graph.container.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-09-26 14:56:02 +0200
committerJules Laplace <julescarbon@gmail.com>2020-09-26 14:56:02 +0200
commita17b76ac75f506f5da6fe8adf9c36632b60d4226 (patch)
treeabb0af0c4409b830dea2ef808c146223ee973933 /frontend/views/graph/graph.container.js
parent2231a6e1c05b07bb7ec5906716aedec93d02429c (diff)
refactor to use app-rooted js imports
Diffstat (limited to 'frontend/views/graph/graph.container.js')
-rw-r--r--frontend/views/graph/graph.container.js82
1 files changed, 0 insertions, 82 deletions
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 <div />
- if (!this.props.graph.show.res || this.props.graph.show.loading) {
- return (
- <div>
- <GraphHeader />
- <div className='body'>
- <div className='graph loading'>
- <Loader />
- </div>
- </div>
- </div>
- )
- }
- return (
- <div>
- <GraphHeader />
- <div className='body'>
- <GraphEditor />
- <div className='sidebar'>
- {this.props.graph.editor.addingPage && <PageNew />}
- {this.props.graph.editor.editingPage && <PageEdit />}
- </div>
- </div>
- </div>
- )
- }
-}
-
-// <Route exact path='/:graph_name' component={GraphView} />
-const mapStateToProps = state => ({
- graph: state.graph,
-})
-
-const mapDispatchToProps = dispatch => ({
- // uploadActions: bindActionCreators({ ...uploadActions }, dispatch),
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(GraphContainer)