Skip to content

Fix: Withdraw back button navigation and incorrect verified text#1230

Merged
Zishan-7 merged 3 commits intopeanut-wallet-devfrom
fix/back-btn-verified-bug
Sep 18, 2025
Merged

Fix: Withdraw back button navigation and incorrect verified text#1230
Zishan-7 merged 3 commits intopeanut-wallet-devfrom
fix/back-btn-verified-bug

Conversation

@Zishan-7
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Sep 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Sep 18, 2025 9:35am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

Adds a new setter (setShowAllWithdrawMethods) to the withdraw flow context and uses it in WithdrawPage to show all methods on mount when amountFromContext exists. Updates ProfileHeader to compute isSelfProfile and gate the verified-user indicator to only self profiles.

Changes

Cohort / File(s) Summary
Withdraw method visibility control
src/app/(mobile-ui)/withdraw/page.tsx, src/context/WithdrawFlowContext
Exposes setShowAllWithdrawMethods in useWithdrawFlow; WithdrawPage calls it on mount when amountFromContext is present to show all withdraw methods; initial step logic unchanged.
Profile header self-profile gating
src/components/Profile/components/ProfileHeader.tsx
Adds isSelfProfile (case-insensitive username match) and updates VerifiedUserLabel prop to isAuthenticatedUserVerified && isSelfProfile; removes a stray console.log.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Fix/withdraw amt issue #1045 — Modifies withdraw flow context and its consumers; touches the same context API and mount behavior.
  • fix: more and more bugssssss #1030 — Adds showAllWithdrawMethods state/setter across WithdrawFlowContext and page views; overlaps on API and usage.
  • prod to staging #1092 — Changes withdraw-method visibility/selection logic (saved-account filtering) that intersects with method-visibility behavior.

Suggested reviewers

  • jjramirezn
  • kushagrasarathe

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning There is no author-provided pull request description, so the PR lacks contextual detail and fails this check because the description is empty and provides no information beyond the title and diffs. The lenient criterion expects at least some related description, which is not present here. As a result reviewers must open diffs to infer intent rather than relying on an explicit summary. Please add a short description summarizing the changes (the withdraw back-button/visibility fix and the profile verified-text fix), mention the public API change (added setShowAllWithdrawMethods) and any important testing or verification steps performed; this will give reviewers necessary context and speed up review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately captures the two primary fixes in the changeset: the withdraw/back-button behavior and the incorrect verified text on profiles, both of which are present in the modified files (withdraw page and ProfileHeader). It is concise, specific, and directly related to the main changes so a teammate scanning history would understand the primary intent. The "Fix:" prefix is acceptable and the title does not contain extraneous noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/back-btn-verified-bug

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02eb43f and 41b0eb8.

📒 Files selected for processing (1)
  • src/components/Profile/components/ProfileHeader.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Profile/components/ProfileHeader.tsx
⏰ 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

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (3)
src/components/Profile/components/ProfileHeader.tsx (2)

34-34: Make username comparison locale‑safe (Turkish-i edge case).

Use toLocaleLowerCase('en-US') on both sides to avoid locale pitfalls.

-const isSelfProfile = authenticatedUser?.user.username?.toLowerCase() === username.toLowerCase()
+const isSelfProfile =
+  authenticatedUser?.user.username?.toLocaleLowerCase('en-US') ===
+  username.toLocaleLowerCase('en-US')

38-38: Remove debug log.

Stray console.log in a UI component.

-    console.log('isVerified', isVerified)
+    // no-op
src/app/(mobile-ui)/withdraw/page.tsx (1)

83-86: Avoid redundant state writes when returning to input step.

Guard setStep('inputAmount') to prevent no‑op updates.

-        } else {
-            setStep('inputAmount')
+        } else {
+            if (step !== 'inputAmount') setStep('inputAmount')
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5abe36d and 02eb43f.

📒 Files selected for processing (2)
  • src/app/(mobile-ui)/withdraw/page.tsx (3 hunks)
  • src/components/Profile/components/ProfileHeader.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".

Applied to files:

  • src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.

Applied to files:

  • src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2024-10-29T12:19:41.968Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#495
File: src/components/Global/TokenAmountInput/index.tsx:23-30
Timestamp: 2024-10-29T12:19:41.968Z
Learning: In the `TokenAmountInput` component (`src/components/Global/TokenAmountInput/index.tsx`), when the 'Max' button is clicked, we intentionally set the input denomination to 'TOKEN' because we are setting the value as token.

Applied to files:

  • src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2024-10-03T09:57:43.885Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#404
File: src/context/tokenSelector.context.tsx:121-121
Timestamp: 2024-10-03T09:57:43.885Z
Learning: In `TokenContextProvider` within `tokenSelector.context.tsx`, when token data is loaded from preferences, it's acceptable to set `isTokenPriceFetchingComplete` to `true` because the token data is already available.

Applied to files:

  • src/app/(mobile-ui)/withdraw/page.tsx
⏰ 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/Profile/components/ProfileHeader.tsx (1)

53-53: Gating the verified badge to self profiles only — LGTM.

This fixes the incorrect verified text on other users’ profiles.

Please confirm VerifiedUserLabel still shows profile‑level verification via isVerified independently of isAuthenticatedUserVerified.

src/app/(mobile-ui)/withdraw/page.tsx (1)

30-31: No action required — setShowAllWithdrawMethods is already exposed
WithdrawFlowContextType and the provider value include setShowAllWithdrawMethods in src/context/WithdrawFlowContext.tsx.

Likely an incorrect or invalid review comment.

@Zishan-7 Zishan-7 merged commit 77f11b6 into peanut-wallet-dev Sep 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants