diff --git a/src/components/EditListingWizard/EditListingWizard.js b/src/components/EditListingWizard/EditListingWizard.js index a12992a4..8bb20934 100644 --- a/src/components/EditListingWizard/EditListingWizard.js +++ b/src/components/EditListingWizard/EditListingWizard.js @@ -77,16 +77,18 @@ const tabCompleted = (tab, listing) => { /** * Check which wizard tabs are active and which are not yet available. Tab is active if previous - * tab is completed. + * tab is completed. In edit mode all tabs are active. * + * @param isNew flag if a new listing is being created or an old one being edited * @param listing data to be checked * * @return object containing activity / editability of different tabs of this wizard */ -const tabsActive = listing => { +const tabsActive = (isNew, listing) => { return TABS.reduce((acc, tab) => { const previousTabIndex = TABS.findIndex(t => t === tab) - 1; - const isActive = previousTabIndex >= 0 ? tabCompleted(TABS[previousTabIndex], listing) : true; + const isActive = + previousTabIndex >= 0 ? !isNew || tabCompleted(TABS[previousTabIndex], listing) : true; return { ...acc, [tab]: isActive }; }, {}); }; @@ -198,7 +200,7 @@ class EditListingWizard extends Component { const rootClasses = rootClassName || css.root; const classes = classNames(rootClasses, className); const currentListing = ensureListing(listing); - const tabsStatus = tabsActive(currentListing); + const tabsStatus = tabsActive(isNew, currentListing); // If selectedTab is not active, redirect to the beginning of wizard if (!tabsStatus[selectedTab]) { diff --git a/src/components/SearchMap/SearchMap.js b/src/components/SearchMap/SearchMap.js index e9cedce1..6c1f456b 100644 --- a/src/components/SearchMap/SearchMap.js +++ b/src/components/SearchMap/SearchMap.js @@ -241,9 +241,10 @@ export class SearchMapComponent extends Component { const classes = classNames(rootClassName || css.root, className); const mapClasses = mapRootClassName || css.mapRoot; + const listingsWithLocation = originalListings.filter(l => !!l.attributes.geolocation); const listings = coordinatesConfig.fuzzy - ? withCoordinatesObfuscated(originalListings) - : originalListings; + ? withCoordinatesObfuscated(listingsWithLocation) + : listingsWithLocation; // container element listens clicks so that opened SearchMapInfoCard can be closed /* eslint-disable jsx-a11y/no-static-element-interactions */ diff --git a/src/util/types.js b/src/util/types.js index d444498c..feec3558 100644 --- a/src/util/types.js +++ b/src/util/types.js @@ -146,7 +146,7 @@ const LISTING_STATES = [ const listingAttributes = shape({ title: string.isRequired, description: string.isRequired, - geolocation: propTypes.latlng.isRequired, + geolocation: propTypes.latlng, deleted: propTypes.value(false).isRequired, state: oneOf(LISTING_STATES).isRequired, price: propTypes.money, @@ -156,7 +156,7 @@ const listingAttributes = shape({ const ownListingAttributes = shape({ title: string.isRequired, description: string.isRequired, - geolocation: propTypes.latlng.isRequired, + geolocation: propTypes.latlng, deleted: propTypes.value(false).isRequired, state: oneOf(LISTING_STATES).isRequired, price: propTypes.money,