feat: add user name click on receipts#1330
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughExtracts avatar click logic into a dedicated handler in TransactionDetailsHeaderCard and exposes an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx(2 hunks)src/components/UserHeader/index.tsx(3 hunks)
⏰ 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: Deploy-Preview
🔇 Additional comments (4)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx (2)
191-191: LGTM! Avatar click handling is correctly implemented.The conditional cursor styling and onClick handler are properly applied based on the
isAvatarClickableflag.
223-223: LGTM! Name click handler is correctly passed to VerifiedUserLabel.The
onNameClickprop is conditionally passed only whenisAvatarClickableis true, maintaining consistency with the avatar click behavior.src/components/UserHeader/index.tsx (2)
53-53: LGTM! New prop definition is well-structured.The optional
onNameClickprop is properly typed and follows TypeScript best practices.Also applies to: 62-62
99-104: LGTM! Name click implementation is correct.The implementation properly:
- Conditionally applies
cursor-pointerstyling whenonNameClickis provided- Attaches the click handler only when provided
- Applies only to non-crypto addresses (preserved for the crypto address branch)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx (1)
191-191: Add keyboard accessibility for the clickable avatar.The avatar container is clickable but lacks proper keyboard accessibility. Users navigating with a keyboard cannot interact with it.
Apply this diff to add keyboard accessibility:
- <div className={twMerge(isAvatarClickable && 'cursor-pointer')} onClick={handleUserPfpClick}> + <div + className={twMerge(isAvatarClickable && 'cursor-pointer')} + onClick={handleUserPfpClick} + onKeyDown={isAvatarClickable ? (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + handleUserPfpClick() + } + } : undefined} + role={isAvatarClickable ? 'button' : undefined} + tabIndex={isAvatarClickable ? 0 : undefined} + >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx(2 hunks)
⏰ 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: Deploy-Preview
🔇 Additional comments (2)
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx (2)
223-223: LGTM! Consistent clickability pattern.The conditional passing of
onNameClickcorrectly mirrors the avatar's clickability behavior, ensuring a consistent user experience.
182-186: Apply URL encoding touserNamebefore navigation to ensure special characters don't break the route.While usernames are validated to be 4–12 characters in
src/components/Setup/Views/Signup.tsx, the character set is not constrained in the visible code. Other parts of the codebase usedecodeURIComponentwhen extracting usernames from URL parameters (e.g.,src/app/send/[...username]/layout.tsx), suggesting the system expects URL-encoded usernames. ThehandleUserPfpClickfunction should consistently apply URL encoding:router.push(`/${encodeURIComponent(userName)}`)Verify with your backend team whether usernames are restricted to URL-safe characters (alphanumeric only) before deciding if this is necessary.
No description provided.