summaryrefslogtreecommitdiff
path: root/frontend/app/views/page/components/tile.edit.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/views/page/components/tile.edit.js')
-rw-r--r--frontend/app/views/page/components/tile.edit.js86
1 files changed, 0 insertions, 86 deletions
diff --git a/frontend/app/views/page/components/tile.edit.js b/frontend/app/views/page/components/tile.edit.js
deleted file mode 100644
index cae9f73..0000000
--- a/frontend/app/views/page/components/tile.edit.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import React, { Component } from 'react'
-// import { Link } from 'react-router-dom'
-import { bindActionCreators } from 'redux'
-import { connect } from 'react-redux'
-
-// import { history } from 'app/store'
-import actions from 'app/actions'
-import * as pageActions from '../../page/page.actions'
-import * as tileActions from '../../tile/tile.actions'
-
-import { Loader } from 'app/common'
-
-import TileForm from '../components/tile.form'
-
-class TileEdit extends Component {
- state = {
- tile: null
- }
-
- componentDidMount() {
- this.load()
- }
-
- componentDidUpdate(prevProps) {
- if (prevProps.page.editor.currentEditTileId !== this.props.page.editor.currentEditTileId) {
- this.load()
- }
- }
-
- load() {
- const { currentEditTileId } = this.props.page.editor
- const { tiles } = this.props.page.show.res
- if (!tiles) return
- const tile = tiles.filter(tile => tile.id === currentEditTileId)[0]
- console.log('edit', currentEditTileId)
- this.setState({ tile })
- }
-
- handleSubmit(data) {
- actions.tile.update(data)
- .then(response => {
- // console.log(response)
- if (response.status === 'ok') {
- this.props.pageActions.updatePageTile(response.res)
- }
- })
- }
-
- handleClose() {
- this.props.pageActions.hideEditTileForm()
- this.props.tileActions.clearTemporaryTile()
- }
-
- render() {
- const { tile } = this.state
- if (!tile) {
- return (
- <div className='form'>
- <Loader />
- </div>
- )
- }
- return (
- <TileForm
- initialData={tile}
- graph={this.props.graph.show.res}
- page={this.props.page.show.res}
- onSubmit={this.handleSubmit.bind(this)}
- onClose={this.handleClose.bind(this)}
- />
- )
- }
-}
-
-const mapStateToProps = state => ({
- graph: state.graph,
- page: state.page,
- tile: state.tile,
-})
-
-const mapDispatchToProps = dispatch => ({
- pageActions: bindActionCreators({ ...pageActions }, dispatch),
- tileActions: bindActionCreators({ ...tileActions }, dispatch),
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(TileEdit)