Skip to content

feat: update claim guest flow ui cta's#749

Merged
kushagrasarathe merged 2 commits intopeanut-wallet-devfrom
fix/claim-guest-ui
Mar 19, 2025
Merged

feat: update claim guest flow ui cta's#749
kushagrasarathe merged 2 commits intopeanut-wallet-devfrom
fix/claim-guest-ui

Conversation

@kushagrasarathe
Copy link
Copy Markdown
Contributor

@kushagrasarathe kushagrasarathe commented Mar 19, 2025

contributes to TASK-9324

Summary by CodeRabbit

  • New Features
    • Enhanced the user interface for connecting wallets and logging in.
    • Introduced conditional buttons that display options for direct login, external wallet connection, and new account creation.
    • Improved visual feedback with clearer separation of action areas using dividers and updated button states to guide users through the process.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 2025

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

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2025 6:35pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 19, 2025

Walkthrough

This pull request refactors the InitialClaimLinkView component. It introduces new imports for UI elements and hooks, including Divider, useToast, Link, and useRouter. The component now integrates the useZeroDev hook for managing login states and the useAppKit hook to open an external wallet modal. Conditional rendering has been updated to display login, wallet connection, and account creation prompts based on the user’s state, with adjustments made to the button logic handling claim actions.

Changes

File(s) Change Summary
src/components/Claim/Link/Initial.view.tsx Added imports for Divider, useToast, Link, and useRouter. Integrated useZeroDev and useAppKit hooks. Updated rendering logic to conditionally show login, external wallet connection, and claim buttons, and added a Peanut account prompt.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant View as InitialClaimLinkView
    participant ZeroDev as useZeroDev()
    participant AppKit as useAppKit()

    User->>View: Opens claim view
    alt Not logged in & wallet not connected
        View->>User: Display "Login" button and "Connect Wallet" option
        User->>View: Click "Login"
        View->>ZeroDev: Call handleLogin()
        ZeroDev-->>View: Return login state
        View->>User: Update UI to show claim action
    else Logged in/Wallet connected
        View->>User: Display claim button
    end
    alt External wallet connection invoked
        User->>View: Click "Connect External Wallet"
        View->>AppKit: Call openReownModal()
        AppKit-->>View: Modal opened response
    end
Loading

Possibly related PRs

Suggested reviewers

  • jjramirezn

Poem

I'm a bunny, hopping with delight,
Watching code bloom in the light.
New hooks and buttons, a joyful sight,
Wallets and logins now work just right.
Claim flows and modals, our code takes flight! 🐰✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@notion-workspace
Copy link
Copy Markdown

Copy link
Copy Markdown
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/Claim/Link/Initial.view.tsx (1)

629-633: Add error message clarity for login failures.

The error handling for login catches exceptions but displays a generic "Error logging in" message.

Consider providing more specific error messages when possible:

handleLogin().catch((e) => {
-   toast.error('Error logging in')
+   toast.error(e instanceof Error ? `Login failed: ${e.message}` : 'Error logging in')
    Sentry.captureException(e)
})
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6e51b3a and 1bda28f.

📒 Files selected for processing (1)
  • src/components/Claim/Link/Initial.view.tsx (6 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/components/Claim/Link/Initial.view.tsx (1)
src/constants/zerodev.consts.ts (1) (1)
  • PEANUT_WALLET_CHAIN (17-17)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (8)
src/components/Claim/Link/Initial.view.tsx (8)

4-5: Good addition of UI components for enhanced user experience.

The addition of Divider and useToast components from Bruddle helps improve both the visual separation of options and provide feedback to users, making the interface more user-friendly.


26-26: Appropriate imports for new functionality.

The imports of useZeroDev, useAppKit, Link, and useRouter properly support the new login flow and navigation capabilities being added to the component.

Also applies to: 44-44, 47-48


77-80: Good use of hooks for enhanced functionality.

The router, toast, and ZeroDev hooks are well utilized to support navigation, user feedback, and login functionality.


89-89: Good integration with external wallet connection.

The useAppKit hook's modal opener is properly extracted for connecting external wallets.


623-650: Well-structured login options for users.

The new conditional rendering block provides clear options for users who aren't logged in:

  1. Sign in with Peanut Wallet
  2. Set up a new Peanut Wallet
  3. Connect an external wallet

The use of a divider between the options improves visual organization.


652-682: Improved button logic with better state handling.

The claim button implementation now properly handles:

  • Different wallet states (Peanut vs external)
  • Chain compatibility checks
  • Various recipient types (wallet addresses vs bank accounts)
  • Loading and disabled states

This creates a more robust user experience with appropriate feedback.


684-691: Good user conversion prompting.

The new section that encourages users to create a Peanut account when they're connected but not logged in is a good conversion strategy that doesn't interfere with the primary claim action.


667-674: Comprehensive disabled state checks.

The button disabled conditions properly handle all relevant states, preventing users from performing actions in invalid states.

Copy link
Copy Markdown
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/Claim/Link/Initial.view.tsx (1)

633-637: Add more specific error handling for login failures.

Currently, the error message is generic ("Error logging in"). Consider providing more specific error information when possible to help users troubleshoot issues.

-handleLogin().catch((e) => {
-    toast.error('Error logging in')
-    Sentry.captureException(e)
-})
+handleLogin().catch((e) => {
+    const errorMessage = e?.message || 'Error logging in'
+    toast.error(errorMessage.includes('technical error') ? 'Error logging in' : errorMessage)
+    Sentry.captureException(e)
+})
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1bda28f and 7ac62bb.

📒 Files selected for processing (1)
  • src/components/Claim/Link/Initial.view.tsx (7 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/components/Claim/Link/Initial.view.tsx (2)
src/utils/general.utils.ts (1) (1)
  • saveToLocalStorage (93-104)
src/constants/zerodev.consts.ts (1) (1)
  • PEANUT_WALLET_CHAIN (17-17)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (8)
src/components/Claim/Link/Initial.view.tsx (8)

4-5: The new imports enhance the component's functionality.

The added imports provide necessary UI components (Divider), user feedback mechanisms (Toast), navigation capabilities (Link, Router), and authentication/wallet functionality (useZeroDev, useAppKit). These additions properly support the updated claim flow UI.

Also applies to: 26-26, 44-44, 47-48


77-80: The added hooks provide required functionality for the enhanced UI.

The router for navigation, toast for user feedback, and the ZeroDev hook for handling login states are appropriately implemented. This setup enables proper user flows when claiming links with different wallet states.


89-89: AppKit integration enables external wallet connections.

The useAppKit hook is properly utilized to access the open method for the external wallet modal, which complements the login options.


133-133: Good enhancement to save the redirect URL before wallet connection.

Adding the call to saveRedirectUrl() ensures users will be returned to the claim page after connecting their wallet.


138-141: Well-implemented redirect URL storage function.

The function correctly captures the current URL (including pathname, search parameters, and hash) and saves it to localStorage using the existing utility function. This provides a smooth user experience by returning users to their original location after authentication.


627-659: Clear login options improve the user experience.

The new UI section provides multiple clear pathways for users without a connected wallet:

  1. Sign in with Peanut Wallet (with proper loading state)
  2. Get a new Peanut Wallet (with redirect URL saving)
  3. Connect an external wallet through the AppKit

The visual separation with the divider enhances readability and guides users through their options.


660-690: Button logic properly handles various claim scenarios.

The refactored button includes appropriate conditions for:

  1. Cross-chain claims for Peanut Wallet users
  2. IBAN or US bank account recipients
  3. Routes that have been fetched
  4. Direct claims

The loading and disabled states prevent invalid actions during processing and when required data is missing.


692-703: Effective user acquisition prompt for non-account holders.

The addition of a prompt encouraging connected users to create a Peanut account is strategically placed after the main action. This encourages account creation without blocking the primary claim functionality.

@kushagrasarathe kushagrasarathe merged commit cddb902 into peanut-wallet-dev Mar 19, 2025
5 checks passed
This was referenced Mar 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Apr 18, 2025
@Hugo0 Hugo0 deleted the fix/claim-guest-ui branch July 3, 2025 18:24
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.

1 participant