From b7f4062ac84159e58d0282a38fb64825c429cbd8 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Wed, 24 Oct 2018 16:17:01 -0700 Subject: feat(instant): Be able to view transaction when transaction is in progress --- packages/instant/src/components/buy_order_state_button.tsx | 6 +++--- packages/instant/src/components/instant_heading.tsx | 5 +++++ .../src/containers/selected_asset_view_transaction_button.tsx | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/instant/src/components/buy_order_state_button.tsx b/packages/instant/src/components/buy_order_state_button.tsx index b5b21fd1e..44115e5a1 100644 --- a/packages/instant/src/components/buy_order_state_button.tsx +++ b/packages/instant/src/components/buy_order_state_button.tsx @@ -13,12 +13,12 @@ export interface BuyOrderStateButtonProps { export const BuyOrderStateButton: React.StatelessComponent = props => { if (props.buyOrderProcessingState === OrderProcessState.FAILURE) { return ; - } else if (props.buyOrderProcessingState === OrderProcessState.SUCCESS) { - return ; } else if ( - props.buyOrderProcessingState === OrderProcessState.AWAITING_SIGNATURE || + props.buyOrderProcessingState === OrderProcessState.SUCCESS || props.buyOrderProcessingState === OrderProcessState.PROCESSING ) { + return ; + } else if (props.buyOrderProcessingState === OrderProcessState.AWAITING_SIGNATURE) { return ; } diff --git a/packages/instant/src/components/instant_heading.tsx b/packages/instant/src/components/instant_heading.tsx index 37d87580d..17ac65429 100644 --- a/packages/instant/src/components/instant_heading.tsx +++ b/packages/instant/src/components/instant_heading.tsx @@ -10,6 +10,7 @@ import { format } from '../util/format'; import { AmountPlaceholder } from './amount_placeholder'; import { Container, Flex, Text } from './ui'; import { Icon } from './ui/icon'; +import { Spinner } from './ui/spinner'; export interface InstantHeadingProps { selectedAssetAmount?: BigNumber; @@ -70,6 +71,8 @@ export class InstantHeading extends React.Component { if (processState === OrderProcessState.FAILURE) { return ; + } else if (processState === OrderProcessState.PROCESSING) { + return ; } else if (processState === OrderProcessState.SUCCESS) { return ; } @@ -80,6 +83,8 @@ export class InstantHeading extends React.Component { const processState = this.props.buyOrderState.processState; if (processState === OrderProcessState.FAILURE) { return 'Order failed'; + } else if (processState === OrderProcessState.PROCESSING) { + return 'Processing Order...'; } else if (processState === OrderProcessState.SUCCESS) { return 'Tokens received!'; } diff --git a/packages/instant/src/containers/selected_asset_view_transaction_button.tsx b/packages/instant/src/containers/selected_asset_view_transaction_button.tsx index 1f9bfd7a6..91e959246 100644 --- a/packages/instant/src/containers/selected_asset_view_transaction_button.tsx +++ b/packages/instant/src/containers/selected_asset_view_transaction_button.tsx @@ -16,7 +16,11 @@ interface ConnectedState { const mapStateToProps = (state: State, _ownProps: {}): ConnectedState => ({ onClick: () => { - if (state.assetBuyer && state.buyOrderState.processState === OrderProcessState.SUCCESS) { + if ( + state.assetBuyer && + (state.buyOrderState.processState === OrderProcessState.PROCESSING || + state.buyOrderState.processState === OrderProcessState.SUCCESS) + ) { const etherscanUrl = etherscanUtil.getEtherScanTxnAddressIfExists( state.buyOrderState.txnHash, state.assetBuyer.networkId, -- cgit