Skip to content

[TASK-16686] Feat/pix modal changes#1421

Merged
kushagrasarathe merged 2 commits intopeanut-walletfrom
feat/pix-modal-changes
Nov 7, 2025
Merged

[TASK-16686] Feat/pix modal changes#1421
kushagrasarathe merged 2 commits intopeanut-walletfrom
feat/pix-modal-changes

Conversation

@Zishan-7
Copy link
Contributor

@Zishan-7 Zishan-7 commented Nov 7, 2025

@notion-workspace
Copy link

@vercel
Copy link

vercel bot commented Nov 7, 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 Nov 7, 2025 3:55pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Walkthrough

The PR removes the Add Money Prompt modal from the home page, introduces a QR code context for managing scanner state across components, adds icon sizing flexibility to carousel CTAs, and replaces the PIX promo CTA with a new QR payment CTA triggered via context.

Changes

Cohort / File(s) Change Summary
Add Money Prompt Removal
src/app/(mobile-ui)/home/page.tsx
Removed showAddMoneyPromptModal state, associated useEffect, and disabled modal rendering with TODO comment; simplified balance-warning effect.
QR Code Context
src/context/QrCodeContext.tsx, src/context/contextProvider.tsx
Created new QrCodeContext with provider and useQrCodeContext hook for managing isQRScannerOpen state; integrated QrCodeProvider into context provider tree.
QR Scanner Integration
src/components/Global/DirectSendQR/index.tsx, src/components/Global/Icons/qr-code.tsx
Migrated DirectSendQR to use QrCodeContext instead of local state; added prop spreading to QrCodeIcon SVG element for arbitrary prop forwarding.
Carousel CTA Props
src/components/Home/HomeCarouselCTA/CarouselCTA.tsx, src/components/Home/HomeCarouselCTA/index.tsx
Added optional iconSize prop to CarouselCTAProps interface with default value 22; passed iconSize={16} when rendering CTA instances.
Home CTA Logic
src/hooks/useHomeCarouselCTAs.tsx
Replaced static PIX promo CTA with new QR payment CTA triggered by Bridge/Manteca KYC approval; added context dependency for setIsQRScannerOpen invocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • QrCodeContext provider integration: Verify context initialization, hook safety checks, and proper wrapping in provider tree
  • DirectSendQR state migration: Ensure seamless transition from local to context state; check scanner lifecycle edge cases
  • PIX-to-QR CTA replacement logic: Validate KYC condition logic and onClick handler integration with context state updates
  • Potential conflicts: Review interactions between removed Add Money Prompt logic and existing home page state management

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • kushagrasarathe
  • jjramirezn

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 2 inconclusive)
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.
Title check ❓ Inconclusive The title mentions 'pix modal changes' but the changeset primarily focuses on adding QR code scanner functionality with context management, removing Add Money Prompt modal, and making icon size configurable. Clarify the title to better reflect the main changes: consider 'Add QR code scanner context and update icon sizing' or similar to capture the core feature additions.
Description check ❓ Inconclusive The description only contains an embedded image and a Discord link without textual explanation of what changes were made or why. Add a detailed description explaining the changes, objectives, and rationale for the modifications introduced in this pull request.
✨ 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 feat/pix-modal-changes

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.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Nov 7, 2025
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: 0

Caution

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

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

103-112: Add missing dependencies to useCallback.

The generateCarouselCTAs callback is missing setIsQRScannerOpen and isUserMantecaKycApproved from its dependency array. While context setters are typically stable, omitting isUserMantecaKycApproved can cause stale closure bugs since it's used in the condition at line 41.

Apply this diff to add the missing dependencies:

     }, [
         showReminderBanner,
         isPermissionDenied,
         isUserKycApproved,
+        isUserMantecaKycApproved,
         isUserBridgeKycUnderReview,
         router,
         requestPermission,
         afterPermissionAttempt,
         snoozeReminderBanner,
+        setIsQRScannerOpen,
     ])
🧹 Nitpick comments (2)
src/app/(mobile-ui)/home/page.tsx (1)

22-22: Remove unused import.

The AddMoneyPromptModal import is no longer used since the modal has been disabled (lines 222-223).

Apply this diff to remove the unused import:

-import AddMoneyPromptModal from '@/components/Home/AddMoneyPromptModal'
src/hooks/useHomeCarouselCTAs.tsx (1)

41-41: Simplify redundant KYC condition.

The condition isUserKycApproved || isUserMantecaKycApproved is redundant because isUserKycApproved already includes isUserMantecaKycApproved per the implementation in useKycStatus.tsx (line 13-16).

Apply this diff to simplify the condition:

-        if (isUserKycApproved || isUserMantecaKycApproved) {
+        if (isUserKycApproved) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c94c7c and 2258296.

📒 Files selected for processing (8)
  • src/app/(mobile-ui)/home/page.tsx (2 hunks)
  • src/components/Global/DirectSendQR/index.tsx (2 hunks)
  • src/components/Global/Icons/qr-code.tsx (1 hunks)
  • src/components/Home/HomeCarouselCTA/CarouselCTA.tsx (3 hunks)
  • src/components/Home/HomeCarouselCTA/index.tsx (1 hunks)
  • src/context/QrCodeContext.tsx (1 hunks)
  • src/context/contextProvider.tsx (2 hunks)
  • src/hooks/useHomeCarouselCTAs.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/app/(mobile-ui)/qr-pay/page.tsx:156-176
Timestamp: 2025-09-08T03:13:09.111Z
Learning: In the peanut-ui mobile app, the `/qr-pay` route is only accessed through the DirectSendQR component which always includes the qrCode parameter in the URL when redirecting users to the QR pay page after scanning MERCADO_PAGO or PIX QR codes.
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/app/(mobile-ui)/qr-pay/page.tsx:156-176
Timestamp: 2025-09-08T03:13:09.111Z
Learning: In the peanut-ui mobile app, the `/qr-pay` route is only accessed through the DirectSendQR component which always includes the qrCode parameter in the URL when redirecting users to the QR pay page.
📚 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/app/(mobile-ui)/home/page.tsx
  • src/components/Global/DirectSendQR/index.tsx
📚 Learning: 2025-11-04T17:47:06.328Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1396
File: src/app/(mobile-ui)/home/page.tsx:295-304
Timestamp: 2025-11-04T17:47:06.328Z
Learning: In src/app/(mobile-ui)/home/page.tsx, when closing the KycCompletedModal, updateUserById is called without awaiting to provide instant feedback to the user. This fire-and-forget pattern for modal dismissals and UI preference updates is intentional and consistent across the codebase—user experience with instant UI feedback takes priority over waiting for backend sync operations.

Applied to files:

  • src/app/(mobile-ui)/home/page.tsx
📚 Learning: 2024-10-25T11:33:46.776Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 484
File: src/components/Cashout/Components/Initial.view.tsx:273-274
Timestamp: 2024-10-25T11:33:46.776Z
Learning: In the `InitialCashoutView` component (`src/components/Cashout/Components/Initial.view.tsx`), linked bank accounts should not generate error states, and the `ValidatedInput` component will clear any error messages if needed. Therefore, it's unnecessary to manually clear the error state when selecting or clearing linked bank accounts.

Applied to files:

  • src/app/(mobile-ui)/home/page.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/app/(mobile-ui)/home/page.tsx
📚 Learning: 2024-12-11T10:13:22.806Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 564
File: src/components/Request/Pay/Views/Initial.view.tsx:430-430
Timestamp: 2024-12-11T10:13:22.806Z
Learning: In the React TypeScript file `src/components/Request/Pay/Views/Initial.view.tsx`, when reviewing the `InitialView` component, do not flag potential issues with using non-null assertion `!` on the `slippagePercentage` variable, as handling undefined values in this context is considered out of scope.

Applied to files:

  • src/app/(mobile-ui)/home/page.tsx
📚 Learning: 2025-11-07T11:51:58.861Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1419
File: src/components/Global/BalanceWarningModal/index.tsx:94-94
Timestamp: 2025-11-07T11:51:58.861Z
Learning: In `src/components/Global/BalanceWarningModal/index.tsx`, the casual and congratulatory phrase "You're rich! Congrats on having a high balance." is intentional and by design.

Applied to files:

  • src/app/(mobile-ui)/home/page.tsx
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 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)/home/page.tsx
  • src/context/contextProvider.tsx
📚 Learning: 2024-10-29T12:20:47.207Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 495
File: src/components/Create/Link/Input.view.tsx:244-248
Timestamp: 2024-10-29T12:20:47.207Z
Learning: In the `TokenAmountInput` component within `src/components/Global/TokenAmountInput/index.tsx`, when `balance` is undefined, the `maxValue` prop should be set to an empty string `''`.

Applied to files:

  • src/app/(mobile-ui)/home/page.tsx
📚 Learning: 2025-07-07T20:22:11.092Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 958
File: src/app/actions/tokens.ts:266-266
Timestamp: 2025-07-07T20:22:11.092Z
Learning: In `src/app/actions/tokens.ts`, within the `fetchWalletBalances` function, using the non-null assertion operator `!` on `process.env.MOBULA_API_KEY!` is intentional and correct, and should not be flagged for replacement with explicit validation.

Applied to files:

  • src/app/(mobile-ui)/home/page.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/app/(mobile-ui)/home/page.tsx
📚 Learning: 2025-10-15T06:45:22.055Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1241
File: src/components/ForceIOSPWAInstall/index.tsx:6-51
Timestamp: 2025-10-15T06:45:22.055Z
Learning: In the ForceIOSPWAInstall component (src/components/ForceIOSPWAInstall/index.tsx), the blocking behavior without a skip/dismiss option is intentional by design to force PWA installation on iOS devices.

Applied to files:

  • src/app/(mobile-ui)/home/page.tsx
📚 Learning: 2025-09-08T03:13:09.111Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/app/(mobile-ui)/qr-pay/page.tsx:156-176
Timestamp: 2025-09-08T03:13:09.111Z
Learning: In the peanut-ui mobile app, the `/qr-pay` route is only accessed through the DirectSendQR component which always includes the qrCode parameter in the URL when redirecting users to the QR pay page.

Applied to files:

  • src/components/Global/DirectSendQR/index.tsx
📚 Learning: 2025-09-08T03:13:09.111Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/app/(mobile-ui)/qr-pay/page.tsx:156-176
Timestamp: 2025-09-08T03:13:09.111Z
Learning: In the peanut-ui mobile app, the `/qr-pay` route is only accessed through the DirectSendQR component which always includes the qrCode parameter in the URL when redirecting users to the QR pay page after scanning MERCADO_PAGO or PIX QR codes.

Applied to files:

  • src/components/Global/DirectSendQR/index.tsx
🧬 Code graph analysis (4)
src/components/Global/DirectSendQR/index.tsx (1)
src/context/QrCodeContext.tsx (1)
  • useQrCodeContext (17-23)
src/context/contextProvider.tsx (2)
src/context/SupportModalContext.tsx (1)
  • SupportModalProvider (15-37)
src/context/QrCodeContext.tsx (1)
  • QrCodeProvider (12-15)
src/components/Home/HomeCarouselCTA/CarouselCTA.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
  • Icon (209-218)
src/hooks/useHomeCarouselCTAs.tsx (2)
src/hooks/useKycStatus.tsx (1)
  • useKycStatus (12-36)
src/context/QrCodeContext.tsx (1)
  • useQrCodeContext (17-23)
⏰ 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 (11)
src/components/Home/HomeCarouselCTA/index.tsx (1)

35-35: LGTM! Consistent icon sizing for carousel CTAs.

The hardcoded iconSize={16} ensures uniform icon sizing across all carousel CTAs, which aligns with the QR CTA implementation in useHomeCarouselCTAs.tsx (line 59).

src/components/Global/Icons/qr-code.tsx (1)

3-9: LGTM! Prop forwarding enhances component flexibility.

Spreading props onto the SVG element allows consumers to pass additional attributes (aria-labels, event handlers, etc.) while maintaining existing functionality.

src/app/(mobile-ui)/home/page.tsx (2)

162-162: LGTM! Dependency array correctly updated.

The removal of showAddMoneyPromptModal from the dependency array is correct since the related state has been removed.


222-223: LGTM! Modal properly disabled with clear TODO.

The Add Money Prompt modal has been correctly commented out with a clear TODO marker for future re-enablement.

src/components/Home/HomeCarouselCTA/CarouselCTA.tsx (3)

23-24: LGTM! Clean API extension.

The optional iconSize prop is well-typed and maintains backward compatibility.


36-36: LGTM! Sensible default value.

The default value of 22 maintains existing icon sizing behavior for consumers that don't specify iconSize.


100-100: LGTM! Correct usage of iconSize prop.

The Icon component correctly uses the iconSize prop when no logo is provided, maintaining the existing conditional logic.

src/context/contextProvider.tsx (1)

12-12: LGTM! Proper context composition.

The QrCodeProvider is correctly integrated into the existing provider tree, following the established nesting pattern.

Also applies to: 26-28

src/hooks/useHomeCarouselCTAs.tsx (1)

40-61: LGTM! Clean QR CTA integration with context.

The new QR payment CTA is well-structured and properly integrates with the QrCodeContext to open the scanner when clicked. The use of iconSize: 16 ensures consistent sizing with other carousel CTAs.

src/components/Global/DirectSendQR/index.tsx (1)

21-21: LGTM! Clean migration to context-based state.

The component correctly migrates from local isQRScannerOpen state to the shared QrCodeContext. The startScanner function and all scanner close operations properly use the context setter, enabling coordinated QR scanner control across components.

Also applies to: 199-203

src/context/QrCodeContext.tsx (1)

1-23: LGTM! Well-implemented context pattern.

The QrCodeContext follows React best practices with:

  • Strong typing via QrCodeContextType interface
  • Proper error handling in useQrCodeContext to enforce usage within provider
  • Clean state management with boolean flag and setter
  • Standard context creation pattern

This provides a solid foundation for coordinating QR scanner state across multiple components.

isQRScannerOpen: boolean
setIsQRScannerOpen: (isOpen: boolean) => void
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: lets adopt the habbit to add comments for hooks and components, jsdoc styles, easier to get context

@kushagrasarathe kushagrasarathe merged commit 793c0b6 into peanut-wallet Nov 7, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 8, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 11, 2025
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