-
Notifications
You must be signed in to change notification settings - Fork 636
SDK: token details screen UI tweaks #8612
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
WalkthroughConsolidates TokenInfoScreen rendering by replacing early returns with a single conditional branch that handles pending, not-found, and token-present states. Increases the component's min-height from 350px to 450px and moves token detail sections to render only when token data exists. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/thirdweb/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (1)packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (2)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (1)
527-656: Consider early returns for improved readability.The refactoring from early returns to nested conditionals increases nesting and makes the "happy path" less clear. Early returns typically improve code readability by reducing cognitive load.
♻️ Optional refactor using early returns
- {tokenQuery.isPending ? ( - <Container flex="column" center="both" expand> - <Spinner size="lg" color="secondaryText" /> - </Container> - ) : !token ? ( - <Container flex="column" center="both" expand> - <Text size="sm" color="secondaryText"> - Token not found - </Text> - </Container> - ) : ( - <Container flex="column" gap="md" px="md" py="lg"> + {tokenQuery.isPending && ( + <Container flex="column" center="both" expand> + <Spinner size="lg" color="secondaryText" /> + </Container> + )} + + {!tokenQuery.isPending && !token && ( + <Container flex="column" center="both" expand> + <Text size="sm" color="secondaryText"> + Token not found + </Text> + </Container> + )} + + {!tokenQuery.isPending && token && ( + <Container flex="column" gap="md" px="md" py="lg"> {/* name + icon */} <Container flex="row" style={{ justifyContent: "space-between", alignItems: "center", }} > {/* ... rest of token details ... */} </Container> </Container> - )} + )}This approach uses logical AND (
&&) for each condition, reducing nesting depth and making each state more explicit.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.) in TypeScript
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
packages/thirdweb/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g.const { jsPDF } = await import("jspdf");)Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome governs formatting and linting; its rules live in biome.json. Run
pnpm fix&pnpm lintbefore committing, ensure there are no linting errors
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
🧬 Code graph analysis (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (7)
packages/thirdweb/src/react/web/ui/components/Spinner.tsx (1)
Spinner(11-42)apps/playground-web/src/app/x402/components/constants.ts (1)
token(4-9)packages/thirdweb/src/react/web/ui/components/text.tsx (2)
Text(18-34)Link(46-64)packages/thirdweb/src/react/web/ui/components/Img.tsx (1)
Img(12-152)packages/thirdweb/src/react/core/design-system/index.ts (2)
iconSize(166-176)radius(156-164)packages/thirdweb/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts (1)
formatCurrencyAmount(37-42)packages/thirdweb/src/exports/utils.ts (1)
shortenAddress(149-149)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Unit Tests
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Lint Packages
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (1)
518-518: Apply responsive minHeight logic to the TokenInfoScreen container.The minHeight was increased from 350px to 450px without responsive handling. The file already uses
props.isMobilefor responsive styling elsewhere (e.g., line 791), so this should follow the same pattern to prevent layout issues on smaller viewports.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8612 +/- ##
==========================================
- Coverage 53.05% 53.02% -0.04%
==========================================
Files 924 924
Lines 61738 61726 -12
Branches 4039 4035 -4
==========================================
- Hits 32757 32730 -27
- Misses 28884 28898 +14
- Partials 97 98 +1
🚀 New features to boost your workflow:
|
size-limit report 📦
|
Merge activity
|
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## 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, error handling, and layout adjustments.
### Detailed summary
- Removed redundant loading and error handling blocks.
- Consolidated conditional rendering for loading and error states.
- Increased minimum height of the main container from `350px` to `450px`.
- Maintained structure for displaying token information, including name, symbol, price, market cap, and address.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Refactor**
* Improved internal code organization for token information display component
* Adjusted minimum container height for token information screens in the bridge swap widget
<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
c284b3c to
e023f70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx:
- Around line 527-536: The UI currently treats both query failures and missing
tokens the same; update the JSX conditional around tokenQuery and token to
explicitly check tokenQuery.error before the !token branch and render a distinct
error state (e.g., a Container with a Text like "Failed to load token details"
and optional error message) when tokenQuery.error is truthy, leaving the
existing spinner for tokenQuery.isPending and the "Token not found" message only
for the case where the query succeeded but token is falsy; modify the
conditional that references tokenQuery, token, and tokenQuery.error in
select-token-ui.tsx accordingly.
🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (1)
518-518: Consider if the 100px minHeight increase is necessary.The container's minimum height increased from 350px to 450px. While this provides more space, it may create unnecessary whitespace for tokens with minimal metadata (e.g., tokens without market cap or volume data). Consider whether a smaller increase or dynamic sizing would better serve the range of token detail scenarios.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.) in TypeScript
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
packages/thirdweb/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g.const { jsPDF } = await import("jspdf");)Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome governs formatting and linting; its rules live in biome.json. Run
pnpm fix&pnpm lintbefore committing, ensure there are no linting errors
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
🧬 Code graph analysis (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (7)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
Container(80-193)packages/thirdweb/src/react/web/ui/components/Spinner.tsx (1)
Spinner(11-42)apps/playground-web/src/app/x402/components/constants.ts (1)
token(4-9)packages/thirdweb/src/react/web/ui/components/text.tsx (2)
Text(18-34)Link(46-64)packages/thirdweb/src/react/core/design-system/index.ts (2)
iconSize(166-176)radius(156-164)packages/thirdweb/src/react/web/ui/components/CopyIcon.tsx (1)
CopyIcon(12-60)packages/thirdweb/src/exports/utils.ts (1)
shortenAddress(149-149)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Build Packages
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Lint Packages
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx (1)
527-656: LGTM! Clean consolidation of conditional rendering.The refactor successfully consolidates the loading, not-found, and content states into a single, readable conditional structure. All token detail sections are correctly rendered only when the token exists, and the type narrowing ensures safety in the token-present branch.
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/select-token-ui.tsx
Show resolved
Hide resolved
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## 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}`
<!-- end pr-codex -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## 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.
<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
e023f70 to
2778745
Compare

PR-Codex overview
This PR refactors the rendering logic in the
TokenInfoScreencomponent of theselect-token-ui.tsxfile. It improves the layout and handling of loading and error states while ensuring consistent styling and structure.Detailed summary
Containerfrom350pxto450px.tokenQuery.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.