From 7c931f4f6dfae45a6e600f7703f97b09dc97f2c1 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Wed, 22 Jan 2020 13:03:52 +0700 Subject: [PATCH] clearing route on new position --- src/components/panels/EditorPanel.tsx | 53 ++++++++++++++++----------- src/redux/editor/sagas.ts | 2 +- src/styles/panel.less | 4 ++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/components/panels/EditorPanel.tsx b/src/components/panels/EditorPanel.tsx index 18a1683..e01bb5e 100644 --- a/src/components/panels/EditorPanel.tsx +++ b/src/components/panels/EditorPanel.tsx @@ -17,10 +17,15 @@ import { import { Tooltip } from '~/components/panels/Tooltip'; import { IState } from '~/redux/store'; import { selectEditor } from '~/redux/editor/selectors'; -import pick from 'ramda/es/pick'; +import { selectMap } from '~/redux/map/selectors'; -const mapStateToProps = (state: IState) => - pick(['mode', 'changed', 'editing', 'features', 'history'], selectEditor(state)); +const mapStateToProps = (state: IState) => { + const { mode, changed, editing, features, history } = selectEditor(state); + const { route, stickers } = selectMap(state); + return { + mode, changed, editing, features, history, route, stickers, + } +} const mapDispatchToProps = { editorChangeMode, @@ -73,8 +78,13 @@ class EditorPanelUnconnected extends PureComponent { editing, features: { routing }, history: { records, position }, + route, stickers, } = this.props; + const can_undo = records.length > 0 && position > 0; + const can_redo = records.length && records.length - 1 > position; + const can_clear = route.length > 0 || stickers.length > 0; + return (
{ this.panel = el; }} > -
- + +
@@ -135,18 +156,6 @@ class EditorPanelUnconnected extends PureComponent {
-
- -
- -
-