aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-24 23:46:58 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-24 23:46:58 +0800
commit38f47a380b663df0a3f817100650e222dd7582e0 (patch)
tree23348daa23207b840b93335bfb823d451053ab53 /packages/instant/src/components
parent4c4286ac662d3dba928bf16b83ade5e5476f4614 (diff)
parent8635f8d7325d472dd7d4fac26f1a87bee17edd1a (diff)
downloaddexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.gz
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.bz2
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.lz
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.xz
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.tar.zst
dexon-sol-tools-38f47a380b663df0a3f817100650e222dd7582e0.zip
Merge branch 'development' into feature/instant/processing-state
Diffstat (limited to 'packages/instant/src/components')
-rw-r--r--packages/instant/src/components/buy_button.tsx2
-rw-r--r--packages/instant/src/components/buy_order_state_button.tsx23
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx8
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx4
4 files changed, 30 insertions, 7 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 1afd216d8..9c42f3d87 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -23,7 +23,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
onBuyFailure: util.boundNoop,
};
public render(): React.ReactNode {
- const shouldDisableButton = _.isUndefined(this.props.buyQuote);
+ const shouldDisableButton = _.isUndefined(this.props.buyQuote) || _.isUndefined(this.props.assetBuyer);
return (
<Button width="100%" onClick={this._handleClick} isDisabled={shouldDisableButton}>
<Text fontColor={ColorOption.white} fontWeight={600} fontSize="20px">
diff --git a/packages/instant/src/components/buy_order_state_button.tsx b/packages/instant/src/components/buy_order_state_button.tsx
new file mode 100644
index 000000000..5bc965c7d
--- /dev/null
+++ b/packages/instant/src/components/buy_order_state_button.tsx
@@ -0,0 +1,23 @@
+import * as React from 'react';
+
+import { PlacingOrderButton } from '../components/placing_order_button';
+import { SelectedAssetBuyButton } from '../containers/selected_asset_buy_button';
+import { SelectedAssetRetryButton } from '../containers/selected_asset_retry_button';
+import { SelectedAssetViewTransactionButton } from '../containers/selected_asset_view_transaction_button';
+import { AsyncProcessState } from '../types';
+
+export interface BuyOrderStateButtonProps {
+ buyOrderProcessingState: AsyncProcessState;
+}
+
+export const BuyOrderStateButton: React.StatelessComponent<BuyOrderStateButtonProps> = props => {
+ if (props.buyOrderProcessingState === AsyncProcessState.FAILURE) {
+ return <SelectedAssetRetryButton />;
+ } else if (props.buyOrderProcessingState === AsyncProcessState.SUCCESS) {
+ return <SelectedAssetViewTransactionButton />;
+ } else if (props.buyOrderProcessingState === AsyncProcessState.PENDING) {
+ return <PlacingOrderButton />;
+ }
+
+ return <SelectedAssetBuyButton />;
+};
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index 142e74dae..ffa5a8250 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -31,7 +31,7 @@ export interface ZeroExInstantOptionalProps {
}
export class ZeroExInstant extends React.Component<ZeroExInstantProps> {
- public store: Store;
+ private readonly _store: Store;
private static _mergeInitialStateWithProps(props: ZeroExInstantProps, state: State = INITIAL_STATE): State {
// Create merged object such that properties in props override default settings
const optionalPropsWithDefaults: ZeroExInstantOptionalProps = {
@@ -58,14 +58,14 @@ export class ZeroExInstant extends React.Component<ZeroExInstantProps> {
}
constructor(props: ZeroExInstantProps) {
super(props);
- this.store = store.create(ZeroExInstant._mergeInitialStateWithProps(this.props, INITIAL_STATE));
+ this._store = store.create(ZeroExInstant._mergeInitialStateWithProps(this.props, INITIAL_STATE));
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchAndDispatchToStore(this.store);
+ asyncData.fetchAndDispatchToStore(this._store);
}
public render(): React.ReactNode {
return (
- <Provider store={this.store}>
+ <Provider store={this._store}>
<SelectedAssetThemeProvider>
<ZeroExInstantContainer />
</SelectedAssetThemeProvider>
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 088d0a93e..1d17ed12a 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { LatestBuyQuoteOrderDetails } from '../containers/latest_buy_quote_order_details';
import { LatestError } from '../containers/latest_error';
-import { SelectedAssetButton } from '../containers/selected_asset_button';
+import { SelectedAssetBuyOrderStateButton } from '../containers/selected_asset_buy_order_state_button';
import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
import { ColorOption } from '../style/theme';
@@ -27,7 +27,7 @@ export const ZeroExInstantContainer: React.StatelessComponent<ZeroExInstantConta
<SelectedAssetInstantHeading />
<LatestBuyQuoteOrderDetails />
<Container padding="20px" width="100%">
- <SelectedAssetButton />
+ <SelectedAssetBuyOrderStateButton />
</Container>
</Flex>
</Container>