Skip to content

fix(UserMenu): add copy address feedback toast notification - #567

Open
Samuelaladesiun3334 wants to merge 1 commit into
Fundable-Protocol:mainfrom
Samuelaladesiun3334:fix/396-usermenu-copy-address-toast
Open

fix(UserMenu): add copy address feedback toast notification#567
Samuelaladesiun3334 wants to merge 1 commit into
Fundable-Protocol:mainfrom
Samuelaladesiun3334:fix/396-usermenu-copy-address-toast

Conversation

@Samuelaladesiun3334

@Samuelaladesiun3334 Samuelaladesiun3334 commented Jul 29, 2026

Copy link
Copy Markdown

Closes #396

Problem

Clicking "Copy Address" in the wallet dropdown provided no visual feedback — the user had no way to confirm the address was copied to clipboard.

Solution

Created apps/web/src/components/molecules/UserMenu.tsx as a dedicated molecule component encapsulating the wallet dropdown. The handleCopyAddress handler (lines 30–45) calls navigator.clipboard.writeText, shows toast.success("Address copied to clipboard") on success, and toast.error("Failed to copy address") on failure. A Check icon replaces the Copy icon for 2 seconds after a successful copy as additional inline feedback.

connect-button.tsx is refactored to render <UserMenu /> instead of the previous inline dropdown.

Changes

File Change
apps/web/src/components/molecules/UserMenu.tsx New — UserMenu molecule with copy address + toast feedback
apps/web/src/components/organisms/connect-button.tsx Refactored to use <UserMenu />

Behaviour

  • Copy Address → toast.success fires, Check icon shows for 2 s
  • Clipboard API failure → toast.error fires
  • Disconnect works as before — no regression

Summary by CodeRabbit

  • New Features

    • Added an animated wallet menu for connected accounts.
    • Users can copy their wallet address with confirmation feedback.
    • Added a disconnect action to the wallet menu.
    • Improved menu accessibility with labels and menu roles.
  • Refactor

    • Streamlined the connected-wallet dropdown experience.

- Create UserMenu molecule component at apps/web/src/components/molecules/UserMenu.tsx
- Implement handleCopyAddress (lines 30-45) using navigator.clipboard.writeText
- Show toast.success on copy, toast.error on failure
- Toggle Check icon for 2s after successful copy for inline feedback
- Refactor connect-button.tsx to render <UserMenu /> instead of inline dropdown

Closes Fundable-Protocol#396
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Samuelaladesiun3334 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The connected-wallet dropdown is extracted into a client-side UserMenu component. It provides animated rendering, address copying with toast feedback, accessibility attributes, and disconnect handling, while ConnectButton supplies the required wallet state and callbacks.

Changes

Wallet menu flow

Layer / File(s) Summary
UserMenu behavior
apps/web/src/components/molecules/UserMenu.tsx
Defines the menu props and renders the animated wallet dropdown with formatted address, clipboard copy feedback, success/error toasts, accessibility attributes, and disconnect handling.
ConnectButton integration
apps/web/src/components/organisms/connect-button.tsx
Replaces the inline dropdown with UserMenu and passes the address, formatted address, open state, and disconnect callback.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ConnectButton
  participant UserMenu
  participant Clipboard
  participant Toast

  User->>ConnectButton: Open wallet menu
  ConnectButton->>UserMenu: Pass wallet state and callbacks
  User->>UserMenu: Select Copy Address
  UserMenu->>Clipboard: Copy full address
  Clipboard-->>UserMenu: Return copy result
  UserMenu->>Toast: Show success or error notification
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive Issue #396 appears addressed by adding copy-success/error toast feedback in UserMenu, but test-suite nonregression cannot be verified from the summary. Provide test results or CI evidence showing existing suites still pass after the UserMenu refactor.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding copy-address feedback in UserMenu.
Out of Scope Changes check ✅ Passed The UserMenu extraction and connect-button refactor are part of the stated PR objectives, so no unrelated changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/components/molecules/UserMenu.tsx`:
- Around line 35-38: Update the copy handler in UserMenu to store the reset
timer in a ref, clear any existing timer before scheduling the two-second
setCopied(false) reset, and clean up that timer on component unmount so each
successful copy keeps its confirmation visible for the full duration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 97c7c166-d203-4124-8c48-8e2d48c764e2

📥 Commits

Reviewing files that changed from the base of the PR and between 375c936 and 3dbc4d7.

📒 Files selected for processing (2)
  • apps/web/src/components/molecules/UserMenu.tsx
  • apps/web/src/components/organisms/connect-button.tsx

Comment on lines +35 to +38
setCopied(true);
toast.success("Address copied to clipboard");
// Reset the icon back to Copy after 2 s
setTimeout(() => setCopied(false), 2000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep feedback visible for two seconds after the latest copy.

Line 38 leaves earlier reset timers active. If users copy again within two seconds, the first timer clears copied early, so the latest successful copy does not receive the promised two-second confirmation. Keep one timer in a ref, clear it before rescheduling, and clean it up on unmount.

Proposed fix
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
...
   const [copied, setCopied] = useState(false);
+  const resetCopyTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+  useEffect(() => {
+    return () => {
+      if (resetCopyTimer.current) clearTimeout(resetCopyTimer.current);
+    };
+  }, []);
...
       setCopied(true);
       toast.success("Address copied to clipboard");
-      // Reset the icon back to Copy after 2 s
-      setTimeout(() => setCopied(false), 2000);
+      if (resetCopyTimer.current) clearTimeout(resetCopyTimer.current);
+      resetCopyTimer.current = setTimeout(() => {
+        setCopied(false);
+        resetCopyTimer.current = null;
+      }, 2000);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setCopied(true);
toast.success("Address copied to clipboard");
// Reset the icon back to Copy after 2 s
setTimeout(() => setCopied(false), 2000);
setCopied(true);
toast.success("Address copied to clipboard");
if (resetCopyTimer.current) clearTimeout(resetCopyTimer.current);
resetCopyTimer.current = setTimeout(() => {
setCopied(false);
resetCopyTimer.current = null;
}, 2000);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/components/molecules/UserMenu.tsx` around lines 35 - 38, Update
the copy handler in UserMenu to store the reset timer in a ref, clear any
existing timer before scheduling the two-second setCopied(false) reset, and
clean up that timer on component unmount so each successful copy keeps its
confirmation visible for the full duration.

@Idrhas

Idrhas commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

dont forget to offramp using https://stellar.fundable.finance/offramp its fast, free and p2p rates

2 similar comments
@Idrhas

Idrhas commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

dont forget to offramp using https://stellar.fundable.finance/offramp its fast, free and p2p rates

@Idrhas

Idrhas commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

dont forget to offramp using https://stellar.fundable.finance/offramp its fast, free and p2p rates

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.

web(UserMenu): add copy address feedback toast notification

3 participants