diff --git a/packages/earth-map/src/components/collection/collection-new/CollectionNew.tsx b/packages/earth-map/src/components/collection/collection-new/CollectionNew.tsx index 7a34e280..011be187 100644 --- a/packages/earth-map/src/components/collection/collection-new/CollectionNew.tsx +++ b/packages/earth-map/src/components/collection/collection-new/CollectionNew.tsx @@ -20,11 +20,12 @@ import React, { useState } from 'react'; import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; -import { back, push, replace } from 'redux-first-router'; +import { replace } from 'redux-first-router'; +import Link from 'redux-first-router-link'; import { Card, Input, setupErrors } from '@marapp/earth-shared'; -import { IRouter } from '../../../modules/router/model'; +import { EarthRoutes, IRouter } from '../../../modules/router/model'; import PlacesService from '../../../services/PlacesService'; interface IProps { @@ -34,6 +35,7 @@ interface IProps { const CollectionNew = (props: IProps) => { const { privateGroups, router } = props; + const { prev } = router; const { t } = useTranslation(); const canCreateCollection = !!privateGroups.length; const [saveError, setSaveError] = useState(null); @@ -57,19 +59,6 @@ const CollectionNew = (props: IProps) => { } }; - const onCancel = () => { - // When navigating back to earth view keep track of the current coordinates and active layers, if available - const canGoBack = !!router.prev.pathname; - - if (canGoBack) { - back(); - } - // if the user just hit the /collection/new from the start - else { - push('/earth'); - } - }; - return (
); diff --git a/packages/earth-map/src/components/url/component.tsx b/packages/earth-map/src/components/url/component.tsx index 9d88a97b..a81e0f26 100644 --- a/packages/earth-map/src/components/url/component.tsx +++ b/packages/earth-map/src/components/url/component.tsx @@ -67,6 +67,10 @@ interface IUrl { paramsFromUrl: {}; } +/** + * Dispatches actions based on with payload created from query params + * TODO: Could be removed entirely if we find another way to apply side effects based on query params + */ class UrlComponent extends PureComponent