Skip to content

🎨 Palette: Add copy feedback to wallet addresses#152

Draft
Dexploarer wants to merge 1 commit intodevelopfrom
palette-copy-feedback-13139731818391130379
Draft

🎨 Palette: Add copy feedback to wallet addresses#152
Dexploarer wants to merge 1 commit intodevelopfrom
palette-copy-feedback-13139731818391130379

Conversation

@Dexploarer
Copy link
Owner

This PR improves the UX of copying wallet addresses in the header by providing immediate visual feedback.

Changes:

  • New Component: CopyButton handles the copy action and displays a temporary "copied" state with a checkmark.
  • Header Update: Replaced manual copy buttons with CopyButton.
  • Feedback: Users now see a clear indication when an address has been copied to the clipboard.

PR created automatically by Jules for task 13139731818391130379 started by @Dexploarer

- Created `CopyButton` component in `apps/app/src/components/shared/CopyButton.tsx` with visual feedback (checkmark and "copied" text).
- Updated `Header.tsx` to use `CopyButton` for EVM and Solana addresses.
- Updated `tsconfig.json` to include `bun-types` for better local testing compatibility.
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot added the ui label Feb 27, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette-copy-feedback-13139731818391130379

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 and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience by standardizing the copy-to-clipboard functionality across the application. By introducing a dedicated CopyButton component, the process of copying wallet addresses in the header now provides clear and immediate visual feedback, making interactions more intuitive and reassuring for users.

Highlights

  • New CopyButton Component: A new reusable CopyButton component has been introduced to encapsulate copy-to-clipboard logic and visual feedback.
  • Header Integration: The Header component has been updated to utilize the new CopyButton for copying EVM and Solana wallet addresses, replacing previous manual implementations.
  • Improved User Experience: Users now receive immediate visual feedback (a 'copied' state with a checkmark) when a wallet address is successfully copied to the clipboard.
  • Testing and Configuration Updates: Associated tests for the Header component were updated to account for the CopyButton integration, and tsconfig.json was adjusted to include bun-types and extend test file inclusion.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • apps/app/src/components/Header.test.tsx
    • Reordered copyToClipboard in mockUseApp to align with CopyButton dependency.
    • Removed commented-out test setup notes.
    • Added assertions to verify CopyButton components are rendered.
  • apps/app/src/components/Header.tsx
    • Imported CopyButton component.
    • Removed copyToClipboard from useApp destructuring.
    • Replaced manual copy buttons for EVM and Solana addresses with the new CopyButton component.
  • apps/app/src/components/shared/CopyButton.tsx
    • Added a new React component CopyButton to handle clipboard copying.
    • Implemented state management for visual feedback (copied state with checkmark/copy icon).
    • Styled the button to change appearance on copy success.
  • apps/app/tsconfig.json
    • Added "bun-types" to the types array.
    • Expanded the include array to include test/**/*.ts and test/**/*.tsx.
Activity
  • PR created automatically by Jules for task 13139731818391130379, started by @Dexploarer.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Comment on lines 46 to 47
// @ts-expect-error - test uses a narrowed subset of the full app context type.
vi.spyOn(AppContext, "useApp").mockReturnValue(mockUseApp);

Choose a reason for hiding this comment

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

TypeScript type assertion bypass (@ts-expect-error)

Using @ts-expect-error to bypass type checking for the mocked context (line 46) can lead to brittle tests and maintenance issues if the context shape changes. It is preferable to define a proper mock type or use partial typing to ensure type safety and reduce the risk of runtime errors.

Recommended solution:
Define a mock type for the context or use Partial<AppContextType> to avoid bypassing TypeScript checks:

const mockUseApp: Partial<AppContextType> = { ... };

Comment on lines +78 to +87
const copyButtons = root.findAll((node: ReactTestInstance) => {
return (
node.type === "button" &&
node.props["aria-label"] &&
node.props["aria-label"].startsWith("Copy")
);
});

// Should find 2 copy buttons (one for EVM, one for SOL)
expect(copyButtons.length).toBe(2);

Choose a reason for hiding this comment

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

Insufficient interaction testing for CopyButton

The test only verifies the presence of copy buttons but does not check whether the copyToClipboard function is called when the button is clicked. This misses an important behavioral aspect and reduces test coverage.

Recommended solution:
Add a test that simulates a click on the copy button and asserts that mockUseApp.copyToClipboard is called:

copyButtons[0].props.onClick();
expect(mockUseApp.copyToClipboard).toHaveBeenCalled();

/>
</div>
)}
</div>

Choose a reason for hiding this comment

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

Security: Potential Exposure of Wallet Addresses

The code displays EVM and Solana wallet addresses in the UI (lines 204-227). If the Header component is rendered for unauthenticated or unauthorized users, this could expose sensitive information. Ensure that only authorized users can access this component or that wallet addresses are not displayed unless the user is authenticated.

Recommended Solution:

  • Confirm that the parent application enforces authentication and authorization before rendering this component.
  • If not, add explicit checks to prevent wallet address exposure to unauthorized users.

Comment on lines +19 to +24
const handleCopy = async (e: React.MouseEvent) => {
e.stopPropagation();
await copyToClipboard(value);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};

Choose a reason for hiding this comment

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

The handleCopy function does not handle errors from the asynchronous copyToClipboard operation. If the clipboard operation fails, the UI will still indicate success, which is misleading. Consider wrapping the clipboard call in a try/catch block and providing user feedback on failure:

try {
  await copyToClipboard(value);
  setCopied(true);
  setTimeout(() => setCopied(false), 2000);
} catch (err) {
  // Optionally set an error state or notify the user
}

e.stopPropagation();
await copyToClipboard(value);
setCopied(true);
setTimeout(() => setCopied(false), 2000);

Choose a reason for hiding this comment

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

The use of setTimeout to reset the copied state does not account for the component unmounting before the timeout fires. This can lead to a memory leak or React warning about setting state on an unmounted component. To address this, clear the timeout in a useEffect cleanup function or use a ref to track mounted state.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a CopyButton component to provide visual feedback when copying wallet addresses, which is a great UX improvement. The implementation is clean and effectively refactors the Header component.

I've left a couple of suggestions:

  • In CopyButton.tsx, I've pointed out a potential memory leak with setTimeout and suggested using useEffect for proper cleanup.
  • In tsconfig.json, I've noted a small improvement to keep the configuration tidy.

Overall, great work on improving the user experience.

Comment on lines +19 to +24
const handleCopy = async (e: React.MouseEvent) => {
e.stopPropagation();
await copyToClipboard(value);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};

Choose a reason for hiding this comment

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

medium

This implementation has a potential memory leak. If the CopyButton component unmounts before the 2-second timeout completes, setCopied(false) will be called on an unmounted component. This causes a React warning and is not best practice.

To fix this, you should manage the timer with a useEffect hook. This provides a cleanup function to clear the timeout when the component unmounts.

Here's a suggested refactoring (you'll also need to import useEffect from react):

  useEffect(() => {
    if (!copied) return;

    const timerId = setTimeout(() => {
      setCopied(false);
    }, 2000);

    return () => clearTimeout(timerId);
  }, [copied]);

  const handleCopy = async (e: React.MouseEvent) => {
    e.stopPropagation();
    await copyToClipboard(value);
    setCopied(true);
  };

"types": ["vite/client", "bun-types"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],

Choose a reason for hiding this comment

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

medium

The test file Header.test.tsx is located inside the src/components directory, which is already covered by the "src/**/*.tsx" pattern. The addition of "test/**/*.ts" and "test/**/*.tsx" seems unnecessary if there isn't a separate test directory at the root of the apps/app project.

To keep the configuration clean, you could remove the added test paths.

Suggested change
"include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
"include": ["src/**/*.ts", "src/**/*.tsx"],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant