diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-24 23:46:58 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-24 23:46:58 +0800 |
commit | 38f47a380b663df0a3f817100650e222dd7582e0 (patch) | |
tree | 23348daa23207b840b93335bfb823d451053ab53 /packages/instant/src/containers | |
parent | 4c4286ac662d3dba928bf16b83ade5e5476f4614 (diff) | |
parent | 8635f8d7325d472dd7d4fac26f1a87bee17edd1a (diff) | |
download | dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.gz dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.bz2 dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.lz dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.xz dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.zst dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.zip |
Merge branch 'development' into feature/instant/processing-state
Diffstat (limited to 'packages/instant/src/containers')
3 files changed, 22 insertions, 41 deletions
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 d368d05e1..000000000 --- a/packages/instant/src/containers/selected_asset_button.tsx +++ /dev/null @@ -1,39 +0,0 @@ -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, OrderState } from '../types'; - -import { PlacingOrderButton } from '../components/placing_order_button'; - -import { SelectedAssetBuyButton } from './selected_asset_buy_button'; -import { SelectedAssetRetryButton } from './selected_asset_retry_button'; -import { SelectedAssetViewTransactionButton } from './selected_asset_view_transaction_button'; - -interface ConnectedState { - buyOrderState: OrderState; -} -export interface SelectedAssetButtonProps {} -const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): ConnectedState => ({ - buyOrderState: state.buyOrderState, -}); - -const SelectedAssetButtonPresentationComponent: React.StatelessComponent<{ - buyOrderState: OrderState; -}> = props => { - if (props.buyOrderState.processState === AsyncProcessState.FAILURE) { - return <SelectedAssetRetryButton />; - } else if (props.buyOrderState.processState === AsyncProcessState.SUCCESS) { - return <SelectedAssetViewTransactionButton />; - } else if (props.buyOrderState.processState === AsyncProcessState.PENDING) { - return <PlacingOrderButton />; - } - - return <SelectedAssetBuyButton />; -}; - -export const SelectedAssetButton: React.ComponentClass<SelectedAssetButtonProps> = connect(mapStateToProps)( - SelectedAssetButtonPresentationComponent, -); 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..f3efbb5d2 --- /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 { + buyOrderProcessingState: AsyncProcessState; +} +export interface SelectedAssetButtonProps {} +const mapStateToProps = (state: State, _ownProps: SelectedAssetButtonProps): ConnectedState => ({ + buyOrderProcessingState: state.buyOrderState.processState, +}); + +export const SelectedAssetBuyOrderStateButton: React.ComponentClass<SelectedAssetButtonProps> = connect( + mapStateToProps, +)(BuyOrderStateButton); 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<Action>, _ownProps: SelectedAssetRetryButtonProps, ): ConnectedDispatch => ({ - onClick: () => dispatch(actions.clearBuyQuoteAndSelectedAssetAmount()), + onClick: () => dispatch(actions.resetAmount()), }); export const SelectedAssetRetryButton: React.ComponentClass<SelectedAssetRetryButtonProps> = connect( - null, + undefined, mapDispatchToProps, )(RetryButton); |