-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add fee breakdown tooltip to payment route component #150
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
base: main
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@rodrigopavezi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 47 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
WalkthroughAdds Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI as PaymentRoute
participant TT as Tooltip
User->>UI: View route row
UI->>UI: Read route.feeInUSD and route.feeBreakdown
alt feeBreakdown present
UI->>TT: Render Tooltip (Info icon) with formatted breakdown
User->>TT: Click Info icon
note right of UI #f8f3d4: click handler calls stopPropagation
TT-->>User: Show breakdown content
else no feeBreakdown
UI-->>User: Show USD fee only
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Comment |
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
🧹 Nitpick comments (2)
src/components/payment-route.tsx (1)
75-108
: Improve key uniqueness and prep for i18n; optional memoization.
- Keys can collide if two items share type/provider/stage. Append index.
- Consider externalizing "Fee Breakdown", "Gas Fee", "Bridge Fee", "Platform Fee" for i18n.
- Optionally memoize the JSX to avoid recompute on each render.
Apply this minimal key fix:
- {route.feeBreakdown.map((fee) => ( + {route.feeBreakdown.map((fee, i) => ( <div - key={`${fee.type}-${fee.provider}-${fee.stage}`} + key={`${fee.type}-${fee.provider}-${fee.stage}-${i}`} className="flex justify-between items-start text-xs" >src/lib/types/index.ts (1)
12-23
: Extract FeeBreakdownItem type and reuse for clarity and reuse.Keeps PaymentRoute concise and improves ergonomics across the codebase.
Apply this change within the interface:
- feeBreakdown?: { - type: "gas" | "crosschain" | "platform"; - stage: "sending" | "overall"; - provider: string; - amount: string; - amountFormatted: string; - amountInGwei?: string | null; - currency: string; - network: string; - rateProvider?: string; - receiverAddress?: string; - }[]; + feeBreakdown?: FeeBreakdownItem[];And add this type near the top of the file:
export type FeeBreakdownItem = { type: "gas" | "crosschain" | "platform"; stage: "sending" | "overall"; provider: string; amount: string; amountFormatted: string; amountInGwei?: string | null; currency: string; network: string; rateProvider?: string; receiverAddress?: string; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/payment-route.tsx
(3 hunks)src/lib/types/index.ts
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/payment-route.tsx (1)
src/components/ui/tooltip.tsx (1)
Tooltip
(11-26)
⏰ 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). (1)
- GitHub Check: Build
🔇 Additional comments (2)
src/components/payment-route.tsx (2)
1-1
: Tooltip import looks good.Matches the Radix-based Tooltip API used in the codebase.
3-3
: Info icon import is appropriate.Icon is used as a discrete tooltip trigger.
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.
…ayment route component
…ext color in payment route component
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.
Looking good, nice and simple 💯
🚢 before I merge that big ecommerce chonker PR and potentially cause conflicts 😅
Fixes #146
Summary by CodeRabbit
New Features
Changes