From a9664dbcc01b367373d306b03bf97c4af8e40ada Mon Sep 17 00:00:00 2001 From: Edin Dazdarevic Date: Mon, 17 Apr 2017 13:37:41 +0200 Subject: [PATCH] Small fixes --- web/dist/main.css | 29 +++++++++++++++++------------ web/src/components/Filters.js | 13 ------------- web/src/components/Main.js | 5 ++++- web/src/lib/handlers.js | 2 ++ web/src/lib/router.js | 12 ++++++++++++ 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/web/dist/main.css b/web/dist/main.css index 85bcf21..b782df4 100644 --- a/web/dist/main.css +++ b/web/dist/main.css @@ -181,18 +181,6 @@ html { margin-left: -1px; } -.filter-bottom { - position: fixed; - bottom: 0; - left: 0; - width: 99%; - height: 50px; - display: flex; - text-align: center; - padding-left: 10px; - padding-right: 0; - align-items: baseline; -} .filter-title { width: 40%; @@ -474,7 +462,24 @@ html { display: none; } +.filter-bottom { + display: none; +} + @media (max-width : 768px) { + .filter-bottom { + position: fixed; + bottom: 0; + left: 0; + width: 99%; + height: 50px; + display: flex; + text-align: center; + padding-left: 10px; + padding-right: 0; + align-items: baseline; + } + .listings-count { display: none; } diff --git a/web/src/components/Filters.js b/web/src/components/Filters.js index 86a47b6..55887f1 100644 --- a/web/src/components/Filters.js +++ b/web/src/components/Filters.js @@ -102,19 +102,6 @@ export default class Filters extends React.Component { } onResetSearch (e) { - this.props.dispatch({ - type: 'UPDATE_ROUTE', - action: { - params: { - minPrice: '', - maxPrice: '', - minSize: '', - maxSize: '', - rooms: '', - category: '' - } - } - }) this.props.dispatch({ type: 'RESET_FILTERS' }) diff --git a/web/src/components/Main.js b/web/src/components/Main.js index ce66d1a..dfec2b3 100644 --- a/web/src/components/Main.js +++ b/web/src/components/Main.js @@ -95,7 +95,8 @@ class Main extends React.Component { }); var options = { - componentRestrictions: {country: 'BA'} + componentRestrictions: {country: 'BA'}, + types: [ 'geocode' ] } const regularIdle = () => { @@ -163,6 +164,8 @@ class Main extends React.Component { this.dispatch({type: 'MOBILE_MAP_VIEW'}) map.fitBounds(place.geometry.viewport) } + + map.setZoom(map.zoom + 1); } else { map.setCenter(place.geometry.location) map.setZoom(18) diff --git a/web/src/lib/handlers.js b/web/src/lib/handlers.js index 5e8d133..297ef3d 100644 --- a/web/src/lib/handlers.js +++ b/web/src/lib/handlers.js @@ -390,6 +390,8 @@ const resetFilters = ({type, action}, component) => { rooms: {}, category: {} } + }, () => { + component.router.reset() }) } diff --git a/web/src/lib/router.js b/web/src/lib/router.js index d7d57d6..5a21bd0 100644 --- a/web/src/lib/router.js +++ b/web/src/lib/router.js @@ -3,6 +3,7 @@ import clone from 'lodash.clonedeep' export default class Router { constructor (comp, initialState) { this.component = comp + this.initialState = clone(initialState) this.state = clone(initialState) || {} window.onpopstate = event => { @@ -15,6 +16,17 @@ export default class Router { } } + reset () { + this.state = { + zoom: this.state.zoom, + sort: this.state.sort, + bounds: this.state.bounds, + rooms: {}, + category: {} + } + this.update({}) + } + update (state) { const params = [] if (state.params) {