Skip to content

[TASK-15942] Fix/txn drawer changes#1383

Merged
Zishan-7 merged 6 commits intopeanut-wallet-devfrom
fix/txn-drawer-changes
Oct 31, 2025
Merged

[TASK-15942] Fix/txn drawer changes#1383
Zishan-7 merged 6 commits intopeanut-wallet-devfrom
fix/txn-drawer-changes

Conversation

@Zishan-7
Copy link
Copy Markdown
Contributor

Also contributes to TASK-16437 TASK-16130 TASK-16055

image image

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 31, 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 Oct 31, 2025 6:36am

@notion-workspace
Copy link
Copy Markdown

@notion-workspace
Copy link
Copy Markdown

@notion-workspace
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Changes update add-money defaults (Apple/Google Pay disabled), adjust minor UI text and spacing, add a convertedAmount prop/derivation in transaction details with simplified exchange-rate rendering, and tighten KYC banner gating to account for bridge KYC under-review status.

Changes

Cohort / File(s) Summary
Payment Methods Configuration
src/components/AddMoney/consts/index.ts
Removed Apple Pay and Google Pay from UPDATED_DEFAULT_ADD_MONEY_METHODS; entries commented out with a dev note for re-enablement.
UI Text & Styling Updates
src/components/Badges/BadgeStatusDrawer.tsx, src/components/Kyc/KycVerificationInProgressModal.tsx
Added py-5 padding to DrawerContent. Updated KYC modal copy from "Peanut doesn't store any personal information" to "Peanut doesn't store any of your documents".
Transaction Details Components
src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx, src/components/TransactionDetails/TransactionDetailsReceipt.tsx
Added optional convertedAmount?: string prop to header. Receipt now memoizes convertedAmount when exchange_rate exists and passes it to the header; exchange-rate rendering simplified to a single "1 USD = <exchange_rate>" row.
KYC Banner Logic
src/hooks/useBanners.tsx
Consumes isUserBridgeKycUnderReview and updates banner gating to require both “not approved” AND “not under bridge KYC review” to show the banner.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review TransactionDetailsReceipt.tsx for correct convertedAmount memoization, formatting, and prop plumbing to the header.
  • Confirm TransactionDetailsHeaderCard.tsx renders the optional convertedAmount safely (no undefined crashes / accessibility).
  • Verify useBanners.tsx uses isUserBridgeKycUnderReview correctly and that the gating logic matches intended UX.

Possibly related PRs

Suggested reviewers

  • kushagrasarathe
  • jjramirezn

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[TASK-15942] Fix/txn drawer changes" refers to a real aspect of the changeset—specifically the transaction details components (TransactionDetailsHeaderCard, TransactionDetailsReceipt) that have been modified to add converted amount display functionality. However, the changes span multiple files across different functional areas, including payment method updates, UI padding adjustments, KYC messaging changes, and banner logic updates. The title is partially related as it captures one significant portion of the work but does not comprehensively describe all the changes in the pull request. The term "Fix" is somewhat vague about what specific issue is being addressed.
Description Check ✅ Passed The pull request description is minimal but directly related to the changeset. It references related tasks (TASK-16437, TASK-16130, TASK-16055) that the PR contributes to and includes visual preview images that demonstrate the actual changes being made. This provides context and visual evidence of the modifications, which is appropriate and relevant to understanding the scope of the work.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/txn-drawer-changes

📜 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 c66df15 and 5e0615e.

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

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

Copy link
Copy Markdown
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/useBanners.tsx (1)

53-64: Add isUserBridgeKycUnderReview to useEffect dependency array.

The generateBanners() function now depends on isUserBridgeKycUnderReview, but this value isn't included in the useEffect dependency array at line 76. This could lead to stale banner state if the KYC review status changes.

Apply this diff to fix the dependency array:

     useEffect(() => {
         if (!user) {
             setBanners([])
             return
         }
 
         generateBanners()
-    }, [user, showReminderBanner, isPermissionDenied])
+    }, [user, showReminderBanner, isPermissionDenied, isUserKycApproved, isUserBridgeKycUnderReview])
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6a9fc4 and c66df15.

📒 Files selected for processing (6)
  • src/components/AddMoney/consts/index.ts (1 hunks)
  • src/components/Badges/BadgeStatusDrawer.tsx (1 hunks)
  • src/components/Kyc/KycVerificationInProgressModal.tsx (1 hunks)
  • src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx (3 hunks)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2 hunks)
  • src/hooks/useBanners.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (17)
📚 Learning: 2025-08-14T08:02:26.705Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1094
File: src/components/AddWithdraw/DynamicBankAccountForm.tsx:279-279
Timestamp: 2025-08-14T08:02:26.705Z
Learning: For hotfixes in the peanut-ui codebase, prefer generic error messages over specific validation error details until the copy can be reviewed with the team, even when the validation functions return detailed error messages.

Applied to files:

  • src/components/Kyc/KycVerificationInProgressModal.tsx
📚 Learning: 2025-08-07T12:53:50.946Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1072
File: src/app/(setup)/setup/page.tsx:173-175
Timestamp: 2025-08-07T12:53:50.946Z
Learning: In the peanut-ui setup flow at `src/app/(setup)/setup/page.tsx`, when handling unsupported scenarios, both device not supported and browser not supported cases should show the same "Unsupported browser" message using the `UnsupportedBrowserModal` component, rather than having distinct messaging for each scenario.

Applied to files:

  • src/components/Kyc/KycVerificationInProgressModal.tsx
📚 Learning: 2025-07-24T13:26:10.290Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 1014
File: src/components/Claim/Link/Initial.view.tsx:413-413
Timestamp: 2025-07-24T13:26:10.290Z
Learning: In the peanut-ui repository, the change from `${SQUID_API_URL}/route` to `${SQUID_API_URL}/v2/route` in src/components/Claim/Link/Initial.view.tsx was a typo fix, not an API migration, as the codebase was already using Squid API v2.

Applied to files:

  • src/components/Kyc/KycVerificationInProgressModal.tsx
📚 Learning: 2024-12-02T17:19:18.532Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 551
File: src/components/Request/Create/Views/Initial.view.tsx:151-156
Timestamp: 2024-12-02T17:19:18.532Z
Learning: In the `InitialView` component at `src/components/Request/Create/Views/Initial.view.tsx`, when setting the default chain and token in the `useEffect` triggered by `isPeanutWallet`, it's acceptable to omit the setters from the dependency array and not include additional error handling for invalid defaults.

Applied to files:

  • src/components/Kyc/KycVerificationInProgressModal.tsx
📚 Learning: 2025-08-11T10:35:02.715Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1078
File: src/hooks/useKycFlow.ts:129-141
Timestamp: 2025-08-11T10:35:02.715Z
Learning: In the KYC flow implementation in `src/hooks/useKycFlow.ts`, when Terms of Service (ToS) is accepted, there will always be a KYC link available in the `apiResponse`. The system ensures this invariant, so defensive checks for missing KYC links after ToS acceptance are unnecessary.

Applied to files:

  • src/hooks/useBanners.tsx
📚 Learning: 2025-08-20T09:08:19.266Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1112
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:336-343
Timestamp: 2025-08-20T09:08:19.266Z
Learning: In the KYC flow implementation, `setJustCompletedKyc` must be called after `await fetchUser()` in the `handleKycSuccess` callback. Setting `justCompletedKyc` before fetching the user would cause a re-fetching loop because `handleKycSuccess` is set in a useEffect inside the KYC hook, which would cause the UI flow to get stuck in one view.

Applied to files:

  • src/hooks/useBanners.tsx
📚 Learning: 2024-10-07T15:25:45.170Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Views/Initial.view.tsx:76-78
Timestamp: 2024-10-07T15:25:45.170Z
Learning: In `src/components/Request/Pay/Views/Initial.view.tsx`, both `txFee` and `utils.formatTokenAmount(...)` return strings, ensuring that `calculatedFee` consistently returns a string without the need for additional type conversion.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/AddMoney/consts/index.ts
  • src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx
📚 Learning: 2024-10-07T15:28:25.280Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Views/Initial.view.tsx:76-78
Timestamp: 2024-10-07T15:28:25.280Z
Learning: In `src/components/Request/Pay/Views/Initial.view.tsx`, both `txFee` and `utils.formatTokenAmount(estimatedGasCost, 3)` return strings, ensuring consistent return types for `calculatedFee`.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/AddMoney/consts/index.ts
  • src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx
📚 Learning: 2025-10-29T11:27:59.248Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1368
File: src/components/Common/ActionList.tsx:109-111
Timestamp: 2025-10-29T11:27:59.248Z
Learning: In `src/components/Common/ActionList.tsx`, the `balance` from `useWallet()` hook is always in USDC (as a formatted string), making it directly comparable to USD amounts without conversion. The comparison `Number(balance) >= amountInUsd` is intentional and correct.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx
📚 Learning: 2025-08-22T07:25:59.304Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1104
File: src/components/Payment/PaymentForm/index.tsx:596-600
Timestamp: 2025-08-22T07:25:59.304Z
Learning: The `TokenAmountInput` component in `src/components/Global/TokenAmountInput/` always returns decimal strings (e.g., "1,234.56"), not base units. When passing these values to external APIs like Daimo's `toUnits` prop, simply stripping commas with `.replace(/,/g, '')` is sufficient.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2025-09-18T09:30:42.901Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1230
File: src/app/(mobile-ui)/withdraw/page.tsx:92-97
Timestamp: 2025-09-18T09:30:42.901Z
Learning: In src/app/(mobile-ui)/withdraw/page.tsx, the useEffect that calls setShowAllWithdrawMethods(true) when amountFromContext exists is intentionally designed to run only on component mount (empty dependency array), not when amountFromContext changes. This is the correct behavior for the withdraw flow where showing all methods should only happen on initial load when an amount is already present.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/AddMoney/consts/index.ts
📚 Learning: 2024-12-02T17:21:45.515Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 551
File: src/context/walletContext/walletContext.tsx:87-88
Timestamp: 2024-12-02T17:21:45.515Z
Learning: When converting `totalBalance` (in USD) to a `BigInt` balance in `src/context/walletContext/walletContext.tsx`, multiplying by `1e6` is intentional to maintain compatibility with USDC's 6 decimal places. The application displays only 2 decimal places, so this level of precision is sufficient.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2024-10-07T15:50:29.173Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Pay.consts.ts:34-34
Timestamp: 2024-10-07T15:50:29.173Z
Learning: In `src/components/Request/Pay` components, the `tokenPrice` property in the `IPayScreenProps` interface is only relevant to these views. Other components using `IPayScreenProps` do not need to handle `tokenPriceData` when it's updated in these components.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/AddMoney/consts/index.ts
📚 Learning: 2024-11-18T21:36:11.486Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 535
File: src/components/Claim/Claim.tsx:142-146
Timestamp: 2024-11-18T21:36:11.486Z
Learning: In `src/components/Claim/Claim.tsx`, external calls like token price fetching and cross-chain details retrieval are already encapsulated within existing `try...catch` blocks, so additional error handling may be unnecessary.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2025-10-24T13:44:39.473Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1332
File: src/components/Global/TokenAmountInput/index.tsx:141-150
Timestamp: 2025-10-24T13:44:39.473Z
Learning: In the `TokenAmountInput` component (`src/components/Global/TokenAmountInput/index.tsx`), the slider feature (controlled by `showSlider` prop) is only shown for USD input mode. When the slider is used with `maxAmount`, the `selectedAmount` is computed in USD and `isInputUsd` is always `true`, so the conversion in `onChange` handles it correctly.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/components/AddMoney/consts/index.ts
📚 Learning: 2024-10-22T18:10:56.955Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 469
File: src/app/request/pay/page.tsx:25-25
Timestamp: 2024-10-22T18:10:56.955Z
Learning: In the `src/app/request/pay/page.tsx` file, the `PreviewType` enum values are strings, so when adding `previewType` to `URLSearchParams`, there's no need to convert them to strings.

Applied to files:

  • src/components/AddMoney/consts/index.ts
🧬 Code graph analysis (2)
src/hooks/useBanners.tsx (1)
src/hooks/useKycStatus.tsx (1)
  • useKycStatus (12-36)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)
src/utils/general.utils.ts (1)
  • formatCurrency (270-272)
🪛 Biome (2.1.2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx

[error] 530-530: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.

Hooks should not be called after an early return.

For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level

(lint/correctness/useHookAtTopLevel)

⏰ 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 (8)
src/components/Badges/BadgeStatusDrawer.tsx (1)

28-28: LGTM!

The additional vertical padding improves the drawer spacing.

src/hooks/useBanners.tsx (1)

30-30: Good addition to banner gating logic.

The isUserBridgeKycUnderReview check appropriately prevents showing the KYC banner to users already in the review process.

src/components/AddMoney/consts/index.ts (1)

202-216: Intentional removal with clear TODO.

The Apple Pay and Google Pay payment methods are properly commented out with a clear TODO for re-enablement.

src/components/Kyc/KycVerificationInProgressModal.tsx (1)

56-56: LGTM!

The updated text is more specific and accurate for the KYC verification context.

src/components/TransactionDetails/TransactionDetailsHeaderCard.tsx (2)

48-49: LGTM!

The optional convertedAmount prop is well-integrated with appropriate conditional rendering.


257-258: Clean conditional rendering.

The approximate symbol (≈) appropriately indicates the converted amount is an approximation.

src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

779-784: Cleaner exchange rate display.

The simplified single-row format "1 USD = {CURRENCY} {rate}" is clearer and more standard than the previous implementation.


563-563: Correct prop passing.

The nullish coalescing operator appropriately converts null to undefined to match the optional prop signature.

Copy link
Copy Markdown
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Zishan-7 Zishan-7 merged commit 2655492 into peanut-wallet-dev Oct 31, 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