diff options
author | Steve Klebanoff <steve@0xproject.com> | 2018-11-14 08:19:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 08:19:15 +0800 |
commit | b174a891bc3273a13dc19c1cda60a0f5310892c7 (patch) | |
tree | 4fe16167e866d3a1aa78de6e38ab8bd5a41c154e /packages/instant/src/containers | |
parent | f03afe6f1b6a6bfa339507ee47b42c62550444a0 (diff) | |
parent | bb79a5e3245e63aedefe66273196edc768be2ecd (diff) | |
download | dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar.gz dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar.bz2 dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar.lz dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar.xz dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.tar.zst dexon-sol-tools-b174a891bc3273a13dc19c1cda60a0f5310892c7.zip |
Merge pull request #1255 from 0xProject/feature/instant/metamask-connect-flow-input-fix
[instant] Fix input bug
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r-- | packages/instant/src/containers/connected_buy_order_progress_or_payment_method.tsx | 36 | ||||
-rw-r--r-- | packages/instant/src/containers/connected_zero_ex_instant_container.ts | 21 |
2 files changed, 36 insertions, 21 deletions
diff --git a/packages/instant/src/containers/connected_buy_order_progress_or_payment_method.tsx b/packages/instant/src/containers/connected_buy_order_progress_or_payment_method.tsx new file mode 100644 index 000000000..05071c8c3 --- /dev/null +++ b/packages/instant/src/containers/connected_buy_order_progress_or_payment_method.tsx @@ -0,0 +1,36 @@ +import * as React from 'react'; +import { connect } from 'react-redux'; + +import { State } from '../redux/reducer'; +import { OrderProcessState } from '../types'; + +import { ConnectedAccountPaymentMethod } from './connected_account_payment_method'; +import { SelectedAssetBuyOrderProgress } from './selected_asset_buy_order_progress'; + +interface BuyOrderProgressOrPaymentMethodProps { + orderProcessState: OrderProcessState; +} +export const BuyOrderProgressOrPaymentMethod = (props: BuyOrderProgressOrPaymentMethodProps) => { + const { orderProcessState } = props; + if ( + orderProcessState === OrderProcessState.Processing || + orderProcessState === OrderProcessState.Success || + orderProcessState === OrderProcessState.Failure + ) { + return <SelectedAssetBuyOrderProgress />; + } + if (orderProcessState === OrderProcessState.None) { + return <ConnectedAccountPaymentMethod />; + } + return null; +}; + +interface ConnectedState extends BuyOrderProgressOrPaymentMethodProps {} + +export interface ConnectedBuyOrderProgressOrPaymentMethodProps {} +const mapStateToProps = (state: State, _ownProps: ConnectedBuyOrderProgressOrPaymentMethodProps): ConnectedState => ({ + orderProcessState: state.buyOrderState.processState, +}); +export const ConnectedBuyOrderProgressOrPaymentMethod: React.ComponentClass< + ConnectedBuyOrderProgressOrPaymentMethodProps +> = connect(mapStateToProps)(BuyOrderProgressOrPaymentMethod); diff --git a/packages/instant/src/containers/connected_zero_ex_instant_container.ts b/packages/instant/src/containers/connected_zero_ex_instant_container.ts deleted file mode 100644 index 9606d18c2..000000000 --- a/packages/instant/src/containers/connected_zero_ex_instant_container.ts +++ /dev/null @@ -1,21 +0,0 @@ -import * as React from 'react'; -import { connect } from 'react-redux'; - -import { State } from '../redux/reducer'; -import { OrderProcessState } from '../types'; - -import { ZeroExInstantContainer } from '../components/zero_ex_instant_container'; - -export interface ConnectedZeroExInstantContainerProps {} - -interface ConnectedState { - orderProcessState: OrderProcessState; -} - -const mapStateToProps = (state: State, _ownProps: ConnectedZeroExInstantContainerProps): ConnectedState => ({ - orderProcessState: state.buyOrderState.processState, -}); - -export const ConnectedZeroExInstantContainer: React.ComponentClass<ConnectedZeroExInstantContainerProps> = connect( - mapStateToProps, -)(ZeroExInstantContainer); |