Save seen listings in localStorage
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { markSeen } from './api';
|
||||
|
||||
const setMaxPrice = ({ type, action }, component) => {
|
||||
const maxPrice = parseFloat(action.maxPrice);
|
||||
component.setState({
|
||||
@@ -48,6 +50,8 @@ const viewListingDetails = ({ type, action }, component) => {
|
||||
listingId: action.id,
|
||||
descriptionExpanded: false,
|
||||
imageIndex: 0
|
||||
}, () => {
|
||||
markSeen(action.id);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -156,11 +160,22 @@ const setCategory = ({type, action}, component) => {
|
||||
const onListingMouseOver = ({type, action}, component) => {
|
||||
const marker = component.findMarker(action.id);
|
||||
if (marker) {
|
||||
marker.marker.setIcon(component.hoveredMarkerIcon());
|
||||
const seen = component.isSeen(action.id);
|
||||
if (seen) {
|
||||
marker.marker.setIcon(component.visitedHoveredMarkerIcon());
|
||||
} else {
|
||||
marker.marker.setIcon(component.hoveredMarkerIcon());
|
||||
}
|
||||
|
||||
marker.marker.setAnimation(google.maps.Animation.BOUNCE);
|
||||
setTimeout(() => {
|
||||
marker.marker.setAnimation(null);
|
||||
marker.marker.setIcon(component.defaultMarkerIcon());
|
||||
|
||||
if (seen) {
|
||||
marker.marker.setIcon(component.visitedMarkerIcon());
|
||||
} else {
|
||||
marker.marker.setIcon(component.defaultMarkerIcon());
|
||||
}
|
||||
} , 710);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user