aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-31 06:39:58 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-31 06:39:58 +0800
commitabaa39a5e24daa8a1a7ff5617a14d2f3088cb0e3 (patch)
treeb40d6f01f0df15f9be5d74fc54999abdab3b7db3 /packages/instant/src/containers
parent05f059492bbc86d61946562ac8c116259ded3487 (diff)
downloaddexon-0x-contracts-abaa39a5e24daa8a1a7ff5617a14d2f3088cb0e3.tar.gz
dexon-0x-contracts-abaa39a5e24daa8a1a7ff5617a14d2f3088cb0e3.tar.zst
dexon-0x-contracts-abaa39a5e24daa8a1a7ff5617a14d2f3088cb0e3.zip
Simulated Progress component working
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_asset_simulated_progress_bar.tsx48
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/instant/src/containers/selected_asset_simulated_progress_bar.tsx b/packages/instant/src/containers/selected_asset_simulated_progress_bar.tsx
new file mode 100644
index 000000000..1ddb4ae66
--- /dev/null
+++ b/packages/instant/src/containers/selected_asset_simulated_progress_bar.tsx
@@ -0,0 +1,48 @@
+import * as React from 'react';
+
+import { connect } from 'react-redux';
+
+import { SimulatedProgressBar } from '../components/simulated_progress_bar';
+
+import { State } from '../redux/reducer';
+import { OrderProcessState, OrderState, SimulatedProgress } from '../types';
+
+interface SelectedAssetProgressComponentProps {
+ buyOrderState: OrderState;
+ simulatedProgress?: SimulatedProgress;
+}
+export const SelectedAssetSimulatedProgressComponent: React.StatelessComponent<
+ SelectedAssetProgressComponentProps
+> = props => {
+ const { buyOrderState, simulatedProgress } = props;
+
+ console.log('simulatedProgress', simulatedProgress);
+
+ // TODO: uncomment after done testing
+ // const isOrderStateOk =
+ // buyOrderState.processState === OrderProcessState.PROCESSING ||
+ // buyOrderState.processState === OrderProcessState.SUCCESS;
+ const isOrderStateOk = true;
+
+ if (isOrderStateOk && simulatedProgress) {
+ return (
+ <SimulatedProgressBar
+ startTimeUnix={simulatedProgress.startTimeUnix}
+ expectedEndTimeUnix={simulatedProgress.expectedEndTimeUnix}
+ ended={simulatedProgress.ended}
+ />
+ );
+ }
+
+ return null;
+};
+
+interface ConnectedState {
+ buyOrderState: OrderState;
+ simulatedProgress?: SimulatedProgress;
+}
+const mapStateToProps = (state: State, _ownProps: {}): ConnectedState => ({
+ buyOrderState: state.buyOrderState,
+ simulatedProgress: state.simulatedProgress,
+});
+export const SelectedAssetSimulatedProgressBar = connect(mapStateToProps)(SelectedAssetSimulatedProgressComponent);