aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 04:46:14 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 04:46:14 +0800
commit1880c34ce066a8e33047690ef9fb90393100abd9 (patch)
treec6facf128bb4af4eadd3b45023b0de209e7d847a /packages/instant/src/containers
parentaf91a56a5594d07d7da6caaeff79f5a7fb31ff98 (diff)
downloaddexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar.gz
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar.bz2
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar.lz
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar.xz
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.tar.zst
dexon-sol-tools-1880c34ce066a8e33047690ef9fb90393100abd9.zip
feat(instant): Disable input when processing
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_erc20_asset_amount_input.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
index ee76e9d66..6e1957a59 100644
--- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
+++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
@@ -25,6 +25,7 @@ interface ConnectedState {
assetBuyer?: AssetBuyer;
value?: BigNumberInput;
asset?: ERC20Asset;
+ disabled: boolean;
}
interface ConnectedDispatch {
@@ -35,21 +36,29 @@ interface ConnectedProps {
value?: BigNumberInput;
asset?: ERC20Asset;
onChange: (value?: BigNumberInput, asset?: ERC20Asset) => void;
+ disabled: boolean;
}
type FinalProps = ConnectedProps & SelectedERC20AssetAmountInputProps;
const mapStateToProps = (state: State, _ownProps: SelectedERC20AssetAmountInputProps): ConnectedState => {
+ const processState = state.buyOrderState.processState;
+ const isEnabled = processState === OrderProcessState.NONE || processState === OrderProcessState.FAILURE;
+ const disabled = !isEnabled;
+
const selectedAsset = state.selectedAsset;
if (_.isUndefined(selectedAsset) || selectedAsset.metaData.assetProxyId !== AssetProxyId.ERC20) {
return {
value: state.selectedAssetAmount,
+ disabled,
};
}
+
return {
assetBuyer: state.assetBuyer,
value: state.selectedAssetAmount,
asset: selectedAsset as ERC20Asset,
+ disabled,
};
};
@@ -114,6 +123,7 @@ const mergeProps = (
onChange: (value, asset) => {
connectedDispatch.updateBuyQuote(connectedState.assetBuyer, value, asset);
},
+ disabled: connectedState.disabled,
};
};