about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/timelines.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/reducers/timelines.jsx')
-rw-r--r--app/assets/javascripts/components/reducers/timelines.jsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/reducers/timelines.jsx b/app/assets/javascripts/components/reducers/timelines.jsx
new file mode 100644
index 000000000..2e0f70c24
--- /dev/null
+++ b/app/assets/javascripts/components/reducers/timelines.jsx
@@ -0,0 +1,17 @@
+import { TIMELINE_SET, TIMELINE_UPDATE } from '../actions/timelines';
+import Immutable                         from 'immutable';
+
+const initialState = Immutable.Map();
+
+export default function timelines(state = initialState, action) {
+  switch(action.type) {
+    case TIMELINE_SET:
+      return state.set(action.timeline, Immutable.fromJS(action.statuses));
+    case TIMELINE_UPDATE:
+      return state.update(action.timeline, function (list) {
+        return list.unshift(Immutable.fromJS(action.status));
+      });
+    default:
+      return state;
+  }
+}