From 39f92e4c958590a58ac5c48db197f98fdd9723e1 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Thu, 25 Oct 2018 18:46:33 -0700 Subject: Get BuyOrderState one big connected component, and let user view failure --- .../src/components/buy_order_state_button.tsx | 43 ++++++++++++++++++---- packages/instant/src/components/retry_button.tsx | 11 ------ .../instant/src/components/secondary_button.tsx | 1 - packages/instant/src/components/ui/button.tsx | 1 + .../src/components/view_transaction_button.tsx | 11 ------ 5 files changed, 37 insertions(+), 30 deletions(-) delete mode 100644 packages/instant/src/components/retry_button.tsx delete mode 100644 packages/instant/src/components/view_transaction_button.tsx (limited to 'packages/instant/src/components') diff --git a/packages/instant/src/components/buy_order_state_button.tsx b/packages/instant/src/components/buy_order_state_button.tsx index 73a4d62e2..17aa46df5 100644 --- a/packages/instant/src/components/buy_order_state_button.tsx +++ b/packages/instant/src/components/buy_order_state_button.tsx @@ -1,15 +1,28 @@ +import { AssetBuyer, BuyQuote } from '@0x/asset-buyer'; import * as React from 'react'; import { Flex } from '../components/ui/flex'; +import { SecondaryButton } from '../components/secondary_button'; +import { BuyButton } from '../components/buy_button'; import { PlacingOrderButton } from '../components/placing_order_button'; -import { SelectedAssetBuyButton } from '../containers/selected_asset_buy_button'; -import { SelectedAssetRetryButton } from '../containers/selected_asset_retry_button'; -import { SelectedAssetViewTransactionButton } from '../containers/selected_asset_view_transaction_button'; +import { ColorOption } from '../style/theme'; import { OrderProcessState } from '../types'; +import { Button } from './ui/button'; +import { Text } from './ui/text'; + export interface BuyOrderStateButtonProps { + buyQuote?: BuyQuote; buyOrderProcessingState: OrderProcessState; + assetBuyer?: AssetBuyer; + onViewTransaction: () => void; + onAwaitingSignature: (buyQuote: BuyQuote) => void; + onSignatureDenied: (buyQuote: BuyQuote, error: Error) => void; + onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => void; + onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void; + onBuyFailure: (buyQuote: BuyQuote, txHash: string) => void; + onRetry: () => void; } // TODO: rename to buttons @@ -17,18 +30,34 @@ export const BuyOrderStateButton: React.StatelessComponent - - + + + Details + ); } else if ( props.buyOrderProcessingState === OrderProcessState.SUCCESS || props.buyOrderProcessingState === OrderProcessState.PROCESSING ) { - return ; + return View Transaction; } else if (props.buyOrderProcessingState === OrderProcessState.AWAITING_SIGNATURE) { return ; } - return ; + return ( + + ); }; diff --git a/packages/instant/src/components/retry_button.tsx b/packages/instant/src/components/retry_button.tsx deleted file mode 100644 index 36ae55e72..000000000 --- a/packages/instant/src/components/retry_button.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import * as React from 'react'; - -import { SecondaryButton, SecondaryButtonProps } from './secondary_button'; - -export interface RetryButtonProps extends SecondaryButtonProps { - onClick: () => void; -} - -export const RetryButton: React.StatelessComponent = props => { - return Try Again; -}; diff --git a/packages/instant/src/components/secondary_button.tsx b/packages/instant/src/components/secondary_button.tsx index 849003d0a..583058b5b 100644 --- a/packages/instant/src/components/secondary_button.tsx +++ b/packages/instant/src/components/secondary_button.tsx @@ -8,7 +8,6 @@ import { Text } from './ui/text'; export interface SecondaryButtonProps extends ButtonProps {} -// TODO: don't hard code this export const SecondaryButton: React.StatelessComponent = props => { const buttonProps = _.omit(props, 'text'); return ( diff --git a/packages/instant/src/components/ui/button.tsx b/packages/instant/src/components/ui/button.tsx index 1fcb2591c..5274d835b 100644 --- a/packages/instant/src/components/ui/button.tsx +++ b/packages/instant/src/components/ui/button.tsx @@ -52,6 +52,7 @@ export const Button = styled(PlainButton)` Button.defaultProps = { backgroundColor: ColorOption.primaryColor, + borderColor: ColorOption.primaryColor, width: 'auto', isDisabled: false, padding: '1em 2.2em', diff --git a/packages/instant/src/components/view_transaction_button.tsx b/packages/instant/src/components/view_transaction_button.tsx deleted file mode 100644 index 8d11bf132..000000000 --- a/packages/instant/src/components/view_transaction_button.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import * as React from 'react'; - -import { SecondaryButton, SecondaryButtonProps } from './secondary_button'; - -export interface ViewTransactionButtonProps extends SecondaryButtonProps { - onClick: () => void; -} - -export const ViewTransactionButton: React.StatelessComponent = props => { - return View Transaction; -}; -- cgit