mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Show a balance for the Token To, update position of the MM fee, removes a link (#20030)
This commit is contained in:
parent
74cc312cb1
commit
1295474dc3
10
app/_locales/en/messages.json
generated
10
app/_locales/en/messages.json
generated
@ -3086,9 +3086,6 @@
|
|||||||
"message": "You have (1) pending transaction.",
|
"message": "You have (1) pending transaction.",
|
||||||
"description": "$1 is count of pending transactions"
|
"description": "$1 is count of pending transactions"
|
||||||
},
|
},
|
||||||
"percentage": {
|
|
||||||
"message": "$1%"
|
|
||||||
},
|
|
||||||
"permissionRequest": {
|
"permissionRequest": {
|
||||||
"message": "Permission request"
|
"message": "Permission request"
|
||||||
},
|
},
|
||||||
@ -4469,6 +4466,10 @@
|
|||||||
"message": "Includes a $1% MetaMask fee.",
|
"message": "Includes a $1% MetaMask fee.",
|
||||||
"description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number."
|
"description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number."
|
||||||
},
|
},
|
||||||
|
"swapIncludesMetaMaskFeeViewAllQuotes": {
|
||||||
|
"message": "Includes a $1% MetaMask fee – $2",
|
||||||
|
"description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number and $2 is a link to view all quotes."
|
||||||
|
},
|
||||||
"swapLearnMore": {
|
"swapLearnMore": {
|
||||||
"message": "Learn more about Swaps"
|
"message": "Learn more about Swaps"
|
||||||
},
|
},
|
||||||
@ -5233,6 +5234,9 @@
|
|||||||
"viewAllDetails": {
|
"viewAllDetails": {
|
||||||
"message": "View all details"
|
"message": "View all details"
|
||||||
},
|
},
|
||||||
|
"viewAllQuotes": {
|
||||||
|
"message": "view all quotes"
|
||||||
|
},
|
||||||
"viewContact": {
|
"viewContact": {
|
||||||
"message": "View contact"
|
"message": "View contact"
|
||||||
},
|
},
|
||||||
|
@ -173,9 +173,7 @@ const checkNotification = async (driver, options) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const changeExchangeRate = async (driver) => {
|
const changeExchangeRate = async (driver) => {
|
||||||
await driver.clickElement(
|
await driver.clickElement('[data-testid="review-quote-view-all-quotes"]');
|
||||||
'[data-testid="exchange-rate-display-base-symbol"]',
|
|
||||||
);
|
|
||||||
await driver.waitForSelector({ text: 'Quote details', tag: 'h2' });
|
await driver.waitForSelector({ text: 'Quote details', tag: 'h2' });
|
||||||
|
|
||||||
const networkFees = await driver.findElements(
|
const networkFees = await driver.findElements(
|
||||||
|
@ -6,7 +6,7 @@ exports[`ExchangeRateDisplay renders the component with initial props 1`] = `
|
|||||||
class="exchange-rate-display"
|
class="exchange-rate-display"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="box exchange-rate-display__quote-rate box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-default"
|
class="box exchange-rate-display__quote-rate--no-link box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default"
|
||||||
data-testid="exchange-rate-display-quote-rate"
|
data-testid="exchange-rate-display-quote-rate"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
|
@ -72,6 +72,13 @@ export default function ExchangeRateDisplay({
|
|||||||
rateToDisplay = formatSwapsValueForDisplay(rate);
|
rateToDisplay = formatSwapsValueForDisplay(rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const quoteRateClassName = onQuotesClick
|
||||||
|
? 'exchange-rate-display__quote-rate'
|
||||||
|
: 'exchange-rate-display__quote-rate--no-link';
|
||||||
|
const quoteRateColor = onQuotesClick
|
||||||
|
? TextColor.primaryDefault
|
||||||
|
: TextColor.textDefault;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames('exchange-rate-display', className)}>
|
<div className={classnames('exchange-rate-display', className)}>
|
||||||
<Box
|
<Box
|
||||||
@ -79,8 +86,8 @@ export default function ExchangeRateDisplay({
|
|||||||
justifyContent={JustifyContent.center}
|
justifyContent={JustifyContent.center}
|
||||||
alignItems={AlignItems.center}
|
alignItems={AlignItems.center}
|
||||||
onClick={onQuotesClick}
|
onClick={onQuotesClick}
|
||||||
color={TextColor.primaryDefault}
|
color={quoteRateColor}
|
||||||
className="exchange-rate-display__quote-rate"
|
className={quoteRateClassName}
|
||||||
data-testid="exchange-rate-display-quote-rate"
|
data-testid="exchange-rate-display-quote-rate"
|
||||||
>
|
>
|
||||||
<span>1</span>
|
<span>1</span>
|
||||||
|
@ -19,4 +19,8 @@
|
|||||||
&__quote-rate {
|
&__quote-rate {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__quote-rate--no-link {
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ exports[`MainQuoteSummary renders the component with initial props 4`] = `
|
|||||||
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="box exchange-rate-display__quote-rate box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-default"
|
class="box exchange-rate-display__quote-rate--no-link box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default"
|
||||||
data-testid="exchange-rate-display-quote-rate"
|
data-testid="exchange-rate-display-quote-rate"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
|
@ -586,7 +586,10 @@ export default function PrepareSwapPage({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const swapYourTokenBalance = `${t('balance')}: ${fromTokenString || '0'}`;
|
const yourTokenFromBalance = `${t('balance')}: ${fromTokenString || '0'}`;
|
||||||
|
const yourTokenToBalance = `${t('balance')}: ${
|
||||||
|
selectedToToken?.string || '0'
|
||||||
|
}`;
|
||||||
|
|
||||||
const isDirectWrappingEnabled = shouldEnableDirectWrapping(
|
const isDirectWrappingEnabled = shouldEnableDirectWrapping(
|
||||||
chainId,
|
chainId,
|
||||||
@ -883,7 +886,7 @@ export default function PrepareSwapPage({
|
|||||||
alignItems={AlignItems.stretch}
|
alignItems={AlignItems.stretch}
|
||||||
>
|
>
|
||||||
<div className="prepare-swap-page__balance-message">
|
<div className="prepare-swap-page__balance-message">
|
||||||
{fromTokenSymbol && swapYourTokenBalance}
|
{fromTokenSymbol && yourTokenFromBalance}
|
||||||
{showMaxBalanceLink && (
|
{showMaxBalanceLink && (
|
||||||
<div
|
<div
|
||||||
className="prepare-swap-page__max-balance"
|
className="prepare-swap-page__max-balance"
|
||||||
@ -997,6 +1000,15 @@ export default function PrepareSwapPage({
|
|||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Box
|
||||||
|
display={DISPLAY.FLEX}
|
||||||
|
justifyContent={JustifyContent.spaceBetween}
|
||||||
|
alignItems={AlignItems.stretch}
|
||||||
|
>
|
||||||
|
<div className="prepare-swap-page__balance-message">
|
||||||
|
{selectedToToken?.string && yourTokenToBalance}
|
||||||
|
</div>
|
||||||
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
{!showReviewQuote && toTokenIsNotDefault && occurrences < 2 && (
|
{!showReviewQuote && toTokenIsNotDefault && occurrences < 2 && (
|
||||||
<Box display={DISPLAY.FLEX} marginTop={2}>
|
<Box display={DISPLAY.FLEX} marginTop={2}>
|
||||||
|
@ -1047,7 +1047,6 @@ export default function ReviewQuote({ setReceiveToAmount }) {
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
variant={TextVariant.bodyMd}
|
variant={TextVariant.bodyMd}
|
||||||
as="h6"
|
|
||||||
marginRight={1}
|
marginRight={1}
|
||||||
color={TextColor.textAlternative}
|
color={TextColor.textAlternative}
|
||||||
>
|
>
|
||||||
@ -1063,39 +1062,11 @@ export default function ReviewQuote({ setReceiveToAmount }) {
|
|||||||
secondaryTokenValue={destinationValue}
|
secondaryTokenValue={destinationValue}
|
||||||
secondaryTokenDecimals={destinationTokenDecimals}
|
secondaryTokenDecimals={destinationTokenDecimals}
|
||||||
secondaryTokenSymbol={destinationTokenSymbol}
|
secondaryTokenSymbol={destinationTokenSymbol}
|
||||||
arrowColor="var(--color-primary-default)"
|
|
||||||
boldSymbols={false}
|
boldSymbols={false}
|
||||||
className="main-quote-summary__exchange-rate-display"
|
className="main-quote-summary__exchange-rate-display"
|
||||||
onQuotesClick={
|
|
||||||
/* istanbul ignore next */
|
|
||||||
() => {
|
|
||||||
trackAllAvailableQuotesOpened();
|
|
||||||
setSelectQuotePopoverShown(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showIconForSwappingTokens={false}
|
showIconForSwappingTokens={false}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
|
||||||
display={DISPLAY.FLEX}
|
|
||||||
justifyContent={JustifyContent.spaceBetween}
|
|
||||||
alignItems={AlignItems.stretch}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
variant={TextVariant.bodyMd}
|
|
||||||
as="h6"
|
|
||||||
color={TextColor.textAlternative}
|
|
||||||
>
|
|
||||||
{t('swapMetaMaskFee')}
|
|
||||||
</Text>
|
|
||||||
<Text
|
|
||||||
variant={TextVariant.bodyMd}
|
|
||||||
as="h6"
|
|
||||||
color={TextColor.textAlternative}
|
|
||||||
>
|
|
||||||
{t('percentage', [metaMaskFee])}
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
<Box
|
<Box
|
||||||
display={DISPLAY.FLEX}
|
display={DISPLAY.FLEX}
|
||||||
justifyContent={JustifyContent.spaceBetween}
|
justifyContent={JustifyContent.spaceBetween}
|
||||||
@ -1226,6 +1197,32 @@ export default function ReviewQuote({ setReceiveToAmount }) {
|
|||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
<Box
|
||||||
|
display={DISPLAY.FLEX}
|
||||||
|
marginTop={3}
|
||||||
|
justifyContent={JustifyContent.center}
|
||||||
|
alignItems={AlignItems.center}
|
||||||
|
>
|
||||||
|
<Text variant={TextVariant.bodySm} color={TextColor.textDefault}>
|
||||||
|
{t('swapIncludesMetaMaskFeeViewAllQuotes', [
|
||||||
|
metaMaskFee,
|
||||||
|
<ButtonLink
|
||||||
|
key="view-all-quotes"
|
||||||
|
data-testid="review-quote-view-all-quotes"
|
||||||
|
onClick={
|
||||||
|
/* istanbul ignore next */
|
||||||
|
() => {
|
||||||
|
trackAllAvailableQuotesOpened();
|
||||||
|
setSelectQuotePopoverShown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size={Size.inherit}
|
||||||
|
>
|
||||||
|
{t('viewAllQuotes')}
|
||||||
|
</ButtonLink>,
|
||||||
|
])}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
<SwapsFooter
|
<SwapsFooter
|
||||||
|
@ -52,7 +52,8 @@ describe('ReviewQuote', () => {
|
|||||||
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
||||||
expect(getByText('New quotes in')).toBeInTheDocument();
|
expect(getByText('New quotes in')).toBeInTheDocument();
|
||||||
expect(getByText('Quote rate')).toBeInTheDocument();
|
expect(getByText('Quote rate')).toBeInTheDocument();
|
||||||
expect(getByText('MetaMask fee')).toBeInTheDocument();
|
expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument();
|
||||||
|
expect(getByText('view all quotes')).toBeInTheDocument();
|
||||||
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
||||||
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
||||||
expect(getByText('Max fee:')).toBeInTheDocument();
|
expect(getByText('Max fee:')).toBeInTheDocument();
|
||||||
@ -71,7 +72,8 @@ describe('ReviewQuote', () => {
|
|||||||
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
||||||
expect(getByText('New quotes in')).toBeInTheDocument();
|
expect(getByText('New quotes in')).toBeInTheDocument();
|
||||||
expect(getByText('Quote rate')).toBeInTheDocument();
|
expect(getByText('Quote rate')).toBeInTheDocument();
|
||||||
expect(getByText('MetaMask fee')).toBeInTheDocument();
|
expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument();
|
||||||
|
expect(getByText('view all quotes')).toBeInTheDocument();
|
||||||
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
||||||
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
||||||
expect(getByText('Max fee:')).toBeInTheDocument();
|
expect(getByText('Max fee:')).toBeInTheDocument();
|
||||||
@ -93,7 +95,8 @@ describe('ReviewQuote', () => {
|
|||||||
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
const { getByText } = renderWithProvider(<ReviewQuote {...props} />, store);
|
||||||
expect(getByText('New quotes in')).toBeInTheDocument();
|
expect(getByText('New quotes in')).toBeInTheDocument();
|
||||||
expect(getByText('Quote rate')).toBeInTheDocument();
|
expect(getByText('Quote rate')).toBeInTheDocument();
|
||||||
expect(getByText('MetaMask fee')).toBeInTheDocument();
|
expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument();
|
||||||
|
expect(getByText('view all quotes')).toBeInTheDocument();
|
||||||
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
expect(getByText('Estimated gas fee')).toBeInTheDocument();
|
||||||
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
expect(getByText('0.00008 ETH')).toBeInTheDocument();
|
||||||
expect(getByText('Max fee:')).toBeInTheDocument();
|
expect(getByText('Max fee:')).toBeInTheDocument();
|
||||||
|
@ -38,7 +38,7 @@ exports[`ViewQuote renders the component with EIP-1559 enabled 2`] = `
|
|||||||
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="box exchange-rate-display__quote-rate box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-default"
|
class="box exchange-rate-display__quote-rate--no-link box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default"
|
||||||
data-testid="exchange-rate-display-quote-rate"
|
data-testid="exchange-rate-display-quote-rate"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
@ -110,7 +110,7 @@ exports[`ViewQuote renders the component with initial props 2`] = `
|
|||||||
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
class="exchange-rate-display main-quote-summary__exchange-rate-display"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="box exchange-rate-display__quote-rate box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-primary-default"
|
class="box exchange-rate-display__quote-rate--no-link box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default"
|
||||||
data-testid="exchange-rate-display-quote-rate"
|
data-testid="exchange-rate-display-quote-rate"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user