{"size": 915, "ext": "js", "max_stars_repo_path": "client/modules/core/reducers/menuReducer.js", "max_stars_repo_name": "stuartsimpson/FoundationApplication", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/modules/core/reducers/menuReducer.js", "max_issues_repo_name": "stuartsimpson/FoundationApplication", "max_issues_repo_issues_event_min_datetime": "2019-01-16T20:25:14.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-16T20:25:14.000Z", "max_forks_repo_path": "client/modules/core/reducers/menuReducer.js", "max_forks_repo_name": "stuartsimpson/FoundationApplication", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 26.9117647059, "max_line_length": 105, "alphanum_fraction": 0.5540983607}
import stateStorage from '../../utils/stateStorage';

const defaultState = stateStorage.get('menuState') || {menu: {}, drawerOpen: false, drawerDocked: false};

var menuReducer = (state = defaultState, action) => {
    var newState = JSON.parse(JSON.stringify(state));
    switch(action.type){
        case 'SET_MENU_STATE':{
            newState.menu = action.payload.menu;
            state = newState;
            break;
        }
        case 'OPEN_MENU_DRAWER':{
            newState.drawerOpen = true;
            break;
        }
        case 'CLOSE_MENU_DRAWER':{
            newState.drawerOpen = false;
            break;
        }
        case 'DOCK_MENU_DRAWER':{
            newState.drawerDocked = true;
            break;
        }
        case 'UNDOCK_MENU_DRAWER':{
            newState.drawerDocked = false;
            break;
        }
    }
    return(newState);
};

export default menuReducer;
