diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-08-24 17:56:44 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-08-24 17:56:44 +0200 |
commit | 49520d6e627e49a1f9f1b8cfa9b323450307fcc6 (patch) | |
tree | 49b3f093b1791bfa9434a4507d45944342d2dc43 /app/assets/javascripts/components/reducers | |
parent | 68c93f8b859617fb6bb2dc5cf6c5f9a6362bf6a8 (diff) |
Adding React.js, Redux, revamping dashboard
Diffstat (limited to 'app/assets/javascripts/components/reducers')
-rw-r--r-- | app/assets/javascripts/components/reducers/index.jsx | 6 | ||||
-rw-r--r-- | app/assets/javascripts/components/reducers/statuses.jsx | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/reducers/index.jsx b/app/assets/javascripts/components/reducers/index.jsx new file mode 100644 index 000000000..c7e858f38 --- /dev/null +++ b/app/assets/javascripts/components/reducers/index.jsx @@ -0,0 +1,6 @@ +import { combineReducers } from 'redux-immutable'; +import statuses from './statuses'; + +export default combineReducers({ + statuses +}); diff --git a/app/assets/javascripts/components/reducers/statuses.jsx b/app/assets/javascripts/components/reducers/statuses.jsx new file mode 100644 index 000000000..d69d66328 --- /dev/null +++ b/app/assets/javascripts/components/reducers/statuses.jsx @@ -0,0 +1,17 @@ +import { SET_TIMELINE, ADD_STATUS } from '../actions/statuses'; +import Immutable from 'immutable'; + +const initialState = Immutable.Map(); + +export default function statuses(state = initialState, action) { + switch(action.type) { + case SET_TIMELINE: + return state.set(action.timeline, Immutable.fromJS(action.statuses)); + case ADD_STATUS: + return state.update(action.timeline, function (list) { + list.unshift(Immutable.fromJS(action.status)); + }); + default: + return state; + } +} |