aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-02 02:29:33 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-02 02:29:33 +0800
commit61a1a0be974c8610623f2bcb9a43797532cc78d9 (patch)
treec975bade60c51873e77f04669cf0d7edda185ec2 /packages/instant/src/components
parent3430896eb79b68e370b68f8954b1ef1b97d86a18 (diff)
downloaddexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar.gz
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar.bz2
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar.lz
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar.xz
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.tar.zst
dexon-sol-tools-61a1a0be974c8610623f2bcb9a43797532cc78d9.zip
Move BuyOrderProgress to its own component
Diffstat (limited to 'packages/instant/src/components')
-rw-r--r--packages/instant/src/components/buy_order_progress.tsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/instant/src/components/buy_order_progress.tsx b/packages/instant/src/components/buy_order_progress.tsx
new file mode 100644
index 000000000..e259e5606
--- /dev/null
+++ b/packages/instant/src/components/buy_order_progress.tsx
@@ -0,0 +1,35 @@
+import * as React from 'react';
+
+import { TimedProgressBar } from '../components/timed_progress_bar';
+
+import { TimeCounter } from '../components/time_counter';
+import { Container } from '../components/ui';
+import { OrderProcessState, OrderState } from '../types';
+
+export interface BuyOrderProgressProps {
+ buyOrderState: OrderState;
+}
+
+export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> = props => {
+ const { buyOrderState } = props;
+
+ if (
+ buyOrderState.processState === OrderProcessState.PROCESSING ||
+ buyOrderState.processState === OrderProcessState.SUCCESS ||
+ buyOrderState.processState === OrderProcessState.FAILURE
+ ) {
+ const progress = buyOrderState.progress;
+ const hasEnded = buyOrderState.processState !== OrderProcessState.PROCESSING;
+ const expectedTimeMs = progress.expectedEndTimeUnix - progress.startTimeUnix;
+ return (
+ <Container padding="20px 20px 0px 20px" width="100%">
+ <Container marginBottom="5px">
+ <TimeCounter estimatedTimeMs={expectedTimeMs} hasEnded={hasEnded} key={progress.startTimeUnix} />
+ </Container>
+ <TimedProgressBar expectedTimeMs={expectedTimeMs} hasEnded={hasEnded} key={progress.startTimeUnix} />
+ </Container>
+ );
+ }
+
+ return null;
+};