fixed gpx downloading

This commit is contained in:
Fedor Katurov 2020-01-16 10:33:48 +07:00
parent 18cbeed06e
commit 23b8f5dea6
2 changed files with 20 additions and 8 deletions

View file

@ -20,11 +20,20 @@ import { DIALOGS, TABS } from '~/constants/dialogs';
import { Tooltip } from '~/components/panels/Tooltip'; import { Tooltip } from '~/components/panels/Tooltip';
import { TitleDialog } from '~/components/dialogs/TitleDialog'; import { TitleDialog } from '~/components/dialogs/TitleDialog';
const mapStateToProps = ({ user: { user }, editor: { dialog, dialog_active, is_empty } }) => ({ const mapStateToProps = ({
dialog, user: { user },
dialog_active, editor: { dialog, dialog_active },
user, map: { route, stickers },
is_empty, }) => ({
editor: {
dialog,
dialog_active,
},
user: { user },
map: {
route,
stickers,
}
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
@ -91,7 +100,7 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
openAppInfoDialog = () => { openAppInfoDialog = () => {
this.setMenuOpened(); this.setMenuOpened();
this.props.editorSetDialog(DIALOGS.APP_INFO); 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 = () => { openOauthFrame = () => {
@ -109,10 +118,12 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
render() { render() {
const { const {
props: { user, dialog, dialog_active, is_empty }, props: { user: { user }, editor: { dialog, dialog_active }, map: { route, stickers } },
state: { menuOpened }, state: { menuOpened },
} = this; } = this;
const is_empty = !route.length && !stickers.length;
return ( return (
<div> <div>
<TitleDialog /> <TitleDialog />
@ -154,6 +165,7 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
<Icon icon="icon-shot-4" /> <Icon icon="icon-shot-4" />
</button> </button>
</div> </div>
{!is_empty && ( {!is_empty && (
<React.Fragment> <React.Fragment>
<div className="control-sep" /> <div className="control-sep" />

View file

@ -214,7 +214,7 @@ function* keyPressedSaga({ key, target }: ReturnType<typeof editorKeyPressed>) {
function* getGPXTrackSaga(): SagaIterator { function* getGPXTrackSaga(): SagaIterator {
const { route, stickers, title, address }: ReturnType<typeof selectMap> = yield select(selectMap); const { route, stickers, title, address }: ReturnType<typeof selectMap> = yield select(selectMap);
if (!route || route.length <= 0) return; if (!route.length && !stickers.length) return;
const track = getGPXString({ route, stickers, title: title || address }); const track = getGPXString({ route, stickers, title: title || address });