Conversation
All these routes are not used and are surface for attack
[TASK-15930] chore: remove unused routes
Update High balance modal copy
[TASK-16676] fix: Request pots redirect
[TASK-16686] Feat/pix modal changes
WalkthroughThis PR removes the Add Money Prompt modal logic, deletes multiple Peanut API routes and related claim-link submission functions, introduces a new QrCodeContext for QR scanner state management, removes user search and public transaction history features, and updates various UI components with modified props and simplified logic. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
generateCarouselCTAscallback usessetIsQRScannerOpenandisUserMantecaKycApprovedbut they are not included in the dependency array. This could lead to stale closure issues.Apply this diff:
}, [ showReminderBanner, isPermissionDenied, isUserKycApproved, isUserBridgeKycUnderReview, + isUserMantecaKycApproved, + setIsQRScannerOpen, router, requestPermission, afterPermissionAttempt, snoozeReminderBanner, ])
🧹 Nitpick comments (3)
src/app/(mobile-ui)/home/page.tsx (1)
22-22: Optional: Remove unused import.
AddMoneyPromptModalis imported but no longer used after the modal was disabled. Consider removing this import to keep the codebase clean.-import AddMoneyPromptModal from '@/components/Home/AddMoneyPromptModal'src/hooks/useHomeCarouselCTAs.tsx (1)
40-61: Simplify the KYC approval check.The condition
isUserKycApproved || isUserMantecaKycApprovedis redundant becauseisUserKycApprovedis computed asisUserBridgeKycApproved || isUserMantecaKycApprovedin theuseKycStatushook. You can simplify this to justisUserKycApproved.Apply this diff:
- if (isUserKycApproved || isUserMantecaKycApproved) { + if (isUserKycApproved) {src/app/api/peanut/get-attachment-info/route.ts (1)
11-50: Consider removing commented-out code in favor of version control.This ~40-line block of commented code can be recovered from git history when needed. If the re-enablement mentioned in the TODO is planned for the near term (within weeks), keeping it temporarily may be acceptable. However, for longer-term changes, removing it would improve code cleanliness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
src/app/(mobile-ui)/home/page.tsx(2 hunks)src/app/(mobile-ui)/qr-pay/page.tsx(2 hunks)src/app/api/peanut/get-attachment-info/route.ts(2 hunks)src/app/api/peanut/submit-claim-link/confirm/route.ts(0 hunks)src/app/api/peanut/submit-claim-link/init/route.ts(0 hunks)src/app/api/peanut/submit-direct-transfer/route.ts(0 hunks)src/components/Create/useCreateLink.tsx(1 hunks)src/components/Global/BalanceWarningModal/index.tsx(1 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/components/Home/HomeHistory.tsx(5 hunks)src/components/Payment/PaymentForm/index.tsx(1 hunks)src/components/Profile/components/PublicProfile.tsx(1 hunks)src/components/Slider/index.tsx(2 hunks)src/context/QrCodeContext.tsx(1 hunks)src/context/contextProvider.tsx(2 hunks)src/hooks/useHomeCarouselCTAs.tsx(3 hunks)src/hooks/useLogin.tsx(1 hunks)src/hooks/useTransactionHistory.ts(2 hunks)src/hooks/useUserSearch.ts(0 hunks)src/services/users.ts(0 hunks)
💤 Files with no reviewable changes (5)
- src/hooks/useUserSearch.ts
- src/app/api/peanut/submit-claim-link/init/route.ts
- src/services/users.ts
- src/app/api/peanut/submit-claim-link/confirm/route.ts
- src/app/api/peanut/submit-direct-transfer/route.ts
🧰 Additional context used
🧠 Learnings (40)
📓 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.
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: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1185
File: src/components/Claim/useClaimLink.tsx:14-0
Timestamp: 2025-09-05T07:31:11.396Z
Learning: In the peanut-ui codebase, `window.history.replaceState` is preferred over `router.replace` when immediate/synchronous URL parameter updates are required, as `router.replace` is asynchronous and doesn't guarantee instant URL changes that subsequent code can rely on. This pattern is used consistently across usePaymentInitiator.ts, Confirm.payment.view.tsx, and useClaimLink.tsx.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
📚 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/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsx
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Pay.consts.ts:34-34
Timestamp: 2024-10-08T20:13:42.967Z
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/Payment/PaymentForm/index.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/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsx
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 413
File: src/components/Request/Pay/Views/Initial.view.tsx:71-72
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In `src/components/Request/Pay/Views/Initial.view.tsx`, it's acceptable to use the `!` operator in TypeScript to assert that `selectedTokenData` is not `null` or `undefined`, and potential runtime errors from accessing its properties without checks can be disregarded.
Applied to files:
src/components/Payment/PaymentForm/index.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/components/Payment/PaymentForm/index.tsx
📚 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/Payment/PaymentForm/index.tsx
📚 Learning: 2025-08-22T07:28:32.281Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1104
File: src/components/Payment/PaymentForm/index.tsx:522-545
Timestamp: 2025-08-22T07:28:32.281Z
Learning: In `src/components/Payment/PaymentForm/index.tsx`, the `handleCompleteDaimoPayment` function is only for updating payment status in the backend after a successful Daimo payment. Payment success/failure is handled by Daimo itself, so try/catch error handling and error display are not needed for backend sync failures - users shouldn't see errors if payment succeeded but database update failed.
Applied to files:
src/components/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/qr-pay/page.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/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/home/page.tsxsrc/components/Global/DirectSendQR/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsxsrc/components/Home/HomeHistory.tsx
📚 Learning: 2025-06-18T19:56:55.443Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 919
File: src/components/Withdraw/views/Initial.withdraw.view.tsx:87-87
Timestamp: 2025-06-18T19:56:55.443Z
Learning: In withdraw flows for Peanut Wallet, the PeanutActionDetailsCard should always display "USDC" as the token symbol because it shows the amount being withdrawn from the Peanut Wallet (which holds USDC), regardless of the destination token/chain selected by the user. The TokenSelector is used for choosing the withdrawal destination, not the source display.
Applied to files:
src/components/Payment/PaymentForm/index.tsx
📚 Learning: 2024-10-07T13:42:07.299Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Pay.tsx:113-123
Timestamp: 2024-10-07T13:42:07.299Z
Learning: In the `PayRequestLink` component (`src/components/Request/Pay/Pay.tsx`), when resolving ENS names, handle errors by displaying an appropriate error message to the user if the ENS cannot be resolved.
Applied to files:
src/components/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsx
📚 Learning: 2024-10-23T09:38:27.670Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 469
File: src/app/request/pay/page.tsx:32-64
Timestamp: 2024-10-23T09:38:27.670Z
Learning: In `src/app/request/pay/page.tsx`, if `linkRes` is not OK in the `generateMetadata` function, the desired behavior is to use the standard title and preview image without throwing an error.
Applied to files:
src/components/Payment/PaymentForm/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsxsrc/components/Create/useCreateLink.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.tsxsrc/components/Home/HomeHistory.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.tsxsrc/components/Create/useCreateLink.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.tsxsrc/components/Global/BalanceWarningModal/index.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.tsxsrc/components/Global/BalanceWarningModal/index.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.tsxsrc/context/contextProvider.tsx
📚 Learning: 2025-08-26T15:25:53.328Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1132
File: src/app/[...recipient]/client.tsx:394-397
Timestamp: 2025-08-26T15:25:53.328Z
Learning: In `src/components/Common/ActionListDaimoPayButton.tsx`, the `handleCompleteDaimoPayment` function should not display error messages to users when DB update fails because the Daimo payment itself has succeeded - showing errors would be confusing since the payment was successful.
Applied to files:
src/app/(mobile-ui)/home/page.tsxsrc/app/(mobile-ui)/qr-pay/page.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.tsxsrc/components/Global/BalanceWarningModal/index.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.tsxsrc/components/Create/useCreateLink.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: 2024-10-08T20:13:42.967Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 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/context/contextProvider.tsxsrc/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.
Applied to files:
src/components/Global/DirectSendQR/index.tsxsrc/app/(mobile-ui)/qr-pay/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 after scanning MERCADO_PAGO or PIX QR codes.
Applied to files:
src/components/Global/DirectSendQR/index.tsxsrc/app/(mobile-ui)/qr-pay/page.tsx
📚 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/app/(mobile-ui)/qr-pay/page.tsxsrc/components/Create/useCreateLink.tsx
📚 Learning: 2024-10-07T13:42:00.443Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 422
File: src/components/Request/Pay/Pay.tsx:103-111
Timestamp: 2024-10-07T13:42:00.443Z
Learning: When the token price cannot be fetched in `src/components/Request/Pay/Pay.tsx` within the `PayRequestLink` component, set `tokenPriceData.price` to 0 to ensure the UI remains functional. Since Squid uses their own price engine for x-chain fulfillment transactions, this approach will not affect the transaction computation.
Applied to files:
src/app/(mobile-ui)/qr-pay/page.tsx
📚 Learning: 2025-09-08T03:11:00.114Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/app/(mobile-ui)/qr-pay/page.tsx:31-41
Timestamp: 2025-09-08T03:11:00.114Z
Learning: In QR payment flows, the `createPayment` API call for payment tracking can be non-awaited when called after successful transaction execution, as it's a non-blocking logging operation and doesn't affect the user's success state.
Applied to files:
src/app/(mobile-ui)/qr-pay/page.tsx
📚 Learning: 2024-10-29T16:06:38.812Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 495
File: src/components/Create/useCreateLink.tsx:647-657
Timestamp: 2024-10-29T16:06:38.812Z
Learning: In the React code for `useCreateLink` in `src/components/Create/useCreateLink.tsx`, the `switchNetwork` function used within `useCallback` hooks is stable and does not need to be included in the dependency arrays.
Applied to files:
src/components/Create/useCreateLink.tsxsrc/hooks/useLogin.tsx
📚 Learning: 2024-10-18T01:51:35.247Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 458
File: src/components/Offramp/Confirm.view.tsx:141-141
Timestamp: 2024-10-18T01:51:35.247Z
Learning: The `handleConfirm` function in `src/components/Create/Link/Confirm.view.tsx` is separate from the one in `src/components/Offramp/Confirm.view.tsx` and does not need to be renamed when refactoring `handleConfirm` in `src/components/Offramp/Confirm.view.tsx`.
Applied to files:
src/components/Create/useCreateLink.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/Create/useCreateLink.tsxsrc/app/api/peanut/get-attachment-info/route.tssrc/hooks/useLogin.tsx
📚 Learning: 2025-09-05T07:31:11.396Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1185
File: src/components/Claim/useClaimLink.tsx:14-0
Timestamp: 2025-09-05T07:31:11.396Z
Learning: In the peanut-ui codebase, `window.history.replaceState` is preferred over `router.replace` when immediate/synchronous URL parameter updates are required, as `router.replace` is asynchronous and doesn't guarantee instant URL changes that subsequent code can rely on. This pattern is used consistently across usePaymentInitiator.ts, Confirm.payment.view.tsx, and useClaimLink.tsx.
Applied to files:
src/components/Create/useCreateLink.tsxsrc/hooks/useLogin.tsx
📚 Learning: 2025-04-30T21:31:27.790Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 827
File: src/components/Claim/Link/Initial.view.tsx:120-126
Timestamp: 2025-04-30T21:31:27.790Z
Learning: The `sendLinksApi.claim` function in the Peanut Protocol UI accepts both username and wallet address as the first parameter.
Applied to files:
src/components/Create/useCreateLink.tsx
📚 Learning: 2025-01-16T13:14:40.363Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 631
File: src/components/Create/Create.tsx:108-112
Timestamp: 2025-01-16T13:14:40.363Z
Learning: In the Peanut UI codebase, the `resetTokenContextProvider` function from `tokenSelectorContext` is a stable function reference that doesn't change, so it doesn't need to be included in useEffect dependencies.
Applied to files:
src/components/Create/useCreateLink.tsx
📚 Learning: 2025-09-15T16:22:58.382Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 1190
File: src/services/manteca.ts:1-1
Timestamp: 2025-09-15T16:22:58.382Z
Learning: In the manteca service, PEANUT_API_KEY should not be imported in a module that's used by client-side components. The getPrices function that requires the API key should be moved to a server-only module to prevent exposing secrets in the client bundle.
Applied to files:
src/components/Create/useCreateLink.tsx
📚 Learning: 2025-05-15T14:47:26.891Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 857
File: src/hooks/useWebSocket.ts:77-82
Timestamp: 2025-05-15T14:47:26.891Z
Learning: The useWebSocket hook in src/hooks/useWebSocket.ts is designed to provide raw history entries, while the components using it (such as HomeHistory.tsx) are responsible for implementing deduplication logic based on UUID to prevent duplicate entries when combining WebSocket data with other data sources.
Applied to files:
src/hooks/useTransactionHistory.tssrc/components/Home/HomeHistory.tsx
📚 Learning: 2025-04-11T11:33:53.245Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 798
File: src/components/Home/HomeHistory.tsx:138-192
Timestamp: 2025-04-11T11:33:53.245Z
Learning: In the HomeHistory component, infinite scrolling is intentionally not implemented despite the presence of useInfiniteQuery and IntersectionObserver code. The component is designed to only display the first 5 entries with a "View all transactions" link for viewing the complete history.
Applied to files:
src/hooks/useTransactionHistory.tssrc/components/Profile/components/PublicProfile.tsxsrc/components/Home/HomeHistory.tsx
📚 Learning: 2025-07-05T16:58:25.340Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 0
File: :0-0
Timestamp: 2025-07-05T16:58:25.340Z
Learning: Hugo0 successfully refactored sessionStorage usage to React Context in the onramp flow, demonstrating preference for centralized state management over browser storage for component-shared state in React applications.
Applied to files:
src/hooks/useLogin.tsx
📚 Learning: 2025-05-13T10:05:24.057Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 845
File: src/components/Request/link/views/Create.request.link.view.tsx:81-81
Timestamp: 2025-05-13T10:05:24.057Z
Learning: In the peanut-ui project, pages that handle request flows (like Create.request.link.view.tsx) are only accessible to logged-in users who will always have a username, making null checks for user?.user.username unnecessary in these contexts.
Applied to files:
src/hooks/useLogin.tsxsrc/components/Profile/components/PublicProfile.tsx
📚 Learning: 2025-09-05T07:31:11.396Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1185
File: src/components/Claim/useClaimLink.tsx:14-0
Timestamp: 2025-09-05T07:31:11.396Z
Learning: In the peanut-ui codebase, `window.history.replaceState` is used instead of `router.replace` in URL manipulation functions when immediate/synchronous URL updates are required for subsequent actions to read the updated URL parameters.
Applied to files:
src/hooks/useLogin.tsx
🧬 Code graph analysis (8)
src/components/Home/HomeCarouselCTA/CarouselCTA.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
Icon(209-218)
src/context/contextProvider.tsx (2)
src/context/SupportModalContext.tsx (1)
SupportModalProvider(15-37)src/context/QrCodeContext.tsx (1)
QrCodeProvider(12-15)
src/components/Global/DirectSendQR/index.tsx (1)
src/context/QrCodeContext.tsx (1)
useQrCodeContext(17-23)
src/app/(mobile-ui)/qr-pay/page.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)
src/hooks/useTransactionHistory.ts (1)
src/constants/general.consts.ts (1)
PEANUT_API_URL(51-55)
src/hooks/useLogin.tsx (1)
src/utils/general.utils.ts (2)
clearRedirectUrl(796-800)getValidRedirectUrl(899-915)
src/components/Home/HomeHistory.tsx (1)
src/hooks/useTransactionHistory.ts (1)
useTransactionHistory(51-106)
🔇 Additional comments (20)
src/components/Create/useCreateLink.tsx (2)
3-5: LGTM!The import cleanup correctly removes dependencies (PEANUT_API_URL, fetchWithSentry, captureException) that were used by the removed claim-link submission functions. All remaining imports are properly utilized in the code.
286-295: No remaining references to removed functions—change is safe.Verification confirms
submitClaimLinkInitandsubmitClaimLinkConfirmare not referenced elsewhere in the codebase. The return object correctly excludes these functions, aligning with the PR's goal of removing claim-link submission functionality. No breaking changes detected.src/components/Payment/PaymentForm/index.tsx (1)
542-544: LGTM! Clear and descriptive button text.The button text change from "Pay" to "Choose payment method" accurately describes the action for the request pot initial view, improving user clarity.
src/components/Global/Icons/qr-code.tsx (1)
4-4: LGTM! Enhanced SVG flexibility.Spreading
{...props}enables additional SVG properties (e.g.,width,height,aria-*attributes) to be passed from parent components, improving reusability. Note that spread props can override the explicitclassName,viewBox,fill, andxmlnsvalues, which appears intentional for customization.src/hooks/useLogin.tsx (1)
36-42: Verify the need for full-page navigation.The redirect logic now uses
window.location.assign(validRedirectUrl)forredirect_uriand localStorage redirects (lines 36, 40), but continues to userouter.push('/home')for the fallback (line 42). This creates an inconsistency where some redirects trigger full page loads while others use SPA navigation.Full-page navigation is slower and loses React state. If the goal is to ensure a clean state after login, consider applying it consistently to all paths. If not required, reverting to
router.pushfor all cases would improve UX.Can you confirm whether full-page navigation is necessary for these specific redirect scenarios?
src/components/Home/HomeCarouselCTA/index.tsx (1)
35-35: LGTM! Icon size now configurable.Adding
iconSize={16}enables explicit icon sizing for carousel CTAs. Note that this applies the same size to all CTAs; if different CTAs require different icon sizes in the future, consider passingiconSizefrom thectaobject data rather than hardcoding it here.src/components/Profile/components/PublicProfile.tsx (1)
218-218: LGTM! Aligns with updated HomeHistory API.Removing the
isPublic={false}prop correctly reflects the API changes inHomeHistory, which no longer uses this flag. The component now relies solely on theusernameprop for history retrieval.src/components/Slider/index.tsx (1)
17-17: LGTM! Backward-compatible enhancement.The optional
titleprop allows customization of the slider label while maintaining backward compatibility with the default "Slide to Proceed" text. Implementation is clean and straightforward.Also applies to: 21-21, 70-70
src/components/Global/DirectSendQR/index.tsx (1)
21-21: LGTM! Improved state management with context.Migrating from local
useStatetouseQrCodeContextenables shared QR scanner state across components, which aligns with the broader QR flow enhancements in this PR. The existing logic and component behavior remain unchanged, only the state source has been centralized.Also applies to: 199-199
src/app/(mobile-ui)/home/page.tsx (1)
222-223: Clarify re-enable timeline for Add Money Prompt Modal.The TODO comment indicates the Add Money Prompt Modal is temporarily disabled pending fixes. Users who would have been prompted to add funds based on balance/session conditions will no longer see this modal.
Can you provide context on:
- What issue prompted this temporary disablement?
- What fixes are needed before re-enabling?
- Is there an issue tracking this work?
This will help ensure the feature is properly restored when ready.
src/context/contextProvider.tsx (1)
12-12: LGTM!Clean integration of the new QrCodeProvider into the context hierarchy. The nesting order is appropriate and maintains existing provider structure.
Also applies to: 26-28
src/hooks/useHomeCarouselCTAs.tsx (1)
10-10: LGTM!Clean integration of the QR code context and extension of the CarouselCTA type to support configurable icon sizes.
Also applies to: 24-24, 35-35
src/components/Global/BalanceWarningModal/index.tsx (1)
92-121: LGTM!The content updates improve clarity while maintaining the intentional casual and friendly tone. The addition of the
titleprop to the Slider component enhances the UX by providing clear instructions.src/components/Home/HomeCarouselCTA/CarouselCTA.tsx (1)
23-23: LGTM!Clean addition of a configurable
iconSizeprop with a sensible default value (22) that maintains backward compatibility. The implementation correctly applies the prop when rendering icons without logos.Also applies to: 36-36, 100-100
src/app/(mobile-ui)/qr-pay/page.tsx (2)
436-449: LGTM!The PIX-specific error handling is appropriate given the external provider issues. The addition of
qrTypeto the dependency array ensures the effect re-runs when the QR type changes, which is correct.
845-857: LGTM!The simplified error UI structure is cleaner and more consistent with the rest of the application's error handling patterns.
src/context/QrCodeContext.tsx (1)
1-23: LGTM!Clean and minimal context implementation for managing QR scanner state. The error handling in
useQrCodeContextproperly enforces that the hook is used within the provider, following React best practices.src/hooks/useTransactionHistory.ts (1)
25-25: LGTM!The removal of the public mode is implemented consistently throughout the hook. The simplified authorization flow always requires authentication, which aligns with the PR's goal of deprecating public transaction history access.
Also applies to: 33-38, 58-70
src/components/Home/HomeHistory.tsx (1)
27-27: LGTM!The removal of the
isPublicprop and associated logic is implemented consistently throughout the component. The component now operates in a single mode, which simplifies the codebase while maintaining all necessary functionality for viewing transaction history.Also applies to: 31-31, 37-37, 168-187, 200-200, 210-210, 302-302
src/app/api/peanut/get-attachment-info/route.ts (1)
8-10: No callers found—verification complete and code is safe as-is.Comprehensive search of the codebase confirms zero references to the
get-attachment-infoendpoint. The disabled endpoint with 405 response poses no risk of active code failures. The TODO comment is clear about the intended future direction using/send-link.
No description provided.