{"size": 727, "ext": "js", "max_stars_repo_path": "src/containers/Cohorts/reducer.js", "max_stars_repo_name": "overaneout/achievements", "max_stars_repo_stars_event_min_datetime": "2018-06-05T11:01:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-21T05:20:31.000Z", "max_issues_repo_path": "src/containers/Cohorts/reducer.js", "max_issues_repo_name": "Aishwarya26l/achievements", "max_issues_repo_issues_event_min_datetime": "2018-01-26T07:15:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T12:36:06.000Z", "max_forks_repo_path": "src/containers/Cohorts/reducer.js", "max_forks_repo_name": "Aishwarya26l/achievements", "max_forks_repo_forks_event_min_datetime": "2018-01-25T08:14:35.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-08T01:27:31.000Z"}
{"max_stars_count": 17, "max_issues_count": 438, "max_forks_count": 32, "avg_line_length": 17.7317073171, "max_line_length": 35, "alphanum_fraction": 0.5735900963}
import {
  ADD_COHORT_DIALOG_HIDE,
  ADD_COHORT_DIALOG_SHOW,
  ADD_COHORT_FAIL,
  ADD_COHORT_SUCCESS,
  COHORTS_CHANGE_TAB
} from "./actions";

export const cohorts = (
  state = {
    currentTab: 0,
    dialog: false
  },
  action
) => {
  switch (action.type) {
    case COHORTS_CHANGE_TAB:
      return {
        ...state,
        currentTab: action.tabIndex
      };
    case ADD_COHORT_DIALOG_SHOW:
      return {
        ...state,
        dialog: {
          type: "addCohort",
          cohort: action.cohort
        }
      };
    case ADD_COHORT_SUCCESS:
    case ADD_COHORT_FAIL:
    case ADD_COHORT_DIALOG_HIDE:
      return {
        ...state,
        dialog: false
      };
    default:
      return state;
  }
};
