aboutsummaryrefslogtreecommitdiffstats
path: root/ui/imports/ui/reducers/search-interested-parties.js
diff options
context:
space:
mode:
authorKoren Lev <korenlev@gmail.com>2017-10-02 11:37:03 +0300
committerKoren Lev <korenlev@gmail.com>2017-10-02 11:37:03 +0300
commita9691f5fe78af32c474754f841a71a68e2d2a484 (patch)
tree6ad620ebc1f9adf6bf9fc671d88ea0adf8e7fe07 /ui/imports/ui/reducers/search-interested-parties.js
parent1e1e95ac6560f26fc154fab4c990235da5ba23c6 (diff)
ui move to docker
Change-Id: Iff31ebb3fff782e848704801b7800fdf480264a1 Signed-off-by: Koren Lev <korenlev@gmail.com>
Diffstat (limited to 'ui/imports/ui/reducers/search-interested-parties.js')
-rw-r--r--ui/imports/ui/reducers/search-interested-parties.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/ui/imports/ui/reducers/search-interested-parties.js b/ui/imports/ui/reducers/search-interested-parties.js
deleted file mode 100644
index f4963d2..0000000
--- a/ui/imports/ui/reducers/search-interested-parties.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import * as R from 'ramda';
-
-import * as actions from '/imports/ui/actions/search-interested-parties';
-
-const defaultState = {
- listeners: [],
- searchTerm: null,
- searchAutoCompleteTerm: null,
- searchAutoCompleteFutureId: null
-};
-
-function reducer(state = defaultState, action) {
- let newListeners;
-
- switch (action.type) {
- case actions.ADD_SEARCH_INTERESTED_PARTY:
- newListeners = R.unionWith(
- R.eqBy(R.prop('action')),
- state.listeners,
- [{ action: action.payload.listener }]);
- return R.assoc('listeners', newListeners, state);
-
- case actions.REMOVE_SEARCH_INTERESTED_PARTY:
- newListeners = R.differenceWith(
- R.eqBy(R.prop('action')),
- state.listeners,
- [{ action:action.payload.listener }]);
- return R.assoc('listeners', newListeners, state);
-
- case actions.SET_SEARCH_TERM:
- asyncCall(() => {
- notifyListeners(action.payload.searchTerm, state.listeners);
- });
- return R.assoc('searchTerm', action.payload.searchTerm, state);
-
- case actions.SET_SEARCH_AUTO_COMPLETE_TERM:
- return R.assoc('searchAutoCompleteTerm', action.payload.searchTerm, state);
-
- case actions.RESET_SEARCH_AUTO_COMPLETE_FUTURE:
- if (! R.isNil(state.searchAutoCompleteFutureId)) {
- clearTimeout(state.searchAutoCompleteFutureId);
- }
- return R.assoc('searchAutoCompleteFutureId', null, state);
-
- case actions.SET_SEARCH_AUTO_COMPLETE_FUTURE:
- if (! R.isNil(state.searchAutoCompleteFutureId)) {
- clearTimeout(state.searchAutoCompleteFutureId);
- }
- return R.assoc('searchAutoCompleteFutureId', action.payload.futureId, state);
-
- default:
- return state;
- }
-}
-
-function asyncCall(fnObject) {
- setTimeout(() => {
- fnObject.call(null);
- }, 0);
-}
-
-function notifyListeners(searchTerm, listeners) {
- R.forEach((listenerItem) => {
- listenerItem.action.call(null, searchTerm);
- }, listeners);
-}
-
-export const searchInterestedParties = reducer;