diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-31 04:27:28 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-31 04:27:28 +0800 |
commit | 05b74ba1c8b10c356d396ce9a4834d053cd791b1 (patch) | |
tree | 5cb88a3fb9eddb5783fd22501b14bae5b7d6ea6d /packages/instant/src/containers | |
parent | 12dad41143c50d858edbb665d4795142a6339dd7 (diff) | |
download | dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar.gz dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar.bz2 dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar.lz dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar.xz dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.tar.zst dexon-sol-tools-05b74ba1c8b10c356d396ce9a4834d053cd791b1.zip |
Dispatching progress
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r-- | packages/instant/src/containers/selected_asset_progress_bar.tsx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/packages/instant/src/containers/selected_asset_progress_bar.tsx b/packages/instant/src/containers/selected_asset_progress_bar.tsx new file mode 100644 index 000000000..886e223d3 --- /dev/null +++ b/packages/instant/src/containers/selected_asset_progress_bar.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; + +import { connect } from 'react-redux'; + +import { ProgressBar } from '../components/progress_bar'; +import { State } from '../redux/reducer'; +import { OrderProcessState, OrderState } from '../types'; + +interface SelectedAssetProgressComponentProps { + buyOrderState: OrderState; + percentageDone?: number; +} +export const SelectedAssetProgressComponent: React.StatelessComponent<SelectedAssetProgressComponentProps> = props => { + const { buyOrderState, percentageDone } = props; + + // TODO: uncomment after done testing + // const isOrderStateOk = + // buyOrderState.processState === OrderProcessState.PROCESSING || + // buyOrderState.processState === OrderProcessState.SUCCESS; + const isOrderStateOk = true; + + if (isOrderStateOk && percentageDone) { + return <ProgressBar percentageDone={percentageDone} />; + } + + return null; +}; + +interface ConnectedState { + buyOrderState: OrderState; + percentageDone?: number; +} +const mapStateToProps = (state: State, _ownProps: {}): ConnectedState => ({ + buyOrderState: state.buyOrderState, + percentageDone: state.orderProgress && state.orderProgress.percentageDone, +}); +export const SelectedAssetProgressBar = connect(mapStateToProps)(SelectedAssetProgressComponent); |