Skip to content

chore: show max network fee tooltip #30208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,25 @@ exports[`BridgeQuoteCard should render the recommended quote 1`] = `
class="mm-box mm-text mm-text--body-md-medium mm-box--color-text-alternative-soft"
style="white-space: nowrap;"
>
Network fees
Network fee
</p>
<div
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md"
style="white-space: nowrap; overflow: visible;"
<div
class="mm-box"
>
$2.52 - $2.52
</p>
<div
class="mm-box mm-box--display-flex"
>
<p
class="mm-box mm-text mm-text--body-md"
style="white-space: nowrap; overflow: visible; text-decoration: underline; cursor: pointer;"
>
$2.52
</p>
</div>
</div>
<span
class="mm-box mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-icon-alternative-soft"
style="mask-image: url('./images/icons/swap-vertical.svg'); cursor: pointer;"
Expand Down Expand Up @@ -257,17 +265,25 @@ exports[`BridgeQuoteCard should render the recommended quote while loading new q
class="mm-box mm-text mm-text--body-md-medium mm-box--color-text-alternative-soft"
style="white-space: nowrap;"
>
Network fees
Network fee
</p>
<div
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md"
style="white-space: nowrap; overflow: visible;"
<div
class="mm-box"
>
$2.52 - $2.52
</p>
<div
class="mm-box mm-box--display-flex"
>
<p
class="mm-box mm-text mm-text--body-md"
style="white-space: nowrap; overflow: visible; text-decoration: underline; cursor: pointer;"
>
$2.52
</p>
</div>
</div>
<span
class="mm-box mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-icon-alternative-soft"
style="mask-image: url('./images/icons/swap-vertical.svg'); cursor: pointer;"
Expand Down
97 changes: 53 additions & 44 deletions ui/pages/bridge/quotes/bridge-quote-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,60 +189,69 @@ export const BridgeQuoteCard = () => {
: TextColor.textAlternativeSoft
}
>
{t('networkFees')}
{t('networkFee')}
</Text>
<Row gap={1}>
<Text
style={{
whiteSpace: 'nowrap',
overflow: 'visible',
}}
color={
isEstimatedReturnLow ? TextColor.warningDefault : undefined
}
>
{shouldShowNetworkFeesInGasToken
? // Network fee in gas token amounts
`${
activeQuote.totalNetworkFee?.valueInCurrency
? formatTokenAmount(
locale,
activeQuote.totalNetworkFee?.amount,
)
<Tooltip
position={PopoverPosition.TopStart}
offset={[-16, 16]}
iconName={IconName.Question}
triggerElement={
<Text
style={{
whiteSpace: 'nowrap',
overflow: 'visible',
textDecoration: 'underline',
cursor: 'pointer',
}}
color={
isEstimatedReturnLow
? TextColor.warningDefault
: undefined
} - ${
activeQuote.totalMaxNetworkFee?.valueInCurrency
? formatTokenAmount(
}
>
{shouldShowNetworkFeesInGasToken
? // Network fee in gas token amounts
`${
activeQuote?.totalNetworkFee?.valueInCurrency
? formatTokenAmount(
locale,
activeQuote?.totalNetworkFee?.amount,
ticker,
)
: undefined
}`
: // Network fee in display currency
`${
formatCurrencyAmount(
activeQuote?.totalNetworkFee?.valueInCurrency,
currency,
2,
) ??
formatTokenAmount(
locale,
activeQuote.totalMaxNetworkFee?.amount,
activeQuote?.totalNetworkFee?.amount,
ticker,
)
: undefined
}`
: // Network fee in display currency
`${
formatCurrencyAmount(
activeQuote.totalNetworkFee?.valueInCurrency,
currency,
2,
) ??
formatTokenAmount(
}`}
</Text>
}
>
{t('howNetworkFeesWorkExplanation', [
shouldShowNetworkFeesInGasToken
? formatTokenAmount(
locale,
activeQuote.totalNetworkFee?.amount,
activeQuote?.totalMaxNetworkFee.amount,
ticker,
)
} - ${
formatCurrencyAmount(
activeQuote.totalMaxNetworkFee?.valueInCurrency,
: formatCurrencyAmount(
activeQuote?.totalMaxNetworkFee.valueInCurrency,
currency,
2,
) ??
formatTokenAmount(
locale,
activeQuote.totalMaxNetworkFee?.amount,
ticker,
)
}`}
</Text>
),
])}
</Tooltip>

<Icon
style={{ cursor: 'pointer' }}
color={
Expand Down
Loading