diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-14 09:12:51 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-14 09:12:51 +0800 |
commit | 2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3 (patch) | |
tree | 05a0d01029815d36370f8548d365289f555e8be4 /packages/instant/src/containers | |
parent | da9de70bbcecc16fa3a7f6991623f5027628f2b3 (diff) | |
parent | b174a891bc3273a13dc19c1cda60a0f5310892c7 (diff) | |
download | dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar.gz dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar.bz2 dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar.lz dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar.xz dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.tar.zst dexon-sol-tools-2f6b1273aaf621beebcbc70af4bb6c5f4a8217a3.zip |
Merge branch 'feature/instant/metamask-connect-flow' of https://github.com/0xProject/0x-monorepo into feature/instant/metamask-connect-flow
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); |