Only show listings that are visible in the current view

This commit is contained in:
Edin Dazdarevic
2017-04-02 04:49:22 +02:00
parent e02cce155b
commit 80aded2fc3
4 changed files with 62 additions and 45 deletions

View File

@@ -51,7 +51,7 @@ class Main extends React.Component {
};
var searchBox = new google.maps.places.Autocomplete(input, options);
searchBox.addListener('place_changed', function() {
searchBox.addListener('place_changed', () => {
var place = searchBox.getPlace();
if (!place.geometry) {
@@ -66,6 +66,7 @@ class Main extends React.Component {
map.setZoom(18);
}
console.log(map.getBounds());
this.dispatch({type: 'SEARCH_PLACE_CHANGED'});
});
control.addEventListener('click', (e) => {
@@ -154,7 +155,10 @@ class Main extends React.Component {
onBackClick={this.onBackClick.bind(this)}/>);
} else {
children.push(<Filters filters={this.state.filters} dispatch={this.dispatch.bind(this)} onClose={this.onCloseClick.bind(this)}/>);
children.push(<Listings onListingClick={this.onListingClick.bind(this)}/>);
children.push(<Listings
listings={this.state.listings}
dispatch={this.dispatch.bind(this)}
onListingClick={this.onListingClick.bind(this)}/>);
}
const content = (
<div className="right-content">