Skip to content

Conversation

Hugo0
Copy link
Contributor

@Hugo0 Hugo0 commented Jul 29, 2025

No description provided.

Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-wallet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 3:55pm

Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

Walkthrough

This 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

Cohort / File(s) Change Summary
Referral Campaign Feature
src/app/(mobile-ui)/home/page.tsx, src/components/Home/FloatingReferralButton/index.tsx, src/components/Home/ReferralCampaignModal/index.tsx
Adds a floating referral button and referral campaign modal to the Home page. Introduces two new components: FloatingReferralButton and ReferralCampaignModal, with state management for modal visibility.
Claim Page Metadata Update
src/app/(mobile-ui)/claim/page.tsx
Updates metadata generation logic to revise the title and social media descriptions for unclaimed links, focusing on a user-centric message and unified phrasing.
Send Flow URL State Refactor
src/components/Send/views/SendRouter.view.tsx
Refactors send flow state management from local React state to URL query parameters, altering navigation and conditional rendering logic.
Country Data Pruning
src/components/AddMoney/consts/index.ts
Removes entries for Afghanistan, Belarus, Cuba, Iraq, Iran, North Korea, Myanmar, Russia, Syria, and Venezuela from the supported country list.
API Key Usage Standardization
src/app/actions/tokens.ts
Replaces direct environment variable access with a module-level constant for the API key in wallet balance fetch requests.
Landing Page React Import Cleanup
src/components/LandingPage/businessIntegrate.tsx, src/components/LandingPage/securityBuiltIn.tsx, src/components/LandingPage/sendInSeconds.tsx, src/components/LandingPage/yourMoney.tsx
Removes unused or redundant React imports from landing page components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Possibly related PRs

  • chore: disable referral #1009: Disables the rendering of the FloatingReferralButton component on the Home page, directly affecting the same UI elements and their interaction logic.
  • merge: peanut-wallet in peanut-wallet-dev #1032: Updates the metadata generation logic in src/app/(mobile-ui)/claim/page.tsx to revise the title format and social media descriptions, overlapping with this PR.
  • hotfix descr #1011: Modifies the metadata descriptions for the claim page in src/app/(mobile-ui)/claim/page.tsx, updating Open Graph and Twitter descriptions in a similar manner.

Suggested labels

enhancement

Suggested reviewers

  • jjramirezn
  • kushagrasarathe

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/merge-conflicts

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Jul 29, 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: 1

🧹 Nitpick comments (5)
src/components/LandingPage/sendInSeconds.tsx (1)

24-37: Memoize createCloudAnimation to avoid needless re-creations

createCloudAnimation is regenerated on every render even though its logic only depends on screenWidth. Wrapping it in useCallback (and importing useCallback) will prevent unnecessary re-allocations and prop-drilling churn to motion.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 in useCallback keeps the function reference stable, and a quick router.prefetch('/send') (e.g. in a useEffect) 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 depositFriend deposits keeps subject/verb agreement consistent with the other list items.

-<li>Friends deposit &gt;$200 or connects bank account.</li>
+<li>Friend deposits &gt;$200 or connects a bank account.</li>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b49828b and 77981c2.

📒 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 file src/components/LandingPage/sendInSeconds.tsx contains no React. 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 for MOBULA_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. Using window.location.pathname preserves the current path while adding the query parameter.

src/components/Home/ReferralCampaignModal/index.tsx (1)

21-34: Type-safety: verify shadowSize and variant props exist on ActionModalButtonProps

If either field isn’t part of the exported type the compiler will silently accept any, masking future refactor regressions.
Double-check that shadowSize and variant are indeed defined (and preferably union-typed) in ActionModalButtonProps.

Comment on lines +35 to +38
onLinkCardClick={() => {
router.push(`${window.location.pathname}?createLink=false`) // preserve current URL
redirectToSendByLink()
}}
Copy link
Contributor

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.

@kushagrasarathe kushagrasarathe merged commit 4e50b2c into peanut-wallet-dev Jul 29, 2025
13 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 14, 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