diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-19 04:49:22 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-19 04:49:22 +0800 |
commit | 45d8b522f49829068b8ce6a3940b4dcef724041f (patch) | |
tree | e28b4484a8285a6a66834c3dde295df1b92e4f69 /packages/instant/src/containers/latest_buy_quote_order_details.ts | |
parent | 4c9bdcd787ec24ce87d6b06b7e6f6304021d2513 (diff) | |
parent | 67df5a433d68a2af1a3a03a8bf431629a534dc97 (diff) | |
download | dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar.gz dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar.bz2 dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar.lz dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar.xz dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.tar.zst dexon-sol-tools-45d8b522f49829068b8ce6a3940b4dcef724041f.zip |
Merge branch 'development' into feature/website/0x-org
Diffstat (limited to 'packages/instant/src/containers/latest_buy_quote_order_details.ts')
-rw-r--r-- | packages/instant/src/containers/latest_buy_quote_order_details.ts | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/packages/instant/src/containers/latest_buy_quote_order_details.ts b/packages/instant/src/containers/latest_buy_quote_order_details.ts index 5dfe535e7..148735c47 100644 --- a/packages/instant/src/containers/latest_buy_quote_order_details.ts +++ b/packages/instant/src/containers/latest_buy_quote_order_details.ts @@ -1,32 +1,41 @@ -import { BuyQuoteInfo } from '@0x/asset-buyer'; -import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { connect } from 'react-redux'; +import { Dispatch } from 'redux'; import { oc } from 'ts-optchain'; +import { Action, actions } from '../redux/actions'; import { State } from '../redux/reducer'; -import { OrderDetails } from '../components/order_details'; -import { AsyncProcessState } from '../types'; +import { OrderDetails, OrderDetailsProps } from '../components/order_details'; +import { AsyncProcessState, BaseCurrency, Omit } from '../types'; +import { assetUtils } from '../util/asset'; -export interface LatestBuyQuoteOrderDetailsProps {} - -interface ConnectedState { - buyQuoteInfo?: BuyQuoteInfo; - selectedAssetUnitAmount?: BigNumber; - ethUsdPrice?: BigNumber; - isLoading: boolean; -} +type DispatchProperties = 'onBaseCurrencySwitchEth' | 'onBaseCurrencySwitchUsd'; +interface ConnectedState extends Omit<OrderDetailsProps, DispatchProperties> {} const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({ // use the worst case quote info buyQuoteInfo: oc(state).latestBuyQuote.worstCaseQuoteInfo(), selectedAssetUnitAmount: state.selectedAssetUnitAmount, ethUsdPrice: state.ethUsdPrice, isLoading: state.quoteRequestState === AsyncProcessState.Pending, + assetName: assetUtils.bestNameForAsset(state.selectedAsset), + baseCurrency: state.baseCurrency, }); +interface ConnectedDispatch extends Pick<OrderDetailsProps, DispatchProperties> {} +const mapDispatchToProps = (dispatch: Dispatch<Action>): ConnectedDispatch => ({ + onBaseCurrencySwitchEth: () => { + dispatch(actions.updateBaseCurrency(BaseCurrency.ETH)); + }, + onBaseCurrencySwitchUsd: () => { + dispatch(actions.updateBaseCurrency(BaseCurrency.USD)); + }, +}); + +export interface LatestBuyQuoteOrderDetailsProps {} export const LatestBuyQuoteOrderDetails: React.ComponentClass<LatestBuyQuoteOrderDetailsProps> = connect( mapStateToProps, + mapDispatchToProps, )(OrderDetails); |