{"size": 898, "ext": "js", "max_stars_repo_path": "ReactNative/reducers/audioReducer.js", "max_stars_repo_name": "djh329/Jarvis_Mark_7", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ReactNative/reducers/audioReducer.js", "max_issues_repo_name": "djh329/Jarvis_Mark_7", "max_issues_repo_issues_event_min_datetime": "2020-03-24T22:30:28.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-22T11:10:34.000Z", "max_forks_repo_path": "ReactNative/reducers/audioReducer.js", "max_forks_repo_name": "djh329/Jarvis_Mark_7", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 13, "max_forks_count": null, "avg_line_length": 24.9444444444, "max_line_length": 83, "alphanum_fraction": 0.6915367483}
import {
  UPDATE_TRACKS,
  SET_IS_PLAYING,
  UPDATE_TRACK_INFO,
  UPDATE_PLAYER_INFO,
  UPDATE_SHUFFLING_INFO
} from '../constants';

var initialState = {
  tracks: [],
  trackInfo: undefined,
  playerInfo: {
    playing: false,
    position: 0,
    repeating: false,
    shuffling: false,
  }
}

export default function(state=initialState, action) {
	switch(action.type) {
  case UPDATE_TRACKS:
    return {...state, tracks: action.payload};
  case SET_IS_PLAYING:
    return {...state, playerInfo: {...state.playerInfo, playing: action.payload}}
  case UPDATE_TRACK_INFO:
    return {...state, trackInfo: {...state.trackInfo, ...action.payload}}
  case UPDATE_PLAYER_INFO:
    return {...state, playerInfo: {...state.playerInfo, ...action.payload}}
  case UPDATE_SHUFFLING_INFO:
    return {...state, playerInfo: {...state.playerInfo, shuffling: action.payload}}
  default:
		return state;
	}
}
