From 23b8f5dea63ba5fee87103a0053c86d2a9ea032e Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 16 Jan 2020 10:33:48 +0700 Subject: [PATCH] fixed gpx downloading --- src/components/panels/UserPanel.tsx | 26 +++++++++++++++++++------- src/redux/editor/sagas.ts | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/panels/UserPanel.tsx b/src/components/panels/UserPanel.tsx index b39d60a..d4049fc 100644 --- a/src/components/panels/UserPanel.tsx +++ b/src/components/panels/UserPanel.tsx @@ -20,11 +20,20 @@ import { DIALOGS, TABS } from '~/constants/dialogs'; import { Tooltip } from '~/components/panels/Tooltip'; import { TitleDialog } from '~/components/dialogs/TitleDialog'; -const mapStateToProps = ({ user: { user }, editor: { dialog, dialog_active, is_empty } }) => ({ - dialog, - dialog_active, - user, - is_empty, +const mapStateToProps = ({ + user: { user }, + editor: { dialog, dialog_active }, + map: { route, stickers }, +}) => ({ + editor: { + dialog, + dialog_active, + }, + user: { user }, + map: { + route, + stickers, + } }); const mapDispatchToProps = { @@ -91,7 +100,7 @@ export class UserPanelUnconnected extends PureComponent { openAppInfoDialog = () => { this.setMenuOpened(); this.props.editorSetDialog(DIALOGS.APP_INFO); - this.props.editorSetDialogActive(this.props.dialog !== DIALOGS.APP_INFO); + this.props.editorSetDialogActive(this.props.editor.dialog !== DIALOGS.APP_INFO); }; openOauthFrame = () => { @@ -109,10 +118,12 @@ export class UserPanelUnconnected extends PureComponent { render() { const { - props: { user, dialog, dialog_active, is_empty }, + props: { user: { user }, editor: { dialog, dialog_active }, map: { route, stickers } }, state: { menuOpened }, } = this; + const is_empty = !route.length && !stickers.length; + return (
@@ -154,6 +165,7 @@ export class UserPanelUnconnected extends PureComponent {
+ {!is_empty && (
diff --git a/src/redux/editor/sagas.ts b/src/redux/editor/sagas.ts index 237c4a5..24ddb3a 100644 --- a/src/redux/editor/sagas.ts +++ b/src/redux/editor/sagas.ts @@ -214,7 +214,7 @@ function* keyPressedSaga({ key, target }: ReturnType) { function* getGPXTrackSaga(): SagaIterator { const { route, stickers, title, address }: ReturnType = yield select(selectMap); - if (!route || route.length <= 0) return; + if (!route.length && !stickers.length) return; const track = getGPXString({ route, stickers, title: title || address });