From 277874594bda8567aeb69ba833c095cbf1f72c53 Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 7 Jan 2026 19:26:05 +0000 Subject: [PATCH] SDK: token details screen UI tweaks (#8612) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on improving the user interface of the `TokenInfoScreen` component in the `select-token-ui.tsx` file by enhancing loading states, adjusting layout heights, and refining token display logic. ### Detailed summary - Removed initial loading and token not found states. - Increased `Container` minHeight from `350px` to `450px`. - Refactored conditional rendering for token details. - Maintained structure for displaying token name, symbol, price, market cap, volume, and contract address. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit * **Refactor** * Consolidated rendering logic for the token information view to centralize pending, not-found, and content states. * Reorganized layout so detailed token sections render only when token data is present. * Adjusted minimum container height for token information screens in the bridge swap widget. ✏️ Tip: You can customize this high-level summary in your review settings. --- .../ui/Bridge/swap-widget/select-token-ui.tsx | 255 ++++++++---------- 1 file changed, 119 insertions(+), 136 deletions(-) diff --git a/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx b/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx index f1bc0d67e00..faf99fbdb7a 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx @@ -506,34 +506,6 @@ function TokenInfoScreen(props: { }); const token = tokenQuery.data; - if (tokenQuery.isPending) { - return ( - - - - ); - } - - if (!token) { - return ( - - - Token not found - - - ); - } - const isNativeToken = isNativeTokenAddress(props.tokenAddress); const explorerLink = isNativeToken ? `https://thirdweb.com/${props.chainId}` @@ -543,7 +515,7 @@ function TokenInfoScreen(props: { {/* Header */} @@ -552,125 +524,136 @@ function TokenInfoScreen(props: { - {/* Content */} - - {/* name + icon */} - + {tokenQuery.isPending ? ( + + + + ) : !token ? ( + - Name + Token not found - - - - } - /> - - {token.name} + + ) : ( + + {/* name + icon */} + + + Name + + + + } + /> + + {token.name} + + - - {/* symbol */} - - - {/* price */} - {"prices" in token && ( - - )} + {/* symbol */} + + + {/* price */} + {"prices" in token && ( + + )} - {/* market cap */} - {!!token.marketCapUsd && ( - - )} + {/* market cap */} + {!!token.marketCapUsd && ( + + )} - {/* volume 24h */} - {!!token.volume24hUsd && ( - - )} + {/* volume 24h */} + {!!token.volume24hUsd && ( + + )} - {/* address + link */} - - - Contract Address - + {/* address + link */} + + + Contract Address + - - {!isNativeToken && ( - - )} + + {!isNativeToken && ( + + )} - - {isNativeToken - ? "Native Currency" - : shortenAddress(props.tokenAddress)} - + + {isNativeToken + ? "Native Currency" + : shortenAddress(props.tokenAddress)} + + - + )} ); }