summaryrefslogtreecommitdiff
path: root/src/reducers/construction.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-05 09:30:42 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:57 +0200
commit42778e8be409b97059fa519b53c303cdba502e01 (patch)
tree23d03a1f8a9f8d137bf723c72086a6d79406874f /src/reducers/construction.js
parent6f3afd0317a8e549f77ad6764f6dbe4d4953b67c (diff)
Implement rack creation
Diffstat (limited to 'src/reducers/construction.js')
-rw-r--r--src/reducers/construction.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/reducers/construction.js b/src/reducers/construction.js
new file mode 100644
index 00000000..33485842
--- /dev/null
+++ b/src/reducers/construction.js
@@ -0,0 +1,36 @@
+import {combineReducers} from "redux";
+import {
+ CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
+ FINISH_NEW_ROOM_CONSTRUCTION,
+ START_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
+ START_OBJECT_CONSTRUCTION,
+ STOP_OBJECT_CONSTRUCTION
+} from "../actions/topology";
+
+export function currentRoomInConstruction(state = -1, action) {
+ switch (action.type) {
+ case START_NEW_ROOM_CONSTRUCTION_SUCCEEDED:
+ return action.roomId;
+ case CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED:
+ case FINISH_NEW_ROOM_CONSTRUCTION:
+ return -1;
+ default:
+ return state;
+ }
+}
+
+export function inObjectConstructionMode(state = false, action) {
+ switch (action.type) {
+ case START_OBJECT_CONSTRUCTION:
+ return true;
+ case STOP_OBJECT_CONSTRUCTION:
+ return false;
+ default:
+ return state;
+ }
+}
+
+export const construction = combineReducers({
+ currentRoomInConstruction,
+ inObjectConstructionMode,
+});