[TASK-12655] Fix: hide action btns for own profile POV#1155
[TASK-12655] Fix: hide action btns for own profile POV#1155Zishan-7 merged 2 commits intopeanut-wallet-devfrom
Conversation
WalkthroughUpdates PublicProfile to use the auth context to detect self-profiles, add an optional onSendClick prop, set isLoggedIn default to false, and render Send/Request actions only for other users. handleSend prefers onSendClick, else dispatches paymentActions.setView('INITIAL'). Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-05-13T10:05:24.057ZApplied to files:
🧬 Code graph analysis (1)src/components/Profile/components/PublicProfile.tsx (3)
⏰ 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)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/Profile/components/PublicProfile.tsx (1)
45-53: Avoid shadowinguserin the usersApi callback.
then((user) => { ... })shadows the authuserabove and can confuse readers. Rename toprofileUser.- usersApi.getByUsername(username).then((user) => { - if (user?.fullName) setFullName(user.fullName) - if (user?.kycStatus === 'approved') setIsKycVerified(true) + usersApi.getByUsername(username).then((profileUser) => { + if (profileUser?.fullName) setFullName(profileUser.fullName) + if (profileUser?.kycStatus === 'approved') setIsKycVerified(true) // to check if the logged in user has sent money to the profile user, // we check the amount that the profile user has received from the logged in user. - if (user?.totalUsdReceivedFromCurrentUser) { - setTotalSentByLoggedInUser(user.totalUsdReceivedFromCurrentUser) + if (profileUser?.totalUsdReceivedFromCurrentUser) { + setTotalSentByLoggedInUser(profileUser.totalUsdReceivedFromCurrentUser) } })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/components/Profile/components/PublicProfile.tsx(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/Profile/components/PublicProfile.tsx (2)
src/context/authContext.tsx (1)
useAuth(182-188)src/components/Global/Icons/Icon.tsx (1)
Icon(189-198)
⏰ 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/Profile/components/PublicProfile.tsx (4)
36-42: Good fallback behavior for Send.Using
onSendClickwhen provided and falling back topaymentActions.setView('INITIAL')is a clean extension point.Also applies to: 98-109
106-109: Icons already registered
Botharrow-up-rightandarrow-down-leftare imported and mapped insrc/components/Global/Icons/Icon.tsx. No changes needed.
19-19: No action needed: PublicProfile is already under AuthProvider
PublicProfile is rendered in src/app/[...recipient]/client.tsx, which is nested in the root ContextProvider (wrapping AuthProvider) defined in src/app/layout.tsx.
63-83: Ignore derivingloggedInfromuseAuthin PublicProfile
PublicProfile is designed to be driven solely by theisLoggedInprop (nouseAuthimport exists), so adding an auth‐context dependency here would couple it unnecessarily. Rely on the existing prop-based gating.Likely an incorrect or invalid review comment.
Self Profile POV

Some other user profile POV