-
Notifications
You must be signed in to change notification settings - Fork 13
Fix/merge conflicts #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/merge conflicts #1033
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces a referral campaign feature to the Home page with a modal and floating button, revises claim page metadata for improved social sharing, and shifts send flow state management to URL parameters. It also removes certain unsupported countries, cleans up React imports, and standardizes API key usage in token actions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ 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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (5)
src/components/LandingPage/sendInSeconds.tsx (1)
24-37
: MemoizecreateCloudAnimation
to avoid needless re-creations
createCloudAnimation
is regenerated on every render even though its logic only depends onscreenWidth
. Wrapping it inuseCallback
(and importinguseCallback
) will prevent unnecessary re-allocations and prop-drilling churn tomotion.img
elements.-import { useEffect, useState } from 'react' +import { useEffect, useState, useCallback } from 'react' ... - const createCloudAnimation = (side: 'left' | 'right', width: number, speed: number) => { + const createCloudAnimation = useCallback( + (side: 'left' | 'right', width: number, speed: number) => { const vpWidth = screenWidth || 1080 const totalDistance = vpWidth + width return { initial: { x: side === 'left' ? -width : vpWidth }, animate: { x: side === 'left' ? vpWidth : -width }, transition: { ease: 'linear', duration: totalDistance / speed, repeat: Infinity, }, } - } + }, + [screenWidth], + )src/components/Home/FloatingReferralButton/index.tsx (1)
11-11
: Consider using more responsive positioning.The absolute positioning with
left-[43%] top-[15%]
may not work consistently across different screen sizes and orientations. Consider using fixed positioning or more responsive units.- className="absolute left-[43%] top-[15%] z-50 animate-pulse cursor-pointer text-4xl transition-all duration-300 hover:scale-110 hover:animate-none md:hidden" + className="fixed bottom-20 right-6 z-50 animate-pulse cursor-pointer text-4xl transition-all duration-300 hover:scale-110 hover:animate-none md:hidden"src/components/Send/views/SendRouter.view.tsx (1)
21-25
: Consider router history implications.Using
router.back()
assumes there's always a previous history entry. If the user navigated directly to this page, this might not work as expected.const handlePrev = () => { // Reset send flow state when leaving link creation flow dispatch(sendFlowActions.resetSendFlow()) - router.back() + router.push('/send') }src/components/Home/ReferralCampaignModal/index.tsx (2)
16-19
: Consider memoising the callback and pre-fetching the target route
handleInviteFriends
is recreated on every render.
Wrapping it inuseCallback
keeps the function reference stable, and a quickrouter.prefetch('/send')
(e.g. in auseEffect
) eliminates the navigation jank the first time a user clicks the CTA. Both are low-effort wins for render performance & UX.-import { useRouter } from 'next/navigation' +import { useRouter } from 'next/navigation' +import { useCallback, useEffect } from 'react' ... - const handleInviteFriends = () => { - router.push('/send?createLink=true') - onClose() - } + useEffect(() => { + router.prefetch('/send?createLink=true') + }, [router]) + + const handleInviteFriends = useCallback(() => { + router.push('/send?createLink=true') + onClose() + }, [router, onClose])
40-48
: Minor copy tweak for clarity
Friends deposit
→Friend deposits
keeps subject/verb agreement consistent with the other list items.-<li>Friends deposit >$200 or connects bank account.</li> +<li>Friend deposits >$200 or connects a bank account.</li>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/app/(mobile-ui)/claim/page.tsx
(2 hunks)src/app/(mobile-ui)/home/page.tsx
(3 hunks)src/app/actions/tokens.ts
(1 hunks)src/components/AddMoney/consts/index.ts
(0 hunks)src/components/Home/FloatingReferralButton/index.tsx
(1 hunks)src/components/Home/ReferralCampaignModal/index.tsx
(1 hunks)src/components/LandingPage/businessIntegrate.tsx
(0 hunks)src/components/LandingPage/securityBuiltIn.tsx
(0 hunks)src/components/LandingPage/sendInSeconds.tsx
(1 hunks)src/components/LandingPage/yourMoney.tsx
(0 hunks)src/components/Send/views/SendRouter.view.tsx
(2 hunks)
💤 Files with no reviewable changes (4)
- src/components/LandingPage/securityBuiltIn.tsx
- src/components/LandingPage/businessIntegrate.tsx
- src/components/LandingPage/yourMoney.tsx
- src/components/AddMoney/consts/index.ts
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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.
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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.
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#823
File: src/context/kernelClient.context.tsx:79-86
Timestamp: 2025-04-29T19:36:38.121Z
Learning: When Hugo0 asks to "resolve coderabbit comments", they want to acknowledge the comment without necessarily implementing the suggested changes, as the current implementation might be intentional for their specific use case.
src/components/LandingPage/sendInSeconds.tsx (10)
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #478
File: src/components/Dashboard/useDashboard.tsx:134-134
Timestamp: 2024-10-24T12:36:40.508Z
Learning: In the file src/components/Dashboard/useDashboard.tsx
, memoization of the getTokenSymbol
function is not necessary because it is lightweight and does not involve complex computations or network calls.
Learnt from: jjramirezn
PR: #478
File: src/components/Request/Create/Views/Initial.view.tsx:81-89
Timestamp: 2024-10-24T12:38:32.793Z
Learning: In src/components/Request/Create/Views/Initial.view.tsx
, the function getTokenDetails
is a simple function that does not fetch from the network or perform asynchronous operations.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: Hugo0
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
.
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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.
Learnt from: jjramirezn
PR: #478
File: src/components/Request/Create/Views/Initial.view.tsx:169-176
Timestamp: 2024-10-24T12:45:22.708Z
Learning: When calling handleOnNext
in src/components/Request/Create/Views/Initial.view.tsx
, it's acceptable to duplicate parameter lists for readability instead of refactoring to avoid duplication.
src/app/(mobile-ui)/claim/page.tsx (12)
Learnt from: jjramirezn
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.
Learnt from: Hugo0
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #469
File: src/app/request/pay/page.tsx:32-49
Timestamp: 2024-10-22T18:11:36.864Z
Learning: In src/app/request/pay/page.tsx
, the id
parameter is accessed via searchParams.id
in the generateMetadata
function.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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
.
Learnt from: Hugo0
PR: #422
File: src/components/Request/Pay/Pay.tsx:103-111
Timestamp: 2024-10-08T20:13:42.967Z
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.
Learnt from: Hugo0
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
src/app/actions/tokens.ts (10)
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #956
File: src/app/actions/tokens.ts:220-227
Timestamp: 2025-07-07T19:55:14.380Z
Learning: In the Mobula API integration within src/app/actions/tokens.ts
, the asset.asset.blockchains
array and asset.contracts_balances
array are synchronized, meaning for every blockchain in the blockchains array, there will be a corresponding entry in the contracts_balances array with matching address. This makes the non-null assertion operator safe to use when accessing contractInfo!.decimals
in the fetchWalletBalances
function.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #478
File: src/components/Dashboard/useDashboard.tsx:134-134
Timestamp: 2024-10-24T12:36:40.508Z
Learning: In the file src/components/Dashboard/useDashboard.tsx
, memoization of the getTokenSymbol
function is not necessary because it is lightweight and does not involve complex computations or network calls.
Learnt from: jjramirezn
PR: #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.
Learnt from: jjramirezn
PR: #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.
Learnt from: jjramirezn
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 ''
.
Learnt from: Hugo0
PR: #422
File: src/components/Request/Pay/Pay.tsx:103-111
Timestamp: 2024-10-08T20:13:42.967Z
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.
Learnt from: Hugo0
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.
Learnt from: jjramirezn
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.
src/components/Home/ReferralCampaignModal/index.tsx (5)
Learnt from: Hugo0
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
.
Learnt from: Hugo0
PR: #458
File: src/components/Offramp/Confirm.view.tsx:96-96
Timestamp: 2024-10-18T08:54:22.142Z
Learning: In the src/components/Offramp/Confirm.view.tsx
file, it's acceptable to include crass or informal language in code comments.
Learnt from: jjramirezn
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.
Learnt from: kushagrasarathe
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".
Learnt from: kushagrasarathe
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".
src/components/Home/FloatingReferralButton/index.tsx (5)
Learnt from: jjramirezn
PR: #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.
Learnt from: jjramirezn
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.
Learnt from: Hugo0
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
.
Learnt from: jjramirezn
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.
Learnt from: Hugo0
PR: #458
File: src/components/Offramp/Confirm.view.tsx:96-96
Timestamp: 2024-10-18T08:54:22.142Z
Learning: In the src/components/Offramp/Confirm.view.tsx
file, it's acceptable to include crass or informal language in code comments.
src/app/(mobile-ui)/home/page.tsx (7)
Learnt from: kushagrasarathe
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".
Learnt from: kushagrasarathe
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".
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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.
Learnt from: Hugo0
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
.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #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.
Learnt from: jjramirezn
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.
src/components/Send/views/SendRouter.view.tsx (15)
Learnt from: jjramirezn
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.
Learnt from: Hugo0
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
.
Learnt from: jjramirezn
PR: #478
File: src/components/Request/Create/Views/Initial.view.tsx:169-176
Timestamp: 2024-10-24T12:45:22.708Z
Learning: When calling handleOnNext
in src/components/Request/Create/Views/Initial.view.tsx
, it's acceptable to duplicate parameter lists for readability instead of refactoring to avoid duplication.
Learnt from: Hugo0
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
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.
Learnt from: jjramirezn
PR: #469
File: src/app/request/pay/page.tsx:32-49
Timestamp: 2024-10-22T18:11:36.864Z
Learning: In src/app/request/pay/page.tsx
, the id
parameter is accessed via searchParams.id
in the generateMetadata
function.
Learnt from: jjramirezn
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.
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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.
Learnt from: kushagrasarathe
PR: #828
File: src/app/(mobile-ui)/request/[...username]/page.tsx:17-17
Timestamp: 2025-05-02T19:14:25.010Z
Learning: In Next.js App Router, catch-all routes (like /request/[...username]
) will only match URLs with at least one parameter segment, ensuring that the page component only renders when there is at least one value in the params array.
Learnt from: kushagrasarathe
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".
Learnt from: kushagrasarathe
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".
Learnt from: Hugo0
PR: #422
File: src/components/Request/Pay/Pay.tsx:113-123
Timestamp: 2024-10-08T20:13:42.967Z
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.
Learnt from: Hugo0
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.
⏰ 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/LandingPage/sendInSeconds.tsx (1)
1-1
: Confirm removal of default React import
The filesrc/components/LandingPage/sendInSeconds.tsx
contains noReact.
references, so dropping the default React import is correct and keeps the bundle lean.src/components/Home/FloatingReferralButton/index.tsx (1)
7-19
: Well-implemented floating button component.The component follows React best practices with proper TypeScript typing, accessibility support via
aria-label
, and appropriate styling. The animation and hover effects provide good user feedback.src/app/(mobile-ui)/claim/page.tsx (2)
41-42
: Improved user-friendly title formatting.The change from token symbol suffix to dollar sign prefix with "via Peanut" creates a more intuitive and branded message format. This enhances social sharing presentation and user comprehension.
86-86
: Unified and actionable social media descriptions.The new description "Tap the link to receive instantly and without fees" is more engaging and action-oriented compared to the previous generic messaging. This should improve click-through rates on social platforms.
Also applies to: 92-92
src/app/actions/tokens.ts (1)
104-104
: Good consistency improvement with module-level constants.Moving
MOBULA_API_KEY
to a module-level constant aligns with the existing pattern forMOBULA_API_URL
and improves code maintainability by centralizing environment variable access.Also applies to: 266-266
src/app/(mobile-ui)/home/page.tsx (3)
35-36
: Clean component imports.The new referral campaign components are properly imported and follow the established import pattern in the file.
65-65
: Consistent state management.The
showReferralCampaignModal
state follows the same pattern as other modals in the component, maintaining consistency with the existing codebase.
250-256
: Well-integrated referral campaign feature.The modal and floating button are properly connected with appropriate event handlers. The implementation follows the established patterns used by other modals in this component.
src/components/Send/views/SendRouter.view.tsx (2)
5-5
: Good architectural improvement to URL-driven state.Moving from local boolean state to URL parameters enables better navigation, deep linking, and back button support. This aligns with modern React routing patterns.
Also applies to: 12-13
15-19
: Clean state management with URL parameters.The
redirectToSendByLink
function properly resets the Redux state and updates the URL. Usingwindow.location.pathname
preserves the current path while adding the query parameter.src/components/Home/ReferralCampaignModal/index.tsx (1)
21-34
: Type-safety: verifyshadowSize
andvariant
props exist onActionModalButtonProps
If either field isn’t part of the exported type the compiler will silently accept
any
, masking future refactor regressions.
Double-check thatshadowSize
andvariant
are indeed defined (and preferably union-typed) inActionModalButtonProps
.
onLinkCardClick={() => { | ||
router.push(`${window.location.pathname}?createLink=false`) // preserve current URL | ||
redirectToSendByLink() | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the double URL push pattern.
The onLinkCardClick
handler pushes two URLs in quick succession. This might cause navigation issues or unexpected behavior.
🏁 Script executed:
#!/bin/bash
# Search for similar patterns of double router.push calls in the codebase
rg -A 3 -B 3 "router\.push.*router\.push|push.*push" --type tsx --type ts
Length of output: 103
I’d like to verify what redirectToSendByLink actually does—if it invokes router.push as well. Let’s pull in the handler and its definition:
🏁 Script executed:
#!/bin/bash
# Show the onLinkCardClick context in SendRouter.view.tsx
rg -n "onLinkCardClick" -C 5 "src/components/Send/views/SendRouter.view.tsx" --glob "*.tsx"
# Locate and display the definition of redirectToSendByLink across TS/TSX files
rg -n "redirectToSendByLink" -C 5 --glob "*.ts" --glob "*.tsx"
Length of output: 2462
Avoid consecutive router.push calls in onLinkCardClick
We verified that at src/components/Send/views/SendRouter.view.tsx:35-38
, the handler invokes two navigations in quick succession:
- First:
router.push(\
${window.location.pathname}?createLink=false`)` - Then:
redirectToSendByLink()
→ dispatch(resetSendFlow) →
router.push(\
${window.location.pathname}?createLink=true`)`
Back-to-back pushes can introduce flicker, extra history entries, or navigation races. To address this, choose one of the following fixes:
• Remove the initial push and rely on state reset + a single push to enter link creation:
- onLinkCardClick={() => {
- router.push(`${window.location.pathname}?createLink=false`)
- redirectToSendByLink()
- }}
+ onLinkCardClick={() => {
+ dispatch(sendFlowActions.resetSendFlow())
+ router.push(`${window.location.pathname}?createLink=true`)
+ }}
• If you must clear the query first, use router.replace
for the false state and await it before pushing the true state:
- onLinkCardClick={() => {
- router.push(`${window.location.pathname}?createLink=false`)
- redirectToSendByLink()
- }}
+ onLinkCardClick={async () => {
+ dispatch(sendFlowActions.resetSendFlow())
+ await router.replace(`${window.location.pathname}?createLink=false`)
+ router.push(`${window.location.pathname}?createLink=true`)
+ }}
Either approach prevents unintended double navigations.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/components/Send/views/SendRouter.view.tsx lines 35 to 38, the
onLinkCardClick handler triggers two consecutive router.push calls causing
navigation flicker and extra history entries. To fix this, either remove the
initial router.push call and rely solely on redirectToSendByLink() which
dispatches resetSendFlow and performs a single push, or replace the first
router.push with router.replace and await its completion before calling
redirectToSendByLink() to ensure only one navigation occurs.
No description provided.