homeflowjs 0.7.4 → 0.7.8

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.
@@ -10,6 +10,11 @@ export const setThemePreferences = (payload) => ({
10
10
  payload,
11
11
  });
12
12
 
13
+ export const setThemeSettings = (payload) => ({
14
+ type: AppActionTypes.SET_THEME_SETTINGS,
15
+ payload,
16
+ });
17
+
13
18
  export const setAuthenticityToken = (payload) => ({
14
19
  type: AppActionTypes.SET_AUTHENTICITY_TOKEN,
15
20
  payload,
@@ -1,6 +1,7 @@
1
1
  const AppActionTypes = {
2
2
  SET_LOADING: 'SET_LOADING',
3
3
  SET_THEME_PREFERENCES: 'SET_THEME_PREFERENCES',
4
+ SET_THEME_SETTINGS: 'SET_THEME_SETTINGS',
4
5
  SET_AUTHENTICITY_TOKEN: 'SET_AUTHENTICITY_TOKEN',
5
6
  };
6
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.7.4",
3
+ "version": "0.7.8",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,7 +18,9 @@ const PropertiesList = ({ properties, ListItem, infiniteScroll }) => {
18
18
  };
19
19
  });
20
20
 
21
- const items = propertiesByPage(properties).map((page) => (
21
+ const propertiesToRender = properties || [];
22
+
23
+ const items = propertiesByPage(propertiesToRender).map((page) => (
22
24
  <div
23
25
  data-result-page={page[0].resultPage}
24
26
  key={uniqueKey()}
@@ -38,11 +40,15 @@ const PropertiesList = ({ properties, ListItem, infiniteScroll }) => {
38
40
  };
39
41
 
40
42
  PropertiesList.propTypes = {
41
- properties: PropTypes.array.isRequired,
43
+ properties: PropTypes.array,
42
44
  ListItem: PropTypes.elementType.isRequired,
43
45
  infiniteScroll: PropTypes.bool.isRequired,
44
46
  };
45
47
 
48
+ PropertiesList.defaultProps = {
49
+ properties: [],
50
+ };
51
+
46
52
  const mapStateToProps = state => ({
47
53
  properties: state.properties.properties,
48
54
  });
@@ -14,6 +14,7 @@ const INITIAL_STATE = {
14
14
  googleMaps: true,
15
15
  },
16
16
  themePreferences: {},
17
+ themeSettings: {},
17
18
  };
18
19
 
19
20
  const appReducer = (state = INITIAL_STATE, action) => {
@@ -31,6 +32,11 @@ const appReducer = (state = INITIAL_STATE, action) => {
31
32
  ...state,
32
33
  themePreferences: action.payload,
33
34
  };
35
+ case AppActionTypes.SET_THEME_SETTINGS:
36
+ return {
37
+ ...state,
38
+ themeSettings: action.payload,
39
+ };
34
40
  case AppActionTypes.SET_AUTHENTICITY_TOKEN:
35
41
  return {
36
42
  ...state,
package/search/index.js CHANGED
@@ -9,8 +9,10 @@ import StatusCheckbox from './status-checkbox/status-checkbox.component';
9
9
  import GenericSearchField from './generic-search-field/generic-search-field.component';
10
10
  import GeolocateButton from './geolocate-button/geolocate-button.component';
11
11
  import SaveSearchButton from './save-search-button/save-search-button.component';
12
+ import RemoveSavedSearchButton from '../properties/remove-saved-property-button/remove-saved-property-button.component';
12
13
  import SavedSearch from './saved-search/saved-search.component';
13
14
  import propertySearch from './property-search/property-search';
15
+ import generateSearchDescription from './saved-search/generate-description';
14
16
 
15
17
  export {
16
18
  SearchForm,
@@ -23,6 +25,8 @@ export {
23
25
  StatusCheckbox,
24
26
  GenericSearchField,
25
27
  GeolocateButton,
28
+ RemoveSavedSearchButton,
29
+ generateSearchDescription,
26
30
  SaveSearchButton,
27
31
  SavedSearch,
28
32
  propertySearch,
@@ -14,6 +14,7 @@ class SearchForm extends Component {
14
14
  const {
15
15
  defaultSort,
16
16
  defaultChannel,
17
+ defaultStatus,
17
18
  search,
18
19
  setSearch,
19
20
  setInitialSearch,
@@ -27,10 +28,14 @@ class SearchForm extends Component {
27
28
  if (defaultSort && !searchFromFragment.sorted) {
28
29
  searchFromFragment.sorted = defaultSort;
29
30
  }
31
+ if (defaultStatus && !searchFromFragment.status) {
32
+ searchFromFragment.status = defaultStatus;
33
+ }
30
34
  setInitialSearch(searchFromFragment);
31
35
  setSearch(searchFromFragment);
32
36
  } else {
33
37
  if (defaultSort && !search.sorted) setSearchField({ sorted: defaultSort });
38
+ if (defaultStatus && !search.status) setSearchField({ status: defaultStatus });
34
39
  }
35
40
 
36
41
  const place = Homeflow.get('place');
@@ -62,6 +67,7 @@ class SearchForm extends Component {
62
67
  const {
63
68
  defaultSort,
64
69
  defaultChannel,
70
+ defaultStatus,
65
71
  search,
66
72
  setSearch,
67
73
  setSearchField,
@@ -96,6 +102,7 @@ SearchForm.propTypes = {
96
102
 
97
103
  const mapStateToProps = state => ({
98
104
  search: state.search.currentSearch,
105
+ defaultStatus: state.app.themePreferences.default_search_status,
99
106
  });
100
107
 
101
108
  const mapDispatchToProps = {
package/store.js CHANGED
@@ -3,7 +3,7 @@ import thunk from 'redux-thunk';
3
3
  import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
4
4
  // import logger from 'redux-logger';
5
5
  import rootReducer from './reducers';
6
- import { setThemePreferences, setAuthenticityToken } from './actions/app.actions';
6
+ import { setThemePreferences, setThemeSettings, setAuthenticityToken } from './actions/app.actions';
7
7
  import { fetchUser } from './actions/user.actions';
8
8
  import { setProperties, setPagination, setPropertyLinksAsync } from './actions/properties.actions';
9
9
  // import { fetchCompanyPreferences } from './actions/company-preferences.actions';
@@ -32,6 +32,7 @@ window.addEventListener('DOMContentLoaded', () => {
32
32
  store.dispatch(setProperties(Homeflow.get('properties')));
33
33
  store.dispatch(setPagination(Homeflow.get('pagination')));
34
34
  store.dispatch(setThemePreferences(Homeflow.get('theme_preferences')));
35
+ store.dispatch(setThemeSettings(Homeflow.get('theme_settings')));
35
36
  store.dispatch(setAuthenticityToken(Homeflow.get('authenticityToken')));
36
37
 
37
38
  // if we're on the property show page, set next and previous links