Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
selectedAssetBuyState -> buyOrderState
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklebanoff committed Oct 17, 2018
1 parent 1d38b75 commit 6ea386a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const mapDispatchToProps = (
// invalidate the last buy quote.
dispatch(actions.updateLatestBuyQuote(undefined));
// reset our buy state
dispatch(actions.updateSelectedAssetBuyState(AsyncProcessState.NONE));
dispatch(actions.updatebuyOrderState(AsyncProcessState.NONE));

if (!_.isUndefined(value) && !_.isUndefined(assetData)) {
// even if it's debounced, give them the illusion it's loading
Expand Down
8 changes: 4 additions & 4 deletions packages/instant/src/containers/selected_asset_buy_button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ const textForState = (state: AsyncProcessState): string => {
};

const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyButtonProps): ConnectedState => ({
text: textForState(state.selectedAssetBuyState),
text: textForState(state.buyOrderState),
buyQuote: state.latestBuyQuote,
});

const mapDispatchToProps = (dispatch: Dispatch<Action>, ownProps: SelectedAssetBuyButtonProps): ConnectedDispatch => ({
onClick: buyQuote => dispatch(actions.updateSelectedAssetBuyState(AsyncProcessState.PENDING)),
onBuySuccess: buyQuote => dispatch(actions.updateSelectedAssetBuyState(AsyncProcessState.SUCCESS)),
onBuyFailure: buyQuote => dispatch(actions.updateSelectedAssetBuyState(AsyncProcessState.FAILURE)),
onClick: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.PENDING)),
onBuySuccess: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.SUCCESS)),
onBuyFailure: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.FAILURE)),
});

export const SelectedAssetBuyButton: React.ComponentClass<SelectedAssetBuyButtonProps> = connect(
Expand Down
2 changes: 1 addition & 1 deletion packages/instant/src/redux/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export enum ActionTypes {
export const actions = {
updateEthUsdPrice: (price?: BigNumber) => createAction(ActionTypes.UPDATE_ETH_USD_PRICE, price),
updateSelectedAssetAmount: (amount?: BigNumber) => createAction(ActionTypes.UPDATE_SELECTED_ASSET_AMOUNT, amount),
updateSelectedAssetBuyState: (buyState: AsyncProcessState) =>
updatebuyOrderState: (buyState: AsyncProcessState) =>
createAction(ActionTypes.UPDATE_SELECTED_ASSET_BUY_STATE, buyState),
updateLatestBuyQuote: (buyQuote?: BuyQuote) => createAction(ActionTypes.UPDATE_LATEST_BUY_QUOTE, buyQuote),
updateBuyQuoteStatePending: () => createAction(ActionTypes.UPDATE_BUY_QUOTE_STATE_PENDING),
Expand Down
6 changes: 3 additions & 3 deletions packages/instant/src/redux/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export enum LatestErrorDisplay {
export interface State {
selectedAssetData?: string;
selectedAssetAmount?: BigNumber;
selectedAssetBuyState: AsyncProcessState; // TODO: rename buyOrderState
buyOrderState: AsyncProcessState;
ethUsdPrice?: BigNumber;
latestBuyQuote?: BuyQuote;
quoteState: AsyncProcessState;
Expand All @@ -26,7 +26,7 @@ export const INITIAL_STATE: State = {
// TODO: Remove hardcoded zrxAssetData
selectedAssetData: zrxAssetData,
selectedAssetAmount: undefined,
selectedAssetBuyState: AsyncProcessState.NONE,
buyOrderState: AsyncProcessState.NONE,
ethUsdPrice: undefined,
latestBuyQuote: undefined,
latestError: undefined,
Expand Down Expand Up @@ -67,7 +67,7 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
case ActionTypes.UPDATE_SELECTED_ASSET_BUY_STATE:
return {
...state,
selectedAssetBuyState: action.data,
buyOrderState: action.data,
};
case ActionTypes.SET_ERROR:
return {
Expand Down

0 comments on commit 6ea386a

Please sign in to comment.