mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 09:13:14 +10:00
Merge pull request #736 from sharetribe/keep-filters-when-editing-topbar-location
Keep other filter values when submitting another location in the search page
This commit is contained in:
commit
d1b768dfd9
4 changed files with 12 additions and 6 deletions
|
|
@ -222,10 +222,12 @@ class TopbarComponent extends Component {
|
|||
}
|
||||
|
||||
handleSubmit(values) {
|
||||
const { currentPage, location } = this.props;
|
||||
const { search, selectedPlace } = values.location;
|
||||
const { history } = this.props;
|
||||
const { origin, bounds, country } = selectedPlace;
|
||||
const searchParams = { address: search, origin, bounds, country };
|
||||
const restParams = currentPage === 'SearchPage' ? parse(location.search) : {};
|
||||
const searchParams = { ...restParams, address: search, origin, bounds, country };
|
||||
history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, searchParams));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ export class SearchPageComponent extends Component {
|
|||
mainEntity: [schemaMainEntity],
|
||||
}}
|
||||
>
|
||||
<TopbarContainer className={topbarClasses} />
|
||||
<TopbarContainer className={topbarClasses} currentPage="SearchPage" />
|
||||
<div className={css.container}>
|
||||
<div className={css.searchResultContainer}>
|
||||
<SearchFilters
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ exports[`SearchPageComponent matches snapshot 1`] = `
|
|||
scrollingDisabled={false}
|
||||
title="SearchPage.schemaTitle"
|
||||
>
|
||||
<withRouter(Connect(TopbarContainerComponent)) />
|
||||
<withRouter(Connect(TopbarContainerComponent))
|
||||
currentPage="SearchPage"
|
||||
/>
|
||||
<div>
|
||||
<div>
|
||||
<withRouter(InjectIntl(SearchFiltersComponent))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { bool, func, number, object, shape, string } from 'prop-types';
|
||||
import { compose } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
|
@ -12,6 +12,7 @@ import { Topbar } from '../../components';
|
|||
export const TopbarContainerComponent = props => {
|
||||
const {
|
||||
authInProgress,
|
||||
currentPage,
|
||||
currentUser,
|
||||
currentUserHasListings,
|
||||
currentUserHasOrders,
|
||||
|
|
@ -31,6 +32,7 @@ export const TopbarContainerComponent = props => {
|
|||
return (
|
||||
<Topbar
|
||||
authInProgress={authInProgress}
|
||||
currentPage={currentPage}
|
||||
currentUser={currentUser}
|
||||
currentUserHasListings={currentUserHasListings}
|
||||
currentUserHasOrders={currentUserHasOrders}
|
||||
|
|
@ -50,16 +52,16 @@ export const TopbarContainerComponent = props => {
|
|||
};
|
||||
|
||||
TopbarContainerComponent.defaultProps = {
|
||||
currentPage: null,
|
||||
currentUser: null,
|
||||
currentUserHasOrders: null,
|
||||
notificationCount: 0,
|
||||
sendVerificationEmailError: null,
|
||||
};
|
||||
|
||||
const { bool, func, number, object, shape } = PropTypes;
|
||||
|
||||
TopbarContainerComponent.propTypes = {
|
||||
authInProgress: bool.isRequired,
|
||||
currentPage: string,
|
||||
currentUser: propTypes.currentUser,
|
||||
currentUserHasListings: bool.isRequired,
|
||||
currentUserHasOrders: bool,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue