All files / app/reducers diff.ts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64    12x 53x       53x       12x 53x                     53x       12x 53x                   53x       12x 53x           53x       12x 53x           53x      
import { ActionTypes } from 'app/actions/ActionTypes';
 
export const diff = (state = null, action: any) => {
  switch (action.type) {
    case ActionTypes.RECEIVE_DIFF:
      return action.diff;
    default:
      return state;
  }
};
 
export const isDiffDeferred = (state = false, action: any) => {
  switch (action.type) {
    // we don't fetch the diff until after the first RECEIVE_COMMITS
    // but we are going to and an looks more responsive to throw up the
    // spinner on the DifferenceViewer container sdfaf
    case ActionTypes.REQUEST_COMMITS:
    case ActionTypes.REQUEST_DIFF:
    case ActionTypes.RECEIVE_DIFF:
      return false;
    case ActionTypes.REQUEST_DEFERRED_DIFF:
      return true;
    default:
      return state;
  }
};
 
export const isDiffFetching = (state = false, action: any) => {
  switch (action.type) {
    // we don't fetch the diff until after the first RECEIVE_COMMITS
    // but we are going to and an looks more responsive to throw up the
    // spinner on the DifferenceViewer container sdfaf
    case ActionTypes.REQUEST_COMMITS:
    case ActionTypes.REQUEST_DIFF:
      return true;
    case ActionTypes.RECEIVE_DIFF:
      return false;
    default:
      return state;
  }
};
 
export const diffLeftCommit = (state = null, action: any) => {
  switch (action.type) {
    case ActionTypes.REQUEST_COMMITS:
      return null;
    case ActionTypes.REQUEST_DIFF:
      return action.leftCommit || null;
    default:
      return state;
  }
};
 
export const diffRightCommit = (state = null, action: any) => {
  switch (action.type) {
    case ActionTypes.REQUEST_COMMITS:
      return null;
    case ActionTypes.REQUEST_DIFF:
      return action.rightCommit || null;
    default:
      return state;
  }
};