mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
Fixing warnings in unit test cases (#13349)
This commit is contained in:
parent
af848dec9b
commit
5b5b2cd7df
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
EDIT_GAS_MODES,
|
EDIT_GAS_MODES,
|
||||||
@ -24,7 +24,7 @@ const EditGasToolTip = ({
|
|||||||
transaction,
|
transaction,
|
||||||
t,
|
t,
|
||||||
}) => {
|
}) => {
|
||||||
const toolTipMessage = () => {
|
const toolTipMessage = useMemo(() => {
|
||||||
switch (priorityLevel) {
|
switch (priorityLevel) {
|
||||||
case PRIORITY_LEVELS.LOW:
|
case PRIORITY_LEVELS.LOW:
|
||||||
return t('lowGasSettingToolTipMessage', [
|
return t('lowGasSettingToolTipMessage', [
|
||||||
@ -76,7 +76,8 @@ const EditGasToolTip = ({
|
|||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
};
|
}, [editGasMode, estimateGreaterThanGasUse, priorityLevel, transaction, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="edit-gas-tooltip__container">
|
<div className="edit-gas-tooltip__container">
|
||||||
{priorityLevel !== PRIORITY_LEVELS.CUSTOM &&
|
{priorityLevel !== PRIORITY_LEVELS.CUSTOM &&
|
||||||
@ -97,9 +98,11 @@ const EditGasToolTip = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
{toolTipMessage && (
|
||||||
<div className="edit-gas-tooltip__container__message">
|
<div className="edit-gas-tooltip__container__message">
|
||||||
<Typography variant={TYPOGRAPHY.H7}>{toolTipMessage()}</Typography>
|
<Typography variant={TYPOGRAPHY.H7}>{toolTipMessage}</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
{priorityLevel === PRIORITY_LEVELS.CUSTOM ||
|
{priorityLevel === PRIORITY_LEVELS.CUSTOM ||
|
||||||
estimateGreaterThanGasUse ? null : (
|
estimateGreaterThanGasUse ? null : (
|
||||||
<div className="edit-gas-tooltip__container__values">
|
<div className="edit-gas-tooltip__container__values">
|
||||||
@ -111,6 +114,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{t('maxBaseFee')}
|
{t('maxBaseFee')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{maxFeePerGas && (
|
||||||
<Typography
|
<Typography
|
||||||
variant={TYPOGRAPHY.H7}
|
variant={TYPOGRAPHY.H7}
|
||||||
color={COLORS.NEUTRAL_GREY}
|
color={COLORS.NEUTRAL_GREY}
|
||||||
@ -118,6 +122,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{maxFeePerGas}
|
{maxFeePerGas}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Typography
|
<Typography
|
||||||
@ -127,6 +132,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{t('priorityFeeProperCase')}
|
{t('priorityFeeProperCase')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{maxPriorityFeePerGas && (
|
||||||
<Typography
|
<Typography
|
||||||
variant={TYPOGRAPHY.H7}
|
variant={TYPOGRAPHY.H7}
|
||||||
color={COLORS.NEUTRAL_GREY}
|
color={COLORS.NEUTRAL_GREY}
|
||||||
@ -134,6 +140,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{maxPriorityFeePerGas}
|
{maxPriorityFeePerGas}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Typography
|
<Typography
|
||||||
@ -143,6 +150,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{t('gasLimit')}
|
{t('gasLimit')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{gasLimit && (
|
||||||
<Typography
|
<Typography
|
||||||
variant={TYPOGRAPHY.H7}
|
variant={TYPOGRAPHY.H7}
|
||||||
color={COLORS.NEUTRAL_GREY}
|
color={COLORS.NEUTRAL_GREY}
|
||||||
@ -150,6 +158,7 @@ const EditGasToolTip = ({
|
|||||||
>
|
>
|
||||||
{gasLimit}
|
{gasLimit}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { uniq } from 'lodash';
|
import { uniq } from 'lodash';
|
||||||
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../../../helpers/utils/util';
|
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../../../helpers/utils/util';
|
||||||
import { useGasFeeContext } from '../../../../../contexts/gasFee';
|
import { useGasFeeContext } from '../../../../../contexts/gasFee';
|
||||||
@ -8,7 +8,7 @@ import { PriorityFeeTooltip } from '../tooltips';
|
|||||||
export default function LatestPriorityFeeField() {
|
export default function LatestPriorityFeeField() {
|
||||||
const { gasFeeEstimates } = useGasFeeContext();
|
const { gasFeeEstimates } = useGasFeeContext();
|
||||||
|
|
||||||
const renderPriorityFeeRange = () => {
|
const priorityFeeRange = useMemo(() => {
|
||||||
const { latestPriorityFeeRange } = gasFeeEstimates;
|
const { latestPriorityFeeRange } = gasFeeEstimates;
|
||||||
if (latestPriorityFeeRange) {
|
if (latestPriorityFeeRange) {
|
||||||
const formattedRange = uniq([
|
const formattedRange = uniq([
|
||||||
@ -18,12 +18,14 @@ export default function LatestPriorityFeeField() {
|
|||||||
return `${formattedRange} GWEI`;
|
return `${formattedRange} GWEI`;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
}, [gasFeeEstimates]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="network-statistics__info__field latest-priority-fee-field">
|
<div className="network-statistics__info__field latest-priority-fee-field">
|
||||||
<span className="network-statistics__info__field-data">
|
<span className="network-statistics__info__field-data">
|
||||||
<PriorityFeeTooltip>{renderPriorityFeeRange()}</PriorityFeeTooltip>
|
{priorityFeeRange && (
|
||||||
|
<PriorityFeeTooltip>{priorityFeeRange}</PriorityFeeTooltip>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<span className="network-statistics__info__field-label">
|
<span className="network-statistics__info__field-label">
|
||||||
<I18nValue messageKey="priorityFee" />
|
<I18nValue messageKey="priorityFee" />
|
||||||
|
@ -30,13 +30,12 @@ const NetworkStatistics = () => {
|
|||||||
<div className="network-statistics__info">
|
<div className="network-statistics__info">
|
||||||
<div className="network-statistics__info__field">
|
<div className="network-statistics__info__field">
|
||||||
<span className="network-statistics__info__field-data">
|
<span className="network-statistics__info__field-data">
|
||||||
<BaseFeeTooltip>
|
{gasFeeEstimates?.estimatedBaseFee && (
|
||||||
{gasFeeEstimates?.estimatedBaseFee &&
|
<BaseFeeTooltip>{`${roundToDecimalPlacesRemovingExtraZeroes(
|
||||||
`${roundToDecimalPlacesRemovingExtraZeroes(
|
|
||||||
gasFeeEstimates?.estimatedBaseFee,
|
gasFeeEstimates?.estimatedBaseFee,
|
||||||
0,
|
0,
|
||||||
)} GWEI`}
|
)} GWEI`}</BaseFeeTooltip>
|
||||||
</BaseFeeTooltip>
|
)}
|
||||||
</span>
|
</span>
|
||||||
<span className="network-statistics__info__field-label">
|
<span className="network-statistics__info__field-label">
|
||||||
<I18nValue messageKey="baseFee" />
|
<I18nValue messageKey="baseFee" />
|
||||||
|
@ -35,7 +35,7 @@ export default function FeeCard({
|
|||||||
onQuotesClick,
|
onQuotesClick,
|
||||||
chainId,
|
chainId,
|
||||||
isBestQuote,
|
isBestQuote,
|
||||||
supportsEIP1559V2,
|
supportsEIP1559V2 = false,
|
||||||
}) {
|
}) {
|
||||||
const t = useContext(I18nContext);
|
const t = useContext(I18nContext);
|
||||||
|
|
||||||
@ -211,5 +211,5 @@ FeeCard.propTypes = {
|
|||||||
numberOfQuotes: PropTypes.number.isRequired,
|
numberOfQuotes: PropTypes.number.isRequired,
|
||||||
chainId: PropTypes.string.isRequired,
|
chainId: PropTypes.string.isRequired,
|
||||||
isBestQuote: PropTypes.bool.isRequired,
|
isBestQuote: PropTypes.bool.isRequired,
|
||||||
supportsEIP1559V2: PropTypes.bool.isRequired,
|
supportsEIP1559V2: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user