<commit_before>import { ADD_MAP_MARKER, CHANGE_CENTER, CHANGE_MARKER_SHOW_INFO, LOGIN_SUCCESS } from '../constants';
import concatAddress from '../components/helpers/concatAddress';

export const initialState = {
  center: { lat: 38.6536082, lng:
-121.14818130000003 },
  markers: [],
};

export const googleMap = (state = initialState, action) => {
  switch (action.type) {
    case LOGIN_SUCCESS:
      const geocoder = new google.maps.Geocoder();
      geocoder.geocode({ 'address': concatAddress(action.data.user)}, (results, status) => {
        const newCenter = {
          lat: results[0].geometry.bounds.f.f,
          lng: results[0].geometry.bounds.b.b,
        };
        return ({ ...state, center: newCenter });
      });
      return ({ ...state});
    case CHANGE_MARKER_SHOW_INFO:
      const markersClone = [...state.markers];
      markersClone[action.index].showInfo = !markersClone[action.index].showInfo;
      return ({ ...state, markers: markersClone });
    case CHANGE_CENTER:
      return ({ ...state, center: action.location });
    case ADD_MAP_MARKER:
      return ({ ...state, markers: [...state.markers, action.location] });
    default:
      return state;
  }
};<commit_msg>clean up google map reducer<commit_after>import { ADD_MAP_MARKER, CHANGE_CENTER, CHANGE_MARKER_SHOW_INFO, LOGIN_SUCCESS } from '../constants';
import concatAddress from '../components/helpers/concatAddress';

export const initialState = {
  center: { lat: 38.6536082, lng:
-121.14818130000003 },
  markers: [],
};

export const googleMap = (state = initialState, action) => {
  switch (action.type) {
    case LOGIN_SUCCESS:
      const geocoder = new google.maps.Geocoder();
      geocoder.geocode({ 'address': concatAddress(action.data.user)}, (results) => {
        const newCenter = {
          lat: results[0].geometry.bounds.f.f,
          lng: results[0].geometry.bounds.b.b,
        };
        return ({ ...state, center: newCenter });
      });
      return ({ ...state});
    case CHANGE_MARKER_SHOW_INFO:
      const markersClone = [...state.markers];
      markersClone[action.index].showInfo = !markersClone[action.index].showInfo;
      return ({ ...state, markers: markersClone });
    case CHANGE_CENTER:
      return ({ ...state, center: action.location });
    case ADD_MAP_MARKER:
      return ({ ...state, markers: [...state.markers, action.location] });
    default:
      return state;
  }
};
{'fraction_non_alphanumeric': 0.15152766308835672, 'fraction_numerical': 0.023121387283236993, 'mean_word_length': 3.0383333333333336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4531651', 'n_tokens_mistral': 800, 'n_tokens_neox': 765, 'n_words': 159}