Skip to content
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

Hide separator dot when token price is not available #3226

Merged
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
43 changes: 24 additions & 19 deletions wormhole-connect/src/views/v2/Redeem/TransactionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ const TransactionDetails = () => {

return (
<Stack alignItems="center" direction="row" justifyContent="flex-start">
<AssetBadge
chainConfig={sourceChainConfig}
token={sourceTokenConfig}
/>
<AssetBadge chainConfig={sourceChainConfig} token={sourceTokenConfig} />
<Stack direction="column" marginLeft="12px">
<Typography fontSize={16}>
{formattedAmount} {sourceToken.symbol}
Expand All @@ -107,7 +104,7 @@ const TransactionDetails = () => {
) : (
<>
{usdAmount}
{separator}
{usdAmount ? separator : null}
{sourceChainConfig.displayName}
{separator}
{senderAddress}
Expand All @@ -118,14 +115,15 @@ const TransactionDetails = () => {
</Stack>
);
}, [
amount,
sourceToken,
fromChain,
sender,
separator,
token,
getTokenPrice,
amount,
sender,
theme.palette.text.secondary,
isFetchingTokenPrices,
lastTokenPriceUpdate,
separator,
]);

// Render details for the received amount
Expand All @@ -150,10 +148,7 @@ const TransactionDetails = () => {

return (
<Stack alignItems="center" direction="row" justifyContent="flex-start">
<AssetBadge
chainConfig={destChainConfig}
token={destToken}
/>
<AssetBadge chainConfig={destChainConfig} token={destToken} />
<Stack direction="column" marginLeft="12px">
<Typography fontSize={16}>
{formattedReceiveAmount} {destToken!.symbol}
Expand All @@ -164,7 +159,7 @@ const TransactionDetails = () => {
) : (
<>
{usdAmount}
{separator}
{usdAmount ? separator : null}
{destChainConfig.displayName}
{separator}
{recipientAddress}
Expand All @@ -174,10 +169,13 @@ const TransactionDetails = () => {
</Stack>
</Stack>
);
// ESLint complains that lastTokenPriceUpdate is unused/unnecessary here, but that's wrong.
// We want to recompute the price after we update conversion rates.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
destToken,
getTokenPrice,
receiveAmount,

receivedToken,
recipient,
separator,
theme.palette.text.secondary,
Expand Down Expand Up @@ -238,8 +236,13 @@ const TransactionDetails = () => {
{isFetchingTokenPrices ? <CircularProgress size={14} /> : feeValue}
</Stack>
);

}, [relayerFee, routeName, theme.palette.text.secondary, isFetchingTokenPrices]);
}, [
relayerFee,
getTokenPrice,
routeName,
theme.palette.text.secondary,
isFetchingTokenPrices,
]);

const destinationGas = useMemo(() => {
if (
Expand Down Expand Up @@ -274,6 +277,9 @@ const TransactionDetails = () => {
)}
</Stack>
);
// ESLint complains that lastTokenPriceUpdate is unused/unnecessary here, but that's wrong.
// We want to recompute the price after we update conversion rates.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
receiveNativeAmount,
theme.palette.text.secondary,
Expand All @@ -282,7 +288,6 @@ const TransactionDetails = () => {
lastTokenPriceUpdate,
]);


const explorerLink = useMemo(() => {
// Fallback to routeName if RouteContext value is not available
const route = routeContext.route ?? routeName;
Expand Down
Loading