diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-19 15:39:58 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:43 +0200 |
| commit | 19033b8460cb43dc2fa34a2cffa932b5efe111ca (patch) | |
| tree | 79bde2093acce8d8192d27e288d61bc53cf99e07 /src/reducers | |
| parent | 434be6d21ad665cb6abdf5138d0c563efbfe00b4 (diff) | |
Add profile page
Diffstat (limited to 'src/reducers')
| -rw-r--r-- | src/reducers/index.js | 5 | ||||
| -rw-r--r-- | src/reducers/modals.js | 30 | ||||
| -rw-r--r-- | src/reducers/simulations.js | 13 |
3 files changed, 33 insertions, 15 deletions
diff --git a/src/reducers/index.js b/src/reducers/index.js index bfafaedd..40a51a04 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,13 +1,14 @@ import {combineReducers} from "redux"; import {auth} from "./auth"; +import {modals} from "./modals"; import {objects} from "./objects"; -import {authorizationsOfCurrentUser, authVisibilityFilter, newSimulationModalVisible} from "./simulations"; +import {authorizationsOfCurrentUser, authVisibilityFilter} from "./simulations"; const rootReducer = combineReducers({ auth, objects, + modals, authorizationsOfCurrentUser, - newSimulationModalVisible, authVisibilityFilter, }); diff --git a/src/reducers/modals.js b/src/reducers/modals.js new file mode 100644 index 00000000..e74b66b9 --- /dev/null +++ b/src/reducers/modals.js @@ -0,0 +1,30 @@ +import {combineReducers} from "redux"; +import {CLOSE_DELETE_PROFILE_MODAL, OPEN_DELETE_PROFILE_MODAL} from "../actions/profile"; +import {CLOSE_NEW_SIMULATION_MODAL, OPEN_NEW_SIMULATION_MODAL} from "../actions/simulations"; + +function newSimulationModalVisible(state = false, action) { + switch (action.type) { + case OPEN_NEW_SIMULATION_MODAL: + return true; + case CLOSE_NEW_SIMULATION_MODAL: + return false; + default: + return state; + } +} + +function deleteProfileModalVisible(state = false, action) { + switch (action.type) { + case OPEN_DELETE_PROFILE_MODAL: + return true; + case CLOSE_DELETE_PROFILE_MODAL: + return false; + default: + return state; + } +} + +export const modals = combineReducers({ + newSimulationModalVisible, + deleteProfileModalVisible, +}); diff --git a/src/reducers/simulations.js b/src/reducers/simulations.js index 9d830877..7d0b9d66 100644 --- a/src/reducers/simulations.js +++ b/src/reducers/simulations.js @@ -1,8 +1,6 @@ import { ADD_SIMULATION_SUCCEEDED, - CLOSE_NEW_SIMULATION_MODAL, DELETE_SIMULATION_SUCCEEDED, - OPEN_NEW_SIMULATION_MODAL, SET_AUTH_VISIBILITY_FILTER } from "../actions/simulations"; import {FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED} from "../actions/users"; @@ -23,17 +21,6 @@ export function authorizationsOfCurrentUser(state = [], action) { } } -export function newSimulationModalVisible(state = false, action) { - switch (action.type) { - case OPEN_NEW_SIMULATION_MODAL: - return true; - case CLOSE_NEW_SIMULATION_MODAL: - return false; - default: - return state; - } -} - export function authVisibilityFilter(state = "SHOW_ALL", action) { switch (action.type) { case SET_AUTH_VISIBILITY_FILTER: |
