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

@@ -16,7 +16,7 @@ const viewListingDetails= ({type, action}, component) => {
}
const listingsLoaded = ({type, action}, component) => {
const currentListings = component.state.listings;
const currentListings = new Map(); //component.state.listings;
for(const listing of action.listings) {
currentListings.set(listing.url, listing)
@@ -55,6 +55,12 @@ const viewImage = ({type, action}, component) => {
});
}
const searchPlaceChanged = ({type, action}, component) => {
component.setState({
listingDetails: false
});
}
const handlers = {
'SET_MIN_PRICE': setMinPrice,
'LISTINGS_LOADED': listingsLoaded,
@@ -62,6 +68,7 @@ const handlers = {
'PREV_IMAGE': prevImage,
'NEXT_IMAGE': nextImage,
'VIEW_IMAGE': viewImage,
'SEARCH_PLACE_CHANGED': searchPlaceChanged,
'VIEW_LISTING_DETAILS': viewListingDetails
}