homeflowjs 1.0.86 → 1.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useMemo, Children } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { propertiesByPage, updatePageInURL } from '../property-utils/property-utils';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
usePropertyInfiniteScroll,
|
|
7
|
+
useLoadPreviousProperties
|
|
8
|
+
} from '../../hooks';
|
|
9
|
+
import {
|
|
10
|
+
updateLastSearchOnPropertyCardClick,
|
|
11
|
+
updateLastSearchPageInLocalStorage
|
|
12
|
+
} from '../../app/user-history.js';
|
|
7
13
|
|
|
8
14
|
const ConditionalWrapper = ({ condition, wrapper, children }) => (
|
|
9
15
|
condition ? wrapper(children) : children
|
|
10
16
|
);
|
|
11
17
|
|
|
12
18
|
const PropertiesDisplay = ({
|
|
13
|
-
properties,
|
|
14
19
|
Item,
|
|
15
20
|
displayType,
|
|
16
21
|
infiniteScroll,
|
|
@@ -22,6 +27,8 @@ const PropertiesDisplay = ({
|
|
|
22
27
|
previousBtnClasses,
|
|
23
28
|
...other
|
|
24
29
|
}) => {
|
|
30
|
+
const properties = useSelector(state => state?.properties?.properties) || [];
|
|
31
|
+
|
|
25
32
|
if (!properties?.length) {
|
|
26
33
|
if (inserts.length > 0) {
|
|
27
34
|
return (
|
|
@@ -71,7 +78,9 @@ const PropertiesDisplay = ({
|
|
|
71
78
|
}, [properties]);
|
|
72
79
|
|
|
73
80
|
const addWrapper = displayType === 'list';
|
|
74
|
-
const showPreviousBtn = includePreviousBtn
|
|
81
|
+
const showPreviousBtn = includePreviousBtn
|
|
82
|
+
&& hasPreviousPage
|
|
83
|
+
&& !loadingPreviousProperties;
|
|
75
84
|
const showPreviousLoader = includePreviousBtn
|
|
76
85
|
&& InfiniteScrollLoader
|
|
77
86
|
&& hasPreviousPage
|
|
@@ -136,7 +145,11 @@ const PropertiesDisplay = ({
|
|
|
136
145
|
return (
|
|
137
146
|
<React.Fragment key={property.property_id}>
|
|
138
147
|
{inserts[0].component}
|
|
139
|
-
<Item
|
|
148
|
+
<Item
|
|
149
|
+
property={property}
|
|
150
|
+
onClick={() => visitPropertyUpdate(property.property_id)}
|
|
151
|
+
{...other}
|
|
152
|
+
/>
|
|
140
153
|
</React.Fragment>
|
|
141
154
|
);
|
|
142
155
|
} else if (
|
|
@@ -148,7 +161,11 @@ const PropertiesDisplay = ({
|
|
|
148
161
|
if (findResult && !removeLastInsert) {
|
|
149
162
|
return (
|
|
150
163
|
<React.Fragment key={property.property_id}>
|
|
151
|
-
<Item
|
|
164
|
+
<Item
|
|
165
|
+
property={property}
|
|
166
|
+
onClick={() => visitPropertyUpdate(property.property_id)}
|
|
167
|
+
{...other}
|
|
168
|
+
/>
|
|
152
169
|
{findResult.component}
|
|
153
170
|
</React.Fragment>
|
|
154
171
|
);
|
|
@@ -186,7 +203,11 @@ const PropertiesDisplay = ({
|
|
|
186
203
|
{items}
|
|
187
204
|
</div>
|
|
188
205
|
{showScrollRef && (
|
|
189
|
-
<div
|
|
206
|
+
<div
|
|
207
|
+
ref={infiniteScrollRef}
|
|
208
|
+
className="hf-property-results__infinite-scroll-trigger"
|
|
209
|
+
style={{ height: '1px', opacity: 0 }}
|
|
210
|
+
/>
|
|
190
211
|
)}
|
|
191
212
|
{showScrollLoader && (
|
|
192
213
|
<InfiniteScrollLoader />
|
|
@@ -196,8 +217,7 @@ const PropertiesDisplay = ({
|
|
|
196
217
|
};
|
|
197
218
|
|
|
198
219
|
PropertiesDisplay.propTypes = {
|
|
199
|
-
|
|
200
|
-
Item: PropTypes.elementType.isRequired,
|
|
220
|
+
Item: PropTypes.elementType,
|
|
201
221
|
displayType: PropTypes.string.isRequired,
|
|
202
222
|
infiniteScroll: PropTypes.bool.isRequired,
|
|
203
223
|
includePreviousBtn: PropTypes.bool.isRequired,
|
|
@@ -208,6 +228,7 @@ PropertiesDisplay.propTypes = {
|
|
|
208
228
|
};
|
|
209
229
|
|
|
210
230
|
PropertiesDisplay.defaultProps = {
|
|
231
|
+
Item: null,
|
|
211
232
|
inserts: [],
|
|
212
233
|
removeLastInsert: false,
|
|
213
234
|
InfiniteScrollLoader: null,
|
|
@@ -215,8 +236,4 @@ PropertiesDisplay.defaultProps = {
|
|
|
215
236
|
noResultsMessage: <p>There were no properties matching your search.</p>,
|
|
216
237
|
};
|
|
217
238
|
|
|
218
|
-
|
|
219
|
-
properties: state.properties.properties || [],
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
export default connect(mapStateToProps)(PropertiesDisplay);
|
|
239
|
+
export default PropertiesDisplay;
|