Skip to content

Conversation

GrandSchtroumpf
Copy link

@GrandSchtroumpf GrandSchtroumpf commented Apr 16, 2025

DONE:

  • Remove wildcard import for @/components, @/Views, @/configs, @/utils & @/context
  • Remove duplicated favicon.ico

Summary by CodeRabbit

  • Refactor

    • Streamlined imports throughout the app by replacing broad namespace imports with direct named imports for contexts and utility functions.
    • Updated all component references and utility function calls to use these direct imports, improving code clarity and maintainability.
  • Chores

    • Removed unused imports across several components.
  • Bug Fixes

    • Error reporting and analytics initialization are now disabled in development environments.

Copy link

vercel bot commented Apr 16, 2025

@GrandSchtroumpf is attempting to deploy a commit to the squirrellabs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Apr 16, 2025

Walkthrough

This change refactors import statements across numerous files, replacing namespace or wildcard imports with direct named imports of only the required functions, components, or contexts. Corresponding usages within each file are updated to reference these named imports directly, eliminating the need for namespace prefixes. The update also introduces conditional logic in some initialization side effects to prevent certain actions in development environments. No functional logic, control flow, or exported entity signatures are altered; the modifications are strictly limited to import style and usage, enhancing code clarity and maintainability.

Changes

Files/Groups Change Summary
src/app/(mobile-ui)/cashout/status/page.tsx, src/app/(mobile-ui)/link-account/page.tsx Changed component imports from namespace to named imports; updated JSX to use direct component references.
src/app/(mobile-ui)/claim/page.tsx Changed utility import from namespace to named import for formatAmount; updated usage accordingly.
src/app/global-error.jsx Added environment check to Sentry error reporting; only reports errors outside development.
src/app/layout.tsx Refactored context provider imports from namespace to named imports; updated JSX usage.
src/components/Cashout/Cashout.consts.ts, src/components/Cashout/CashoutStatus.tsx Changed component and utility imports from namespace to named imports; updated all references accordingly.
src/components/Cashout/Components/Initial.view.tsx Changed context imports from namespace to named imports; updated usage in component.
src/components/Claim/Claim.tsx, src/components/Claim/Link/Initial.view.tsx, Changed context imports from namespace to named imports; updated usage in components.
src/components/Claim/Generic/SenderClaim.view.tsx Changed loading state context import from namespace to named import; removed unused utility import.
src/components/Claim/Link/Onchain/Confirm.view.tsx, src/components/Claim/Link/Onchain/Success.view.tsx Refined imports to use specific named imports for contexts and utilities; updated all usages accordingly.
src/components/Claim/useClaimLink.tsx Replaced wildcard imports for context and utilities with named imports; updated usage.
src/components/Create/Components/RecentRecipients.tsx Changed utility import from namespace to named import for shortenAddressLong; updated usage.
src/components/Create/Create.tsx, src/components/Create/Link/Confirm.view.tsx, Changed context imports from namespace to named imports; updated usage in components.
src/components/Create/Link/Initial.view.tsx Refined imports for validator, context, ethers, and utils to use named imports; updated validation and ENS resolution logic to use these imports.
src/components/Create/Link/Input.view.tsx Changed context imports from namespace to named imports; updated usage in component.
src/components/Dashboard/components/MobileComponent.tsx, src/components/Dashboard/components/OptionsItemComponent.tsx, src/components/Dashboard/index.tsx Changed utility and component imports from namespace to named imports; updated all references accordingly.
src/components/Global/AddressLink/index.tsx Removed unused imports for RecipientType and utils.
src/components/Global/ChainSelector/index.tsx, src/components/Global/TokenSelector/TokenSelector.tsx, src/components/Payment/PaymentForm/index.tsx Changed token selector context import from namespace to named import; updated usage in components.
src/components/Global/CopyField/index.tsx Changed clipboard utility import from namespace to named import; updated usage.
src/components/Global/GeneralRecipientInput/index.tsx Changed utility imports from namespace to named imports; updated usage.
src/components/Global/KYCComponent/index.tsx Changed utility imports from namespace to named imports; updated all references.
src/components/Global/LinkAccountComponent/index.tsx Changed utility imports from namespace to named imports; updated all references.
src/components/Global/TokenSelector/Components/AdvancedButton.tsx, src/components/Global/TokenSelector/Components/TokenDisplay.tsx Changed context and utility imports from namespace to named imports; updated usage in components.
src/components/LinkAccount/index.tsx, src/components/Profile/index.tsx, src/components/Refund/index.tsx Changed loading state context and utility imports from namespace to named imports; updated usage in components.
src/components/Offramp/Confirm.view.tsx, src/components/Offramp/Success.view.tsx Refactored imports from namespace to named imports for context and utilities; updated all usages accordingly.
src/components/Profile/Components/TableComponent.tsx Changed utility imports from namespace to named imports; updated all references.
src/components/utils/utils.ts Changed utility import from namespace to named import for getExplorerUrl; updated usage.
src/config/peanut.config.tsx Changed ContextProvider import from namespace to named; wrapped useEffect in environment check; updated JSX usage.

Sequence Diagram(s)

sequenceDiagram
    participant Component
    participant Context
    participant Utils

    Note over Component: On import
    Component->>Context: import { NamedContext }
    Component->>Utils: import { NeededUtility }

    Note over Component: During execution
    Component->>Context: useContext(NamedContext)
    Component->>Utils: call NeededUtility()

    Note over Component: No control flow or logic changes
Loading

Possibly related PRs

  • peanutprotocol/peanut-ui#551: Modifies wallet-related components and contexts for explicit wallet and token selection handling, directly related to context import refactoring.
  • peanutprotocol/peanut-ui#688: Also changes ContextProvider usage in peanut.config.tsx, related by file but with different modifications.
  • peanutprotocol/peanut-ui#690: Updates peanut.config.tsx with different logic, related by file to the current PR.

Suggested reviewers

  • jjramirezn

Poem

Hopping through fields of code so bright,
I trimmed the imports, made them light.
No more wildcards, no more mess,
Just named imports—nothing less!
The code now shines, so clear and neat,
With every hop, a cleaner feat.
🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e159459 and 3995f1d.

📒 Files selected for processing (1)
  • src/components/Claim/Link/Initial.view.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Claim/Link/Initial.view.tsx

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/components/Create/Create.tsx (1)

56-56: Removed unused property from hook destructuring.

Removed the unused isPeanutWallet property from the useWallet hook destructuring, which was not being used in this component.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 097fb12 and c2d06d9.

⛔ Files ignored due to path filters (1)
  • src/app/favicon.ico is excluded by !**/*.ico
📒 Files selected for processing (43)
  • src/app/(mobile-ui)/cashout/status/page.tsx (1 hunks)
  • src/app/(mobile-ui)/claim/page.tsx (2 hunks)
  • src/app/(mobile-ui)/link-account/page.tsx (2 hunks)
  • src/app/global-error.jsx (1 hunks)
  • src/app/layout.tsx (2 hunks)
  • src/components/Cashout/Cashout.consts.ts (2 hunks)
  • src/components/Cashout/CashoutStatus.tsx (3 hunks)
  • src/components/Cashout/Components/Initial.view.tsx (3 hunks)
  • src/components/Claim/Claim.tsx (2 hunks)
  • src/components/Claim/Generic/SenderClaim.view.tsx (2 hunks)
  • src/components/Claim/Link/Initial.view.tsx (3 hunks)
  • src/components/Claim/Link/Onchain/Confirm.view.tsx (8 hunks)
  • src/components/Claim/Link/Onchain/Success.view.tsx (5 hunks)
  • src/components/Claim/useClaimLink.tsx (2 hunks)
  • src/components/Create/Components/RecentRecipients.tsx (2 hunks)
  • src/components/Create/Create.tsx (2 hunks)
  • src/components/Create/Link/Confirm.view.tsx (3 hunks)
  • src/components/Create/Link/Initial.view.tsx (3 hunks)
  • src/components/Create/Link/Input.view.tsx (2 hunks)
  • src/components/Dashboard/components/MobileComponent.tsx (3 hunks)
  • src/components/Dashboard/components/OptionsItemComponent.tsx (3 hunks)
  • src/components/Dashboard/index.tsx (7 hunks)
  • src/components/Global/AddressLink/index.tsx (0 hunks)
  • src/components/Global/ChainSelector/index.tsx (2 hunks)
  • src/components/Global/CopyField/index.tsx (2 hunks)
  • src/components/Global/GeneralRecipientInput/index.tsx (2 hunks)
  • src/components/Global/KYCComponent/index.tsx (8 hunks)
  • src/components/Global/LinkAccountComponent/index.tsx (5 hunks)
  • src/components/Global/TokenSelector/Components/AdvancedButton.tsx (4 hunks)
  • src/components/Global/TokenSelector/Components/TokenDisplay.tsx (2 hunks)
  • src/components/Global/TokenSelector/TokenSelector.tsx (3 hunks)
  • src/components/LinkAccount/index.tsx (2 hunks)
  • src/components/Offramp/Confirm.view.tsx (24 hunks)
  • src/components/Offramp/Success.view.tsx (3 hunks)
  • src/components/Payment/PaymentForm/index.tsx (2 hunks)
  • src/components/Profile/Components/TableComponent.tsx (4 hunks)
  • src/components/Profile/index.tsx (2 hunks)
  • src/components/Refund/index.tsx (3 hunks)
  • src/components/Request/Create/Create.consts.ts (2 hunks)
  • src/components/Request/Create/Views/Initial.view.tsx (2 hunks)
  • src/components/utils/utils.ts (2 hunks)
  • src/config/peanut.config.tsx (2 hunks)
  • src/config/wagmi.config.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/components/Global/AddressLink/index.tsx
🧰 Additional context used
🧠 Learnings (11)
src/components/Global/ChainSelector/index.tsx (2)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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: peanutprotocol/peanut-ui#424
File: src/components/Global/TokenSelector/TokenSelector.tsx:197-211
Timestamp: 2024-10-11T01:14:15.489Z
Learning: In `src/components/Global/TokenSelector/TokenSelector.tsx`, when the calculation within functions like `byChainAndText` is not computationally expensive, it's acceptable to avoid using `useCallback` for memoization.
src/components/Claim/Claim.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Create/Link/Confirm.view.tsx (2)
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#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: peanutprotocol/peanut-ui#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.
src/components/Create/Link/Input.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Cashout/Components/Initial.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Global/TokenSelector/TokenSelector.tsx (2)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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: peanutprotocol/peanut-ui#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.
src/components/Global/TokenSelector/Components/AdvancedButton.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Payment/PaymentForm/index.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Request/Create/Views/Initial.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Create/Create.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#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.
src/components/Claim/Link/Onchain/Success.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#431
File: src/components/Create/Link/Success.view.tsx:89-89
Timestamp: 2024-10-08T20:29:00.726Z
Learning: `shortenAddressLong` is used for formatting transaction hashes.
🧬 Code Graph Analysis (32)
src/components/utils/utils.ts (1)
src/utils/general.utils.ts (1)
  • getExplorerUrl (752-760)
src/components/Global/CopyField/index.tsx (1)
src/utils/general.utils.ts (1)
  • copyTextToClipboardWithFallback (390-416)
src/components/Offramp/Success.view.tsx (1)
src/utils/general.utils.ts (2)
  • getExplorerUrl (752-760)
  • formatTokenAmount (312-333)
src/components/Global/TokenSelector/Components/TokenDisplay.tsx (1)
src/utils/general.utils.ts (1)
  • formatTokenAmount (312-333)
src/components/Global/ChainSelector/index.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Claim/Claim.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/app/(mobile-ui)/link-account/page.tsx (1)
src/components/LinkAccount/index.tsx (1)
  • LinkAccountComponent (14-82)
src/app/(mobile-ui)/claim/page.tsx (1)
src/utils/general.utils.ts (1)
  • formatAmount (259-299)
src/components/Create/Link/Confirm.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Dashboard/components/MobileComponent.tsx (1)
src/utils/general.utils.ts (3)
  • formatDate (832-841)
  • formatTokenAmount (312-333)
  • copyTextToClipboardWithFallback (390-416)
src/components/Claim/useClaimLink.tsx (2)
src/hooks/wallet/useWallet.ts (1)
  • useWallet (89-399)
src/utils/general.utils.ts (1)
  • isTestnetChain (418-424)
src/components/Cashout/Components/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Global/TokenSelector/TokenSelector.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Global/TokenSelector/Components/AdvancedButton.tsx (2)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/utils/general.utils.ts (1)
  • formatTokenAmount (312-333)
src/components/Global/LinkAccountComponent/index.tsx (2)
src/utils/cashout.utils.ts (5)
  • validateBankAccount (532-549)
  • getCustomer (195-199)
  • getThreeCharCountryCodeFromIban (491-504)
  • createExternalAccount (232-313)
  • createAccount (89-118)
src/interfaces/interfaces.ts (1)
  • IResponse (6-17)
src/config/peanut.config.tsx (1)
src/config/wagmi.config.tsx (1)
  • ContextProvider (65-82)
src/components/Refund/index.tsx (1)
src/utils/general.utils.ts (1)
  • getExplorerUrl (752-760)
src/components/Dashboard/index.tsx (4)
src/utils/general.utils.ts (5)
  • getAllLinksFromLocalStorage (132-166)
  • getAllRaffleLinksFromLocalstorage (168-243)
  • printableAddress (64-67)
  • formatTokenAmount (312-333)
  • formatDate (832-841)
src/components/Dashboard/components/SortComponent.tsx (1)
  • SortComponent (4-45)
src/components/Dashboard/components/OptionsItemComponent.tsx (1)
  • OptionsItemComponent (6-72)
src/components/Dashboard/components/MobileComponent.tsx (1)
  • MobileItemComponent (8-102)
src/components/Claim/Link/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/app/(mobile-ui)/cashout/status/page.tsx (2)
src/app/(mobile-ui)/claim/page.tsx (1)
  • dynamic (6-6)
src/components/Cashout/CashoutStatus.tsx (1)
  • CashoutStatus (12-79)
src/components/Payment/PaymentForm/index.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Global/KYCComponent/index.tsx (1)
src/utils/cashout.utils.ts (4)
  • getUserLinks (153-186)
  • awaitStatusCompletion (207-230)
  • convertPersonaUrl (24-36)
  • getStatus (188-193)
src/components/Create/Components/RecentRecipients.tsx (1)
src/utils/general.utils.ts (1)
  • shortenAddressLong (55-62)
src/components/Global/GeneralRecipientInput/index.tsx (2)
src/utils/cashout.utils.ts (1)
  • validateBankAccount (532-549)
src/utils/general.utils.ts (2)
  • validateEnsName (77-79)
  • resolveFromEnsName (361-388)
src/components/Request/Create/Views/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Create/Create.tsx (2)
src/hooks/wallet/useWallet.ts (1)
  • useWallet (89-399)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/components/Cashout/CashoutStatus.tsx (1)
src/utils/cashout.utils.ts (3)
  • CashoutTransaction (634-649)
  • getCashoutStatus (669-694)
  • CashoutStatusDescriptions (651-667)
src/components/Offramp/Confirm.view.tsx (4)
src/context/tokenSelector.context.tsx (1)
  • tokenSelectorContext (24-43)
src/utils/general.utils.ts (5)
  • isNativeCurrency (441-445)
  • saveOfframpLinkToLocalstorage (477-499)
  • isTestnetChain (418-424)
  • formatTokenAmount (312-333)
  • formatAmount (259-299)
src/utils/cashout.utils.ts (8)
  • getLiquidationAddresses (474-489)
  • getChainIdFromBridgeChainName (527-530)
  • getTokenAddressFromBridgeTokenName (520-526)
  • getBridgeTokenName (506-513)
  • getBridgeChainName (515-518)
  • createLiquidationAddress (366-472)
  • fetchRouteRaw (696-725)
  • submitCashoutLink (569-615)
src/utils/sdkErrorHandler.utils.tsx (1)
  • ErrorHandler (9-114)
src/app/layout.tsx (2)
src/config/wagmi.config.tsx (1)
  • ContextProvider (65-82)
src/components/Global/TranslationSafeWrapper.tsx (1)
  • TranslationSafeWrapper (8-18)
src/components/Dashboard/components/OptionsItemComponent.tsx (1)
src/utils/general.utils.ts (1)
  • copyTextToClipboardWithFallback (390-416)
src/components/Create/Link/Initial.view.tsx (1)
src/utils/general.utils.ts (2)
  • isNumeric (789-792)
  • resolveFromEnsName (361-388)
src/components/Profile/Components/TableComponent.tsx (1)
src/utils/general.utils.ts (4)
  • formatTokenAmount (312-333)
  • formatDate (832-841)
  • getExplorerUrl (752-760)
  • copyTextToClipboardWithFallback (390-416)
🔇 Additional comments (61)
src/app/(mobile-ui)/cashout/status/page.tsx (1)

1-1: LGTM: Improved import specificity

The change from namespace imports to named imports for the CashoutStatus component improves code clarity and helps reduce compile time by being more explicit about what's being imported.

Also applies to: 8-8

src/components/Global/TokenSelector/Components/TokenDisplay.tsx (1)

2-2: LGTM: Replaced wildcard import with specific utility import

The change from importing the entire utils namespace to only importing the specific formatTokenAmount function aligns with the PR objective to reduce compile time and improves code clarity.

Also applies to: 30-36

src/components/Request/Create/Create.consts.ts (1)

2-2: LGTM: Direct imports for view components

Replacing the wildcard import with specific named imports for InitialView and CreateRequestSuccessView improves code clarity and helps reduce compile time by being explicit about dependencies.

Also applies to: 18-18, 20-20

src/components/Create/Components/RecentRecipients.tsx (1)

2-2: LGTM: Specific utility function import

The change from importing the entire utils namespace to only importing the specific shortenAddressLong function aligns with the PR objective and makes dependencies clearer.

Also applies to: 49-49

src/components/Create/Link/Input.view.tsx (1)

16-16: LGTM: Direct context imports

Replacing the context namespace import with specific named imports for tokenSelectorContext and loadingStateContext improves code readability and helps reduce compile time by being explicit about which contexts are actually used.

Also applies to: 76-76, 81-81

src/components/Claim/Claim.tsx (2)

8-8: Import refactoring looks good!

Replacing the wildcard import with a named import for tokenSelectorContext is a good change that aligns with the PR objective of reducing compile time.


47-47: Usage updated correctly.

The usage of tokenSelectorContext has been properly updated to match the import change.

src/app/global-error.jsx (1)

8-12: Good optimization for development environment.

Conditionally executing Sentry error reporting only in non-development environments is a good practice. It prevents development errors from cluttering the Sentry dashboard and reduces unnecessary API calls during local development.

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

2-2: Import refactoring looks good!

Replacing the wildcard import with a specific named import for formatAmount aligns with the PR objective of reducing compile time.


46-46: Usage updated correctly.

The direct usage of formatAmount has been properly updated to match the import change.

src/components/utils/utils.ts (2)

2-2: Import refactoring looks good!

Replacing the wildcard import with a specific named import for getExplorerUrl aligns with the PR objective of reducing compile time.


93-93: Usage updated correctly.

The direct usage of getExplorerUrl has been properly updated to match the import change.

src/components/Request/Create/Views/Initial.view.tsx (1)

11-11: Refactor to named context imports is correct and improves clarity.

Switching from wildcard to named imports for contexts is a best practice for performance and maintainability. All usages are correctly updated.

Also applies to: 45-46

src/components/Payment/PaymentForm/index.tsx (1)

21-21: Direct context import and usage refactor is correct.

Switching to a named import for tokenSelectorContext and updating its usage is correct and improves code clarity.

Also applies to: 72-72

src/components/Cashout/Cashout.consts.ts (1)

6-6: Direct component import and usage refactor is correct.

Switching to a named import for InitialCashoutView and updating its usage in the screen map is correct and improves code clarity.

Also applies to: 24-24

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

5-5: Selective utility imports and usage refactor are correct.

Switching to named imports for utility functions and updating their usage is correct and improves code clarity and performance.

Also applies to: 51-52, 58-58

src/app/(mobile-ui)/link-account/page.tsx (1)

1-1: Direct component import and usage refactor is correct.

Switching to a named import for LinkAccountComponent and updating its usage is correct and improves code clarity.

Also applies to: 23-23

src/components/LinkAccount/index.tsx (1)

4-4: Good refactoring to use specific imports.

The change from wildcard import to named import for the context improves code clarity and potentially reduces bundle size by explicitly importing only what's needed.

Also applies to: 20-20

src/components/Offramp/Success.view.tsx (1)

5-5: Well-executed refactoring of utility imports.

Replacing the namespace import with specific named imports for formatTokenAmount and getExplorerUrl functions improves code clarity and aligns with the PR objective of removing wildcard imports.

Also applies to: 33-33, 87-87, 90-90, 94-94, 97-97, 102-102

src/components/Global/TokenSelector/TokenSelector.tsx (1)

4-4: Good implementation of specific context import.

Converting from a namespace import to a specific named import for tokenSelectorContext improves code readability and contributes to better module bundling.

Also applies to: 23-23, 186-186

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

4-4: Clean refactoring of context import.

The change from wildcard import to direct named import for tokenSelectorContext follows the pattern established throughout the codebase, maintaining consistency while improving specificity.

Also applies to: 32-32

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

4-4: Refactor to direct named import is correct and improves clarity.

Switching from namespace to named import for copyTextToClipboardWithFallback is a best practice and reduces unnecessary import scope. Usage is correct and safe.

Also applies to: 27-27

src/components/Create/Link/Confirm.view.tsx (1)

12-12: Direct named context imports improve clarity and maintainability.

Switching from namespace to named imports for contexts is a best practice and reduces unnecessary import scope. Usage is correct and safe.

Also applies to: 58-58, 75-75

src/components/Profile/index.tsx (1)

3-3: Direct named context import is correct and improves clarity.

Switching from namespace to named import for loadingStateContext is a best practice and reduces unnecessary import scope. Usage is correct and safe.

Also applies to: 20-20

src/components/Claim/Link/Initial.view.tsx (1)

23-23: Direct named context imports improve clarity and maintainability.

Switching from namespace to named imports for contexts is a best practice and reduces unnecessary import scope. Usage is correct and safe.

Also applies to: 88-88, 99-99

src/components/Dashboard/components/OptionsItemComponent.tsx (1)

3-3: Refactor to direct named import is correct and improves clarity.

Switching from namespace to named import for copyTextToClipboardWithFallback is a best practice and reduces unnecessary import scope. Usage is correct and safe.

Also applies to: 39-39, 61-61

src/components/Cashout/Components/Initial.view.tsx (1)

14-14: Import refactoring improves clarity and compile time

The replacement of namespace imports with direct named imports (tokenSelectorContext and loadingStateContext) aligns with the PR's objective to improve compile time. This change makes it more explicit which specific components are being used from the context module.

Also applies to: 47-47, 66-66

src/components/Claim/Generic/SenderClaim.view.tsx (1)

5-5: Clean import refactoring removes unnecessary dependencies

The change from namespace imports to specific named imports improves code clarity and should help reduce compile time by eliminating the unused shortenAddress utility that was previously imported as part of the namespace.

Also applies to: 8-8, 31-31

src/components/Claim/useClaimLink.tsx (1)

10-10: Clean import refactoring for context and utility functions

Good job refactoring the imports from namespace imports to named imports for both the loadingStateContext and isTestnetChain utility. This change makes the dependencies more explicit and should help reduce compile time.

Also applies to: 12-12, 19-19, 57-57

src/components/Dashboard/components/MobileComponent.tsx (1)

4-4: Import refactoring simplifies utility function usage

The change from namespace imports to named imports for the utility functions (copyTextToClipboardWithFallback, formatDate, and formatTokenAmount) improves code readability and should help with tree-shaking during compilation.

Also applies to: 38-38, 44-44, 83-83

src/config/wagmi.config.tsx (1)

65-65:

❓ Verification inconclusive

Made cookies parameter optional in ContextProvider

Making the cookies parameter optional improves flexibility when using the ContextProvider component. However, ensure that the cookieToInitialState function properly handles undefined or null values for the cookies parameter.


🏁 Script executed:

#!/bin/bash
# Description: Check if cookieToInitialState handles undefined/null cookies gracefully

# Search for cookieToInitialState implementation or its usages in the codebase
rg -A 5 "cookieToInitialState" --type ts --type tsx

Length of output: 79


I'll generate a revised shell script command to search for the cookieToInitialState implementation without the file-type filters. This will allow us to inspect its handling of undefined/null cookies.

Please run this script and share the output so we can verify whether cookieToInitialState gracefully handles undefined or null values. Once we have that information, we can update the review comment accordingly.


🏁 Script executed:

#!/bin/bash
# Re-run search for the cookieToInitialState implementation without file type restrictions.
rg -A 5 "cookieToInitialState" .

Length of output: 889


ContextProvider: Verify External Handling of Optional Cookies

  • The cookies parameter in ContextProvider has been made optional, enhancing flexibility.
  • In src/config/wagmi.config.tsx, the cookieToInitialState function from the external wagmi package is invoked with cookies, which may be undefined or null.
  • Since the implementation of cookieToInitialState isn’t directly visible in the codebase, please manually verify (or consult the wagmi documentation/tests) that it gracefully handles cases where cookies is absent or set to null.
src/components/Refund/index.tsx (1)

7-7: Improved import specificity for better compile time.

The code now imports specific functions and contexts directly instead of using wildcard imports. This change is part of the broader effort to reduce compilation time as outlined in the PR objectives.

Using named imports instead of namespace imports has benefits:

  1. Better tree-shaking: The bundler can exclude unused code
  2. Improved IDE support for code navigation and auto-completion
  3. Clearer dependency tracking

Also applies to: 9-9, 32-32, 109-109

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

11-11: Streamlined imports for KYC component utilities.

The code now properly imports the specific utility functions needed instead of importing the entire utils namespace. This is aligned with the PR objective to improve compilation time by eliminating wildcard imports.

The refactored imports (awaitStatusCompletion, convertPersonaUrl, getStatus, getUserLinks) are now accessed directly rather than through the utils namespace, maintaining identical functionality while improving build performance.

Also applies to: 112-115, 172-175, 194-203, 283-283, 295-304, 320-320

src/config/peanut.config.tsx (2)

2-2: Narrowed imports for wagmi config context provider.

Replaced namespace import with specific named import for ContextProvider, improving build performance while maintaining the same functionality.

Also applies to: 31-31, 34-34


18-25: Added environment check for initialization.

Added conditional to skip initialization in development mode, which can improve development performance by avoiding unnecessary initialization of analytics and other production-focused services.

This is a nice optimization that keeps development builds cleaner and potentially faster, while ensuring production builds still initialize all necessary services.

src/components/Profile/Components/TableComponent.tsx (1)

7-7: Enhanced import specificity for table component utilities.

Replaced broad utility namespace import with targeted imports of specific functions (copyTextToClipboardWithFallback, formatDate, formatTokenAmount, getExplorerUrl), allowing for better tree-shaking and reduced compile time.

All function references throughout the component have been updated to access these utilities directly rather than through the utils namespace prefix, maintaining identical functionality.

Also applies to: 103-103, 107-107, 159-159, 172-172

src/components/Global/LinkAccountComponent/index.tsx (2)

8-8: Improved import efficiency with named imports.

The change from wildcard import (import * as utils from '@/utils') to specific named imports improves bundle size efficiency through better tree-shaking.


160-160: Properly updated utility function references.

All references to utility functions throughout the component have been correctly updated to use the directly imported functions instead of accessing them through the utils namespace.

Also applies to: 206-207, 299-300, 307-313, 339-346

src/components/Global/TokenSelector/Components/AdvancedButton.tsx (3)

1-2: Improved import specificity for context and utilities.

Replaced wildcard imports with named imports for better tree-shaking and compile-time performance.


40-40: Updated context usage to reflect import change.

The context reference is correctly updated to use the directly imported tokenSelectorContext.


96-96: Properly updated utility function references.

All references to formatTokenAmount have been correctly changed to use the directly imported function instead of accessing it through the utils namespace.

Also applies to: 105-105, 107-107, 112-112

src/components/Create/Create.tsx (2)

6-6: Improved import specificity for token selector context.

Changed from wildcard import to named import, making the code more maintainable and efficient.


58-58: Updated context usage to reflect import change.

The resetTokenContextProvider is now correctly accessed from the directly imported context rather than through a namespace.

src/components/Claim/Link/Onchain/Success.view.tsx (3)

3-3: Improved import specificity for contexts and utilities.

Replaced wildcard imports with named imports for better bundle size efficiency and clearer code.

Also applies to: 5-5


17-17: Updated context usage to reflect import change.

The context reference is correctly updated to use the directly imported tokenSelectorContext.


20-20: Properly updated utility function references.

All references to getExplorerUrl and shortenAddressLong have been correctly changed to use the directly imported functions instead of accessing them through the utils namespace.

Also applies to: 72-72, 79-80, 91-92, 100-100

src/components/Dashboard/index.tsx (3)

12-12: Good refactoring from wildcard to named imports

This change improves compile time by explicitly importing only the specific utility functions needed from the @/utils module instead of importing the entire namespace. Named imports enable better tree-shaking, which helps reduce bundle size.


14-14: Good practice using named component imports

Converting from wildcard imports to specific named imports for components improves code readability and enables better tree-shaking by the bundler.


54-55: Correctly updated utility references to match import style

All references to utility functions and components have been properly updated to use the direct imports rather than accessing them through namespaces (e.g., formatDate instead of utils.formatDate), maintaining consistent usage throughout the file.

Also applies to: 60-61, 122-122, 189-189, 192-192, 225-225, 236-236

src/app/layout.tsx (2)

2-3: Good practice using named provider imports

Importing specific provider components directly instead of using wildcard imports improves compile time and enables better tree-shaking.


65-69: Correctly updated component usage to match import style

The component references in the JSX structure have been properly updated to use the direct imports, maintaining the same component hierarchy and functionality.

src/components/Cashout/CashoutStatus.tsx (2)

3-3: Good refactoring to named imports for cashout utilities

Converting from wildcard imports to specific named imports for cashout utilities and types improves code clarity and helps with compile time.


14-14: Correctly updated cashout utility references

All references to cashout utilities and types (CashoutTransaction type, getCashoutStatus function, and CashoutStatusDescriptions object) have been properly updated to use the direct imports rather than accessing them through the utils namespace.

Also applies to: 18-18, 44-44

src/components/Claim/Link/Onchain/Confirm.view.tsx (3)

9-9: Good practice using named context imports

Directly importing specific contexts instead of using wildcard imports improves code clarity and enables better tree-shaking.


11-11: Good refactoring to named imports for utility functions

Converting from wildcard imports to specific named imports for utility functions improves compile time and code readability.


32-32: Correctly updated utility and context references

All references to contexts and utility functions have been properly updated to use the direct imports rather than accessing them through namespaces. This includes context usage with useContext as well as function calls throughout the component.

Also applies to: 34-34, 70-71, 89-89, 124-124, 135-135, 139-139, 166-168, 177-177

src/components/Offramp/Confirm.view.tsx (3)

14-16: Improved import specificity enhances build optimization.

The change from wildcard imports to named imports is a good practice that will help reduce compile time and improve tree-shaking. This makes dependencies more explicit and helps the bundler eliminate unused code.


69-69: Context usage updated to match new import pattern.

Correctly updated context access to match the named imports pattern, maintaining consistent usage throughout the file.

Also applies to: 81-81


124-124: Utility function usage updated consistently throughout the file.

All utility function references have been correctly updated to use the direct imports rather than accessing them through a namespace. This change is consistent throughout this large component, which is excellent for maintainability.

Also applies to: 153-153, 199-201, 270-272, 294-301, 311-318, 358-366, 383-385, 504-521, 523-533, 547-547, 570-573, 601-602, 614-622, 641-642, 664-664, 673-680, 682-683, 701-718, 936-936, 960-960, 963-966, 973-973

src/components/Create/Link/Initial.view.tsx (2)

5-5: Refined imports improve code organization.

Good refactoring from namespace imports to specific named imports:

  • Direct import of isNumeric from validator
  • Specific import of loadingStateContext
  • Direct import of resolveFromEnsName utility
  • More targeted import of just the utils namespace from ethers

These changes align with the PR's goal of reducing compile time by making imports more explicit.

Also applies to: 13-15


34-34: Updated references to match new import pattern.

All references to imported modules have been properly updated to use the directly imported functions and objects. The changes maintain the same functionality while improving code clarity.

Also applies to: 42-42, 46-46, 120-120

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

thanks for the pr @GrandSchtroumpf
one blocking change, can you fix the merge conflicts, two files were deleted and they are now conflicting in this pr, thank you

Copy link

vercel bot commented Apr 18, 2025

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

Name Status Preview Comments Updated (UTC)
peanut-ui (peanut-wallet-staging) ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2025 4:16pm

@kushagrasarathe kushagrasarathe merged commit 7e443a7 into peanutprotocol:peanut-wallet-dev Apr 18, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants