diff --git a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.example.js b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.example.js index 183dd688..7ce48f7d 100644 --- a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.example.js +++ b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.example.js @@ -25,17 +25,16 @@ const Form = props => { const PlaceInfo = props => { const { place } = props; - const { address, country, origin, bounds } = place; + const { address, origin, bounds } = place; return (

Submitted place:

); diff --git a/src/components/Topbar/Topbar.js b/src/components/Topbar/Topbar.js index cc32616f..0cd974a8 100644 --- a/src/components/Topbar/Topbar.js +++ b/src/components/Topbar/Topbar.js @@ -98,14 +98,13 @@ class TopbarComponent extends Component { const { currentSearchParams } = this.props; const { search, selectedPlace } = values.location; const { history } = this.props; - const { origin, bounds, country } = selectedPlace; + const { origin, bounds } = selectedPlace; const originMaybe = config.sortSearchByDistance ? { origin } : {}; const searchParams = { ...currentSearchParams, ...originMaybe, address: search, bounds, - country, }; history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, searchParams)); } @@ -151,7 +150,7 @@ class TopbarComponent extends Component { showGenericError, } = this.props; - const { mobilemenu, mobilesearch, address, origin, bounds, country } = parse(location.search, { + const { mobilemenu, mobilesearch, address, origin, bounds } = parse(location.search, { latlng: ['origin'], latlngBounds: ['bounds'], }); @@ -175,13 +174,13 @@ class TopbarComponent extends Component { // Only render current search if full place object is available in the URL params const locationFieldsPresent = config.sortSearchByDistance - ? address && origin && bounds && country - : address && bounds && country; + ? address && origin && bounds + : address && bounds; const initialSearchFormValues = { location: locationFieldsPresent ? { search: address, - selectedPlace: { address, origin, bounds, country }, + selectedPlace: { address, origin, bounds }, } : null, }; diff --git a/src/containers/SearchPage/SearchPage.js b/src/containers/SearchPage/SearchPage.js index ed19ceb3..e509a38f 100644 --- a/src/containers/SearchPage/SearchPage.js +++ b/src/containers/SearchPage/SearchPage.js @@ -100,7 +100,7 @@ export class SearchPageComponent extends Component { const { history, location } = this.props; // parse query parameters, including a custom attribute named category - const { address, country, bounds, mapSearch, ...rest } = parse(location.search, { + const { address, bounds, mapSearch, ...rest } = parse(location.search, { latlng: ['origin'], latlngBounds: ['bounds'], }); @@ -127,7 +127,6 @@ export class SearchPageComponent extends Component { address, ...originMaybe, bounds: viewportBounds, - country, mapSearch: true, ...validFilterParams(rest, this.filters()), }; @@ -367,7 +366,7 @@ SearchPage.loadData = (params, search) => { latlng: ['origin'], latlngBounds: ['bounds'], }); - const { page = 1, address, country, origin, ...rest } = queryParams; + const { page = 1, address, origin, ...rest } = queryParams; const originMaybe = config.sortSearchByDistance && origin ? { origin } : {}; return searchListings({ ...rest, diff --git a/src/util/googleMaps.js b/src/util/googleMaps.js index e64daf75..2be8a364 100644 --- a/src/util/googleMaps.js +++ b/src/util/googleMaps.js @@ -21,16 +21,6 @@ const placeBounds = place => { return null; }; -const placeCountry = place => { - if (place && place.address_components) { - const country = place.address_components.find(component => { - return component.types.includes('country'); - }); - return country ? country.short_name : null; - } - return null; -}; - /** * Get a detailed place object * @@ -60,7 +50,6 @@ export const getPlaceDetails = (placeId, sessionToken) => address: place.formatted_address, origin: placeOrigin(place), bounds: placeBounds(place), - country: placeCountry(place), }); } }); diff --git a/src/util/types.js b/src/util/types.js index b06a3962..aa56750a 100644 --- a/src/util/types.js +++ b/src/util/types.js @@ -72,7 +72,6 @@ propTypes.place = shape({ address: string.isRequired, origin: propTypes.latlng, bounds: propTypes.latlngBounds, // optional viewport bounds - country: string, // country code, e.g. FI, US }); // Denormalised image object