src/reducers/marketReducer.js
// Only called when actionCat is one of the data views:
Only called when actionCat is one of the data views.
Only called when actionCat is one of the data views .
function switchMarketView(actionCat) {
    if (state.view.cat != actionCat) {
      const viewObj = JSON.parse(JSON.stringify(state.view));
      switch (actionCat) {
        case types.TAB_PORTFOLIO:
          newState.view = Object.assign({}, newState.portfolio);
          updateFilterInputBox(newState.view);
          break;
        case types.TAB_INDICES:
          newState.view = Object.assign({}, newState.indices);
          updateFilterInputBox(newState.view);
          break;
        case types.TAB_HIGHTECH:
          newState.view = Object.assign({}, newState.hightech);
          updateFilterInputBox(newState.view);
          break;
        case types.TAB_FINANCIAL:
          newState.view = Object.assign({}, newState.financial);
          updateFilterInputBox(newState.view);
          break;
        case types.TAB_ASSET:
          newState.view = Object.assign({}, newState.asset);
          updateFilterInputBox(newState.view);
          break;
      }
      switch (viewObj.cat) {
        case types.TAB_PORTFOLIO: newState.portfolio = viewObj; break;
        case types.TAB_INDICES:   newState.indices   = viewObj; break;
        case types.TAB_HIGHTECH:  newState.hightech  = viewObj; break;
        case types.TAB_FINANCIAL: newState.financial = viewObj; break;
        case types.TAB_ASSET:     newState.asset     = viewObj; break;
      }
    } else {
      console.log('marketReducer: The view switch is not required.');
    }
  } 
function switchMarketView ( actionCat ) { if ( state . view . cat != actionCat ) { const viewObj = JSON . parse ( JSON . stringify ( state . view ) ) ; switch ( actionCat ) { case types . TAB_PORTFOLIO : newState . view = Object . assign ( { } , newState . portfolio ) ; updateFilterInputBox ( newState . view ) ; break ; case types . TAB_INDICES : newState . view = Object . assign ( { } , newState . indices ) ; updateFilterInputBox ( newState . view ) ; break ; case types . TAB_HIGHTECH : newState . view = Object . assign ( { } , newState . hightech ) ; updateFilterInputBox ( newState . view ) ; break ; case types . TAB_FINANCIAL : newState . view = Object . assign ( { } , newState . financial ) ; updateFilterInputBox ( newState . view ) ; break ; case types . TAB_ASSET : newState . view = Object . assign ( { } , newState . asset ) ; updateFilterInputBox ( newState . view ) ; break ; } switch ( viewObj . cat ) { case types . TAB_PORTFOLIO : newState . portfolio = viewObj ; break ; case types . TAB_INDICES : newState . indices = viewObj ; break ; case types . TAB_HIGHTECH : newState . hightech = viewObj ; break ; case types . TAB_FINANCIAL : newState . financial = viewObj ; break ; case types . TAB_ASSET : newState . asset = viewObj ; break ; } } else { console . log ( 'marketReducer: The view switch is not required.' ) ; } }
Only called when actionCat is one of the data views:
Only called when actionCat is one of the data views :
// case types.TAB_CRYPTO: //   newState.view = Object.assign({}, newState.crypto); //   updateFilterInputBox(newState.view); //   break; // Backup: //case types.TAB_CRYPTO:    newState.crypto    = viewObj; break; // switchMarketView