Small fixes

This commit is contained in:
Edin Dazdarevic
2017-04-17 13:37:41 +02:00
parent 9de077df32
commit a9664dbcc0
5 changed files with 35 additions and 26 deletions

29
web/dist/main.css vendored
View File

@@ -181,18 +181,6 @@ html {
margin-left: -1px; 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 { .filter-title {
width: 40%; width: 40%;
@@ -474,7 +462,24 @@ html {
display: none; display: none;
} }
.filter-bottom {
display: none;
}
@media (max-width : 768px) { @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 { .listings-count {
display: none; display: none;
} }

View File

@@ -102,19 +102,6 @@ export default class Filters extends React.Component {
} }
onResetSearch (e) { onResetSearch (e) {
this.props.dispatch({
type: 'UPDATE_ROUTE',
action: {
params: {
minPrice: '',
maxPrice: '',
minSize: '',
maxSize: '',
rooms: '',
category: ''
}
}
})
this.props.dispatch({ this.props.dispatch({
type: 'RESET_FILTERS' type: 'RESET_FILTERS'
}) })

View File

@@ -95,7 +95,8 @@ class Main extends React.Component {
}); });
var options = { var options = {
componentRestrictions: {country: 'BA'} componentRestrictions: {country: 'BA'},
types: [ 'geocode' ]
} }
const regularIdle = () => { const regularIdle = () => {
@@ -163,6 +164,8 @@ class Main extends React.Component {
this.dispatch({type: 'MOBILE_MAP_VIEW'}) this.dispatch({type: 'MOBILE_MAP_VIEW'})
map.fitBounds(place.geometry.viewport) map.fitBounds(place.geometry.viewport)
} }
map.setZoom(map.zoom + 1);
} else { } else {
map.setCenter(place.geometry.location) map.setCenter(place.geometry.location)
map.setZoom(18) map.setZoom(18)

View File

@@ -390,6 +390,8 @@ const resetFilters = ({type, action}, component) => {
rooms: {}, rooms: {},
category: {} category: {}
} }
}, () => {
component.router.reset()
}) })
} }

View File

@@ -3,6 +3,7 @@ import clone from 'lodash.clonedeep'
export default class Router { export default class Router {
constructor (comp, initialState) { constructor (comp, initialState) {
this.component = comp this.component = comp
this.initialState = clone(initialState)
this.state = clone(initialState) || {} this.state = clone(initialState) || {}
window.onpopstate = event => { 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) { update (state) {
const params = [] const params = []
if (state.params) { if (state.params) {