Fix Offline Send (#857)

* add offline check to isValidAmount selector

* add z-index fix to AdvancedGas components

* remove z-index mod, use bootstrap class instead
This commit is contained in:
Danny Skubak 2018-01-18 21:55:02 -05:00 committed by Daniel Ternyak
parent a82cbfbc72
commit f13d490f1c
2 changed files with 15 additions and 3 deletions

View File

@ -58,15 +58,15 @@ class AdvancedGas extends React.Component<Props> {
<GasLimitField includeLabel={false} onlyIncludeLoader={false} /> <GasLimitField includeLabel={false} onlyIncludeLoader={false} />
</div> </div>
<div className="col-md-4 col-sm-12"> <div className="col-md-4 col-sm-12 col-xs-12">
<NonceField alwaysDisplay={true} /> <NonceField alwaysDisplay={true} />
</div> </div>
<div className="col-md-12"> <div className="col-md-12 col-xs-12">
<DataField /> <DataField />
</div> </div>
<div className="col-sm-12"> <div className="col-sm-12 col-xs-12">
<FeeSummary <FeeSummary
render={({ gasPriceWei, gasLimit, fee, usd }) => ( render={({ gasPriceWei, gasLimit, fee, usd }) => (
<span> <span>

View File

@ -4,6 +4,7 @@ import { AppState } from 'reducers';
import { isEtherUnit, TokenValue, Wei, Address } from 'libs/units'; import { isEtherUnit, TokenValue, Wei, Address } from 'libs/units';
import { getDataExists, getValidGasCost } from 'selectors/transaction'; import { getDataExists, getValidGasCost } from 'selectors/transaction';
import { getCurrentBalance } from 'selectors/wallet'; import { getCurrentBalance } from 'selectors/wallet';
import { getOffline } from 'selectors/config';
interface ICurrentValue { interface ICurrentValue {
raw: string; raw: string;
@ -42,6 +43,17 @@ const isValidAmount = (state: AppState): boolean => {
const currentValue = getCurrentValue(state); const currentValue = getCurrentValue(state);
const dataExists = getDataExists(state); const dataExists = getDataExists(state);
const validGasCost = getValidGasCost(state); const validGasCost = getValidGasCost(state);
const isOffline = getOffline(state);
// If value is an empty string, mark as invalid
if (!currentValue.raw) {
return false;
}
// If offline, assume amount is valid
if (isOffline) {
return true;
}
// We do some wallet validation here. // We do some wallet validation here.
// For some reason with MetaMask, sometimes the currentValue.value is not a null // For some reason with MetaMask, sometimes the currentValue.value is not a null