From d43f89fa0af709b1c1616ab5cfb32b8c27e07ab6 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 23 Oct 2018 17:28:27 -0700 Subject: move buy order state to its own component --- .../instant/src/containers/selected_asset_button.tsx | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'packages/instant/src/containers') diff --git a/packages/instant/src/containers/selected_asset_button.tsx b/packages/instant/src/containers/selected_asset_button.tsx index 8c617804e..86be291bc 100644 --- a/packages/instant/src/containers/selected_asset_button.tsx +++ b/packages/instant/src/containers/selected_asset_button.tsx @@ -2,12 +2,10 @@ import * as _ from 'lodash'; import * as React from 'react'; import { connect } from 'react-redux'; -import { SecondaryButton } from '../components/secondary_button'; import { State } from '../redux/reducer'; import { AsyncProcessState } from '../types'; -import { SelectedAssetBuyButton } from './selected_asset_buy_button'; -import { SelectedAssetRetryButton } from './selected_asset_retry_button'; +import { BuyOrderStateButton } from '../components/buy_order_state_button'; interface ConnectedState { buyOrderState: AsyncProcessState; @@ -17,20 +15,6 @@ const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): Con buyOrderState: state.buyOrderState, }); -const SelectedAssetButtonPresentationComponent: React.StatelessComponent<{ - buyOrderState: AsyncProcessState; -}> = props => { - if (props.buyOrderState === AsyncProcessState.FAILURE) { - return ; - } else if (props.buyOrderState === AsyncProcessState.SUCCESS) { - return ; - } else if (props.buyOrderState === AsyncProcessState.PENDING) { - return ; - } - - return ; -}; - export const SelectedAssetButton: React.ComponentClass = connect(mapStateToProps)( - SelectedAssetButtonPresentationComponent, + BuyOrderStateButton, ); -- cgit v1.2.3 From 657ae0cf5732d2ad3bb23ed4270ee20ec9b0f131 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 23 Oct 2018 17:32:20 -0700 Subject: null -> undefined --- packages/instant/src/containers/selected_asset_retry_button.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/instant/src/containers') diff --git a/packages/instant/src/containers/selected_asset_retry_button.tsx b/packages/instant/src/containers/selected_asset_retry_button.tsx index 66177551d..b2b140be6 100644 --- a/packages/instant/src/containers/selected_asset_retry_button.tsx +++ b/packages/instant/src/containers/selected_asset_retry_button.tsx @@ -17,10 +17,10 @@ const mapDispatchToProps = ( dispatch: Dispatch, _ownProps: SelectedAssetRetryButtonProps, ): ConnectedDispatch => ({ - onClick: () => dispatch(actions.clearBuyQuoteAndSelectedAssetAmount()), + onClick: () => dispatch(actions.resetAmount()), }); export const SelectedAssetRetryButton: React.ComponentClass = connect( - null, + undefined, mapDispatchToProps, )(RetryButton); -- cgit v1.2.3 From 4df8e60f42a372ae70f15cadbe1942ba27097f7a Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 23 Oct 2018 17:36:25 -0700 Subject: rename container --- .../instant/src/containers/selected_asset_button.tsx | 20 -------------------- .../selected_asset_buy_order_state_button.tsx | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 packages/instant/src/containers/selected_asset_button.tsx create mode 100644 packages/instant/src/containers/selected_asset_buy_order_state_button.tsx (limited to 'packages/instant/src/containers') diff --git a/packages/instant/src/containers/selected_asset_button.tsx b/packages/instant/src/containers/selected_asset_button.tsx deleted file mode 100644 index 86be291bc..000000000 --- a/packages/instant/src/containers/selected_asset_button.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import { connect } from 'react-redux'; - -import { State } from '../redux/reducer'; -import { AsyncProcessState } from '../types'; - -import { BuyOrderStateButton } from '../components/buy_order_state_button'; - -interface ConnectedState { - buyOrderState: AsyncProcessState; -} -export interface SelectedAssetButtonProps {} -const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): ConnectedState => ({ - buyOrderState: state.buyOrderState, -}); - -export const SelectedAssetButton: React.ComponentClass = connect(mapStateToProps)( - BuyOrderStateButton, -); diff --git a/packages/instant/src/containers/selected_asset_buy_order_state_button.tsx b/packages/instant/src/containers/selected_asset_buy_order_state_button.tsx new file mode 100644 index 000000000..3b7fc0054 --- /dev/null +++ b/packages/instant/src/containers/selected_asset_buy_order_state_button.tsx @@ -0,0 +1,20 @@ +import * as _ from 'lodash'; +import * as React from 'react'; +import { connect } from 'react-redux'; + +import { State } from '../redux/reducer'; +import { AsyncProcessState } from '../types'; + +import { BuyOrderStateButton } from '../components/buy_order_state_button'; + +interface ConnectedState { + buyOrderState: AsyncProcessState; +} +export interface SelectedAssetButtonProps {} +const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): ConnectedState => ({ + buyOrderState: state.buyOrderState, +}); + +export const SelectedAssetBuyOrderStateButton: React.ComponentClass = connect( + mapStateToProps, +)(BuyOrderStateButton); -- cgit v1.2.3