From e56e49acf41f02fe0d50bd9cf54a8e9b489b3a15 Mon Sep 17 00:00:00 2001 From: muerwre Date: Mon, 26 Nov 2018 14:14:58 +0700 Subject: [PATCH] redux: half-completed editor panel --- src/components/panels/EditorPanel.jsx | 45 ++++++++++++++++----------- src/modules/Editor.js | 11 ++++--- src/redux/user/actions.js | 3 ++ src/redux/user/constants.js | 3 ++ src/redux/user/reducer.js | 2 ++ src/redux/user/sagas.js | 27 +++++++++++++++- 6 files changed, 67 insertions(+), 24 deletions(-) diff --git a/src/components/panels/EditorPanel.jsx b/src/components/panels/EditorPanel.jsx index ed5dde0..8f86f73 100644 --- a/src/components/panels/EditorPanel.jsx +++ b/src/components/panels/EditorPanel.jsx @@ -9,7 +9,7 @@ import { EditorDialog } from '$components/panels/EditorDialog'; import { LogoPreview } from '$components/logo/LogoPreview'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -import { setMode } from '$redux/user/actions'; +import { setMode, startEditing, stopEditing } from '$redux/user/actions'; import type { UserType } from '$constants/types'; import { editor } from '$modules/Editor'; @@ -19,19 +19,17 @@ type Props = { mode: String, changed: Boolean, distance: Number, - // not implemented title: String, address: String, - mode: String, - editing: Boolean, logo: String, routerPoints: Number, - estimateTime: Number, activeSticker: String, - title: String, - address: String, + estimateTime: Number, // todo: implement! setMode: Function, + startEditing: Function, + stopEditing: Function, + } class Component extends React.PureComponent { @@ -50,15 +48,16 @@ class Component extends React.PureComponent { // startLogoMode = () => this.props.editor.changeMode(MODES.LOGO); // startSaveMode = () => this.props.editor.changeMode(MODES.SAVE); - stopEditing = () => { - if (!this.props.changed) { - editor.cancelEditing(); - } else { - editor.changeMode(MODES.CONFIRM_CANCEL); - } - }; + // stopEditing = () => { + // if (!this.props.changed) { + // editor.cancelEditing(); + // } else { + // // editor.changeMode(MODES.CONFIRM_CANCEL); + // this.props.setMode(MODES.CONFIRM_CANCEL); + // } + // }; - startEditing = () => editor.startEditing(); + // startEditing = () => editor.startEditing(); render() { const { @@ -145,7 +144,7 @@ class Component extends React.PureComponent {
@@ -163,7 +162,7 @@ class Component extends React.PureComponent {
-