mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +00:00
c631f45ab7
* Remove gas dropdown & Add gas sliders * Update styles * Revert changes made to requestpayment.tsx * Update style & add custom labels to GasLimitField * Update styles * Update confirm transaction modal * Revert "Update confirm transaction modal" This reverts commit 743c9a505fe070feb55f7af550ad918a3d8899d1. * Add transaction fee to tx confirmation modal * Update styles * Remove old gasPriceDropdown files & use network units in tx fee * Add option to lock gaslimit data * fix tslint errors * Rename lockData to readOnly * Add option to check if validAmount before generating transaction * Add nonce field if gas slider is readonly * Automatically set nonce in <Send/> * Update snapshot * Move getNonceRequested to GasSlider component * Add optional to check value for isValidAmount selector * Add selector for transaction fee * Update GasSlider component & Rename to Gas * update snapshots * Fix subtabs className * Update styles * Remove dataField on contract interact * rename <Gas/> to <TXMetaDataPanel/>
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
import React from 'react';
|
|
import { GasLimitFieldFactory } from './GasLimitFieldFactory';
|
|
import translate from 'translations';
|
|
import { CSSTransition } from 'react-transition-group';
|
|
import { Spinner } from 'components/ui';
|
|
import { gasLimitValidator } from 'libs/validators';
|
|
|
|
interface Props {
|
|
includeLabel: boolean;
|
|
onlyIncludeLoader: boolean;
|
|
customLabel?: string;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export const GaslimitLoading: React.SFC<{
|
|
gasEstimationPending: boolean;
|
|
onlyIncludeLoader?: boolean;
|
|
}> = ({ gasEstimationPending, onlyIncludeLoader }) => (
|
|
<CSSTransition in={gasEstimationPending} timeout={300} classNames="fade">
|
|
<div className={`Calculating-limit small ${gasEstimationPending ? 'active' : ''}`}>
|
|
{!!onlyIncludeLoader ? 'Calculating gas limit' : 'Calculating'}
|
|
<Spinner />
|
|
</div>
|
|
</CSSTransition>
|
|
);
|
|
|
|
export const GasLimitField: React.SFC<Props> = ({
|
|
includeLabel,
|
|
onlyIncludeLoader,
|
|
customLabel,
|
|
disabled
|
|
}) => (
|
|
<React.Fragment>
|
|
<GasLimitFieldFactory
|
|
withProps={({ gasLimit: { raw }, onChange, readOnly, gasEstimationPending }) => (
|
|
<React.Fragment>
|
|
<div className="flex-wrapper">
|
|
{includeLabel ? (
|
|
customLabel ? (
|
|
<label>{customLabel} </label>
|
|
) : (
|
|
<label>{translate('TRANS_gas')} </label>
|
|
)
|
|
) : null}
|
|
<div className="flex-spacer" />
|
|
<GaslimitLoading
|
|
gasEstimationPending={gasEstimationPending}
|
|
onlyIncludeLoader={false}
|
|
/>
|
|
</div>
|
|
{onlyIncludeLoader ? null : (
|
|
<input
|
|
className={`form-control ${gasLimitValidator(raw) ? 'is-valid' : 'is-invalid'}`}
|
|
type="number"
|
|
placeholder="e.g. 21000"
|
|
readOnly={!!readOnly}
|
|
value={raw}
|
|
onChange={onChange}
|
|
disabled={disabled}
|
|
/>
|
|
)}
|
|
</React.Fragment>
|
|
)}
|
|
/>
|
|
</React.Fragment>
|
|
);
|