-
Notifications
You must be signed in to change notification settings - Fork 635
[MNY-351] Portal: Add swap widget iframe docs #8604
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.
4 Skipped Deployments
|
|
WalkthroughThis PR adds comprehensive documentation for the Swap Widget, introducing separate pages for React and iframe implementations, restructuring the main Swap Widget page with updated features and descriptions, and adding sidebar navigation links and a reusable tabbed code preview component. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8604 +/- ##
=======================================
Coverage 53.19% 53.19%
=======================================
Files 922 922
Lines 61480 61480
Branches 4032 4032
=======================================
Hits 32706 32706
Misses 28676 28676
Partials 98 98
🚀 New features to boost your workflow:
|
size-limit report 📦
|
a6340c1 to
9f265bf
Compare
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 enhances the `Swap Widget` functionality by adding an `iframe` integration option and a new `React Component`. It updates documentation and examples for better usability and expands features like dark/light mode support and customizable token selections.
### Detailed summary
- Added `links` for `React Component` and `Iframe` in `sidebar.tsx`.
- Introduced `IframeCodePreview` component in `iframe-code-preview.tsx`.
- Updated `page.mdx` for `iframe` integration with features and examples.
- Revised `page.mdx` for `react` with improved descriptions and features.
- Enhanced API reference and examples for token selection configurations.
- Added iframe event listening instructions for swap results.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
c584a93 to
f344fb5
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: 0
🧹 Nitpick comments (1)
apps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsx (1)
3-34: Consider consolidating duplicate IframeCodePreview components.This component is nearly identical to the one at
apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx. The only differences are the iframe title and theclassNameprop. Consider creating a shared, reusable component that acceptstitleas a prop to eliminate duplication and simplify maintenance.🔎 Proposed refactor to create a shared component
Create a shared component at
apps/portal/src/components/iframe-code-preview.tsx:import { CodeBlock, Tabs, TabsContent, TabsList, TabsTrigger } from "@doc"; export function IframeCodePreview(props: { src: string; title: string; className?: string; }) { return ( <Tabs defaultValue="code"> <TabsList> <TabsTrigger value="code">Code</TabsTrigger> <TabsTrigger value="preview">Preview</TabsTrigger> </TabsList> <TabsContent value="code"> <CodeBlock code={`\ <iframe src="${props.src}" height="750px" width="100%" style="border: 0;" />`} lang="html" /> </TabsContent> <TabsContent value="preview"> <iframe title={props.title} src={props.src} height="750px" width="100%" className={props.className} style={{ border: 0 }} /> </TabsContent> </Tabs> ); }Then use it in both locations:
import { IframeCodePreview } from "@/components/iframe-code-preview"; // In swap-widget <IframeCodePreview src={url} title="Swap widget iframe" className="rounded-xl" /> // In bridge-widget <IframeCodePreview src={url} title="Bridge widget iframe" />
📜 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 (5)
apps/portal/src/app/bridge/sidebar.tsxapps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/swap-widget/iframe/page.mdxapps/portal/src/app/bridge/swap-widget/page.mdxapps/portal/src/app/bridge/swap-widget/react/page.mdx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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:
apps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.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:
apps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
apps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.tsx
🧬 Code graph analysis (1)
apps/portal/src/app/bridge/swap-widget/iframe/iframe-code-preview.tsx (1)
apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx (1)
IframeCodePreview(3-33)
🪛 Gitleaks (8.30.0)
apps/portal/src/app/bridge/swap-widget/iframe/page.mdx
[high] 76-76: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
apps/portal/src/app/bridge/swap-widget/react/page.mdx
[high] 82-82: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
[high] 113-113: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
[high] 128-128: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
⏰ 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). (7)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
apps/portal/src/app/bridge/sidebar.tsx (1)
60-69: LGTM! Consistent navigation structure.The nested links for Swap Widget follow the same pattern as Bridge Widget and Checkout Widget, maintaining consistency across the sidebar navigation.
apps/portal/src/app/bridge/swap-widget/iframe/page.mdx (1)
1-167: LGTM! Comprehensive iframe documentation.The documentation is well-structured with clear examples for token selection, theming, currency, and event handling. The postMessage event listener code correctly validates the origin and source before processing events.
Note: The static analysis warning about an API key on line 76 is a false positive—it's an Ethereum contract address (Base USDC), which is public information.
apps/portal/src/app/bridge/swap-widget/react/page.mdx (1)
1-154: LGTM! Well-structured React component documentation.The documentation provides clear, progressive examples from basic usage to advanced token configuration. The guidance to wrap with
ThirdwebProvideris helpful, and the variousprefillconfiguration examples cover common use cases effectively.Note: The static analysis warnings about API keys on lines 82, 113, and 128 are false positives—these are Ethereum contract addresses (Base USDC), which are public information.
apps/portal/src/app/bridge/swap-widget/page.mdx (1)
1-68: LGTM! Improved documentation structure.The restructuring creates a cleaner landing page that directs users to specific implementation guides (iframe vs React). The updated feature descriptions (90+ blockchains, route optimization) are more accurate and comprehensive, and the use of
ArticleIconCardcomponents provides clear navigation paths.

PR-Codex overview
This PR enhances the
Swap Widgetby introducing anIframeintegration and aReact Component, along with improved documentation. It adds features like customizable token selection and UI themes, promoting easier integration for developers.Detailed summary
linksforReact ComponentandIframeinsidebar.tsx.IframeCodePreviewcomponent iniframe-code-preview.tsx.page.mdxforIframeintegration with features and examples.swap-widgetdocumentation with more details on usage and configuration.Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.