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/page/components/tile.edit.js | 84 ----------------------------- 1 file changed, 84 deletions(-) delete mode 100644 frontend/views/page/components/tile.edit.js (limited to 'frontend/views/page/components/tile.edit.js') diff --git a/frontend/views/page/components/tile.edit.js b/frontend/views/page/components/tile.edit.js deleted file mode 100644 index bfcc34f..0000000 --- a/frontend/views/page/components/tile.edit.js +++ /dev/null @@ -1,84 +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 '../../../store' -import actions from '../../../actions' -import * as pageActions from '../../page/page.actions' -import * as tileActions from '../../tile/tile.actions' - -import { Loader } from '../../../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 tile = this.props.page.show.res.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 ( -
- -
- ) - } - return ( - - ) - } -} - -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) -- cgit v1.2.3-70-g09d2