From 03b235bb428e8a61934ff603f22f057d8394b56a Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 11 Oct 2018 17:35:22 -0700 Subject: feat: populate order details with information from worst buy quote --- .../containers/latest_buy_quote_order_details.ts | 26 ++++++++++++++++++++++ .../src/containers/selected_asset_buy_button.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 packages/instant/src/containers/latest_buy_quote_order_details.ts (limited to 'packages/instant/src/containers') diff --git a/packages/instant/src/containers/latest_buy_quote_order_details.ts b/packages/instant/src/containers/latest_buy_quote_order_details.ts new file mode 100644 index 000000000..77d84289b --- /dev/null +++ b/packages/instant/src/containers/latest_buy_quote_order_details.ts @@ -0,0 +1,26 @@ +import { BuyQuoteInfo } from '@0xproject/asset-buyer'; +import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; +import * as React from 'react'; +import { connect } from 'react-redux'; + +import { State } from '../redux/reducer'; + +import { OrderDetails } from '../components/order_details'; + +export interface LatestBuyQuoteOrderDetailsProps {} + +interface ConnectedState { + buyQuoteInfo?: BuyQuoteInfo; + ethUsdPrice?: BigNumber; +} + +const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({ + // use the worst case quote info + buyQuoteInfo: _.get(state, 'latestBuyQuote.worstCaseQuoteInfo'), + ethUsdPrice: state.ethUsdPrice, +}); + +export const LatestBuyQuoteOrderDetails: React.ComponentClass = connect( + mapStateToProps, +)(OrderDetails); diff --git a/packages/instant/src/containers/selected_asset_buy_button.ts b/packages/instant/src/containers/selected_asset_buy_button.ts index f537294e4..678c7e445 100644 --- a/packages/instant/src/containers/selected_asset_buy_button.ts +++ b/packages/instant/src/containers/selected_asset_buy_button.ts @@ -9,7 +9,7 @@ import { Action, ActionTypes, AsyncProcessState } from '../types'; import { assetBuyer } from '../util/asset_buyer'; import { web3Wrapper } from '../util/web3_wrapper'; -import { BuyButton } from '../components/buy_button'; +import { BuyButton, BuyButtonProps } from '../components/buy_button'; export interface SelectedAssetBuyButtonProps {} -- cgit v1.2.3