From 49520d6e627e49a1f9f1b8cfa9b323450307fcc6 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Wed, 24 Aug 2016 17:56:44 +0200
Subject: Adding React.js, Redux, revamping dashboard

---
 app/assets/javascripts/components/reducers/statuses.jsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 app/assets/javascripts/components/reducers/statuses.jsx

(limited to 'app/assets/javascripts/components/reducers/statuses.jsx')

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;
+  }
+}
-- 
cgit 

