{"size": 1238, "ext": "js", "max_stars_repo_path": "client/src/reducers/app.js", "max_stars_repo_name": "dwre/2", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/reducers/app.js", "max_issues_repo_name": "dwre/2", "max_issues_repo_issues_event_min_datetime": "2020-07-17T01:19:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T10:47:38.000Z", "max_forks_repo_path": "client/src/reducers/app.js", "max_forks_repo_name": "dwre/2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 17, "max_forks_count": null, "avg_line_length": 22.1071428571, "max_line_length": 85, "alphanum_fraction": 0.5977382876}
const initialState = {
  modalComponent: null,
  scrolledToBottom: true,
  windowIsFocused: true,
  unreadMessageCount: 0,
  soundIsEnabled: true,
  socketConnected: false,
}

const app = (state = initialState, action) => {
  switch (action.type) {
    case 'FETCH_CREATE_HANDSHAKE_SUCCESS':
      return state;
    case 'OPEN_MODAL':
      return {
        ...state,
        modalComponent: action.payload,
      }
    case 'CLOSE_MODAL':
      return {
        ...state,
        modalComponent: null,
      }
    case 'SET_SCROLLED_TO_BOTTOM':
      return {
        ...state,
        scrolledToBottom: action.payload,
      }
    case 'TOGGLE_WINDOW_FOCUS':
      return {
        ...state,
        windowIsFocused: action.payload,
        unreadMessageCount: 0,
      }
    case 'HANDLE_SOCKET_MESSAGE_SEND_MESSAGE':
      return {
        ...state,
        unreadMessageCount: state.windowIsFocused ? 0 : state.unreadMessageCount + 1,
      }
    case 'TOGGLE_SOUND_ENABLED':
      return {
        ...state,
        soundIsEnabled: action.payload,
      }
    case 'TOGGLE_SOCKET_CONNECTED':
      return {
        ...state,
        socketConnected: action.payload,
      }
    default:
      return state
  }
}

export default app
