From 42bbd938dbbbac20b9750d62e6928da1ea9dab33 Mon Sep 17 00:00:00 2001 From: Kelly Innes Date: Mon, 4 Mar 2019 17:42:27 -0500 Subject: [PATCH] fixup rename searchTerm -> filterText --- src/app/src/actions/ui.js | 8 ++--- .../components/FilterSidebarFacilitiesTab.jsx | 29 ++++++++++--------- src/app/src/reducers/UIReducer.js | 16 +++++----- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/app/src/actions/ui.js b/src/app/src/actions/ui.js index bdb67aa02..3180a7d5a 100644 --- a/src/app/src/actions/ui.js +++ b/src/app/src/actions/ui.js @@ -4,7 +4,7 @@ export const makeSidebarGuideTabActive = createAction('MAKE_SIDEBAR_GUIDE_TAB_AC export const makeSidebarSearchTabActive = createAction('MAKE_SIDEBAR_SEARCH_TAB_ACTIVE'); export const makeSidebarFacilitiesTabActive = createAction('MAKE_SIDEBAR_FACILITIES_TAB_ACTIVE'); -export const updateSidebarFacilitiesTabSearch = - createAction('UPDATE_SIDEBAR_FACILITIES_TAB_TEXT_SEARCH'); -export const resetSidebarFacilitiesTabSearch = - createAction('RESET_SIDEBAR_FACILITIES_TAB_TEXT_SEARCH'); +export const updateSidebarFacilitiesTabTextFilter = + createAction('UPDATE_SIDEBAR_FACILITIES_TAB_TEXT_FILTER'); +export const resetSidebarFacilitiesTabTextFilter = + createAction('RESET_SIDEBAR_FACILITIES_TAB_TEXT_FILTER'); diff --git a/src/app/src/components/FilterSidebarFacilitiesTab.jsx b/src/app/src/components/FilterSidebarFacilitiesTab.jsx index d0eb3e33e..a2b98042e 100644 --- a/src/app/src/components/FilterSidebarFacilitiesTab.jsx +++ b/src/app/src/components/FilterSidebarFacilitiesTab.jsx @@ -16,7 +16,7 @@ import ControlledTextInput from './ControlledTextInput'; import { makeSidebarSearchTabActive, - updateSidebarFacilitiesTabSearch, + updateSidebarFacilitiesTabTextFilter, } from '../actions/ui'; import { facilityCollectionPropType } from '../util/propTypes'; @@ -107,8 +107,8 @@ function FilterSidebarFacilitiesTab({ data, error, returnToSearchTab, - searchTerm, - updateSearchTerm, + filterText, + updateFilterText, }) { if (fetching) { return ( @@ -189,7 +189,7 @@ function FilterSidebarFacilitiesTab({ ); } - const filteredFacilities = searchTerm + const filteredFacilities = filterText ? facilities .filter(({ properties: { @@ -197,9 +197,9 @@ function FilterSidebarFacilitiesTab({ name, country_name: countryName, }, - }) => caseInsensitiveIncludes(address, searchTerm) - || caseInsensitiveIncludes(name, searchTerm) - || caseInsensitiveIncludes(countryName, searchTerm)) + }) => caseInsensitiveIncludes(address, filterText) + || caseInsensitiveIncludes(name, filterText) + || caseInsensitiveIncludes(countryName, filterText)) : facilities; const orderedFacilities = @@ -233,8 +233,8 @@ function FilterSidebarFacilitiesTab({ @@ -292,8 +292,8 @@ FilterSidebarFacilitiesTab.propTypes = { fetching: bool.isRequired, error: arrayOf(string), returnToSearchTab: func.isRequired, - searchTerm: string.isRequired, - updateSearchTerm: func.isRequired, + filterText: string.isRequired, + updateFilterText: func.isRequired, }; function mapStateToProps({ @@ -306,7 +306,7 @@ function mapStateToProps({ }, ui: { facilitiesSidebarTabSearch: { - searchTerm, + filterText, }, }, }) { @@ -314,14 +314,15 @@ function mapStateToProps({ data, error, fetching, - searchTerm, + filterText, }; } function mapDispatchToProps(dispatch) { return { returnToSearchTab: () => dispatch(makeSidebarSearchTabActive()), - updateSearchTerm: e => dispatch((updateSidebarFacilitiesTabSearch(getValueFromEvent(e)))), + updateFilterText: e => + dispatch((updateSidebarFacilitiesTabTextFilter(getValueFromEvent(e)))), }; } diff --git a/src/app/src/reducers/UIReducer.js b/src/app/src/reducers/UIReducer.js index 314c1dd1a..238b2cc32 100644 --- a/src/app/src/reducers/UIReducer.js +++ b/src/app/src/reducers/UIReducer.js @@ -5,8 +5,8 @@ import { makeSidebarGuideTabActive, makeSidebarSearchTabActive, makeSidebarFacilitiesTabActive, - updateSidebarFacilitiesTabSearch, - resetSidebarFacilitiesTabSearch, + updateSidebarFacilitiesTabTextFilter, + resetSidebarFacilitiesTabTextFilter, } from '../actions/ui'; import { completeFetchFacilities } from '../actions/facilities'; @@ -16,7 +16,7 @@ import { filterSidebarTabsEnum } from '../util/constants'; const initialState = Object.freeze({ activeFilterSidebarTab: filterSidebarTabsEnum.search, facilitiesSidebarTabSearch: Object.freeze({ - searchTerm: '', + filterText: '', }), }); @@ -51,17 +51,17 @@ export default createReducer({ }, }, }), - [updateSidebarFacilitiesTabSearch]: (state, payload) => update(state, { + [updateSidebarFacilitiesTabTextFilter]: (state, payload) => update(state, { facilitiesSidebarTabSearch: { - searchTerm: { + filterText: { $set: payload, }, }, }), - [resetSidebarFacilitiesTabSearch]: state => update(state, { + [resetSidebarFacilitiesTabTextFilter]: state => update(state, { facilitiesSidebarTabSearch: { - searchTerm: { - $set: initialState.facilitiesSidebarTabSearch.searchTerm, + filterText: { + $set: initialState.facilitiesSidebarTabSearch.filterText, }, }, }),