Skip to content

Conversation

@rajanarahul93
Copy link
Contributor

@rajanarahul93 rajanarahul93 commented Apr 14, 2025

Describe the changes you have made in this PR

Added a hover-to-copy interaction on the QRCode component. When the user hovers over the QR code, a semi-transparent overlay appears with a copy icon and text prompting the user to click. On click, the QR code content is copied to the clipboard. This enhances UX by making the copy functionality more discoverable and user-friendly.

Link this PR to an issue

Fixes #2851

Type of change

  • feat: New feature (non-breaking change which adds functionality)

Screenshots of the changes [optional]

image

How has this been tested?

  • Manually tested on local development environment
  • Verified hover overlay appears correctly
  • Verified the value is copied to clipboard on click
  • Checked responsiveness across different screen sizes

Checklist

  • Self-review of changed code
  • Manual testing
  • Added automated tests where applicable
  • Update Docs & Guides
  • For UI-related changes
  • Darkmode
  • Responsive layout

@rajanarahul93
Copy link
Contributor Author

Hi @reneaaron @stackingsaunter
I'd like to request your review on this PR when you have time. Let me know if any changes are needed. Thanks!

package.json Outdated
"prepare": "husky install"
},
"dependencies": {
"@bitcoin-design/bitcoin-icons-react": "^0.1.10",
Copy link
Contributor

Choose a reason for hiding this comment

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

why new library for just one icon. we use popicons by default. and i guess copy icon should be there as well PopiconsCopyLine

import { classNames, useTheme } from "~/app/utils";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { CopyIcon } from "@bitcoin-design/bitcoin-icons-react/filled";
Copy link
Contributor

Choose a reason for hiding this comment

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

use popicons

value={lightningAddress}
size={192}
level="Q"
onCopy={() => toast.success("Copied to clipboard")}
Copy link
Contributor

Choose a reason for hiding this comment

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

why this new callback was introduced? just to show success message? can't we do same within the qr code component?

},
"website_permissions": "Website Permissions"
"website_permissions": "Website Permissions",
"qrcode": {
Copy link
Contributor

Choose a reason for hiding this comment

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

we already have copy_clipboard and copied_to_clipboard in common section of translations. always check before introducing new ones

bgColor={bgColor}
className={classNames(
"w-full h-auto rounded-md transition-opacity",
isHovering ? "opacity-80" : "opacity-100",
Copy link
Contributor

Choose a reason for hiding this comment

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

for hover why we need to use state varbiles? can use tailwind here only?

eg.
className="text-gray-600 hover: text-gray-800"

@pavanjoshi914
Copy link
Contributor

screenshot looks a bit messsy. missing translations broken ui. can you check if other elements are not effected by your ui change and update screenshots? thanks!

@rajanarahul93
Copy link
Contributor Author

Thanks for your review, @pavanjoshi914 .I’ll make the suggested changes and update the PR shortly.

@rajanarahul93
Copy link
Contributor Author

UI Enhancement: Simplified QR Code Copy Interaction

BEFORE:

  • Had overlapping copy indicators:
    1. "Copy to clipboard" text + icon on hover
    2. "Copied to clipboard" toast on click
  • Dark overlay on hover made QR code less visible
  • Multiple text elements created visual noise
    image

AFTER:

  • Clean, minimalist hover state:
    • Single copy icon with drop shadow for visibility
    • No text overlay, reducing visual clutter
    • QR code remains clearly visible with subtle opacity change
  • Single feedback mechanism:
    • Toast notification on successful copy
    • Maintains accessibility without redundant UI elements

Screenshot 2025-04-21 144409

Technical Changes:

  • Removed background overlay (bg-black bg-opacity-50)
  • Removed redundant copy text
  • Added drop-shadow-lg to icon for better contrast
  • Kept smooth opacity transitions for polish
  • Maintained clipboard functionality and toast notification

@pavanjoshi914

level={level}
/>
<div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
<PopiconsCopyLine className="h-8 w-8 text-white drop-shadow-lg" />
Copy link
Contributor

Choose a reason for hiding this comment

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

where this is used now? i don't see any apperance of this

<QRCode
value={invoice.paymentRequest.toUpperCase()}
size={512}
size={192}
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

@pavanjoshi914
Copy link
Contributor

image
hovering over this part, qr code content aint' copying.

@stackingsaunter can you please assit him in hover opacity and overlay that should be shown when user hovers the qr code. currently its not that clear visually that we can copy qr code

@rajanarahul93
Copy link
Contributor Author

@pavanjoshi914 , I will make sure the required changes are done!!

@rajanarahul93
Copy link
Contributor Author

rajanarahul93 commented Apr 23, 2025

Hi @pavanjoshi914

I've made the following changes based on your feedback:

Re-added the overlay with:

<div className="absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-20">

Reverted the QR code size back to 512:

<QRCode value={invoice.paymentRequest.toUpperCase()} size={512} />

I tried implementing the copy functionality on the icon but haven't been able to get it working yet. Still exploring possible approaches—if you have any suggestions, I’d love to hear them!

The above two changes haven't been pushed yet — I’ll push them together once the copy feature on the logo is working.

Let me know if there's anything else you'd like me to check meanwhile.

Thanks again for your review!

@rajanarahul93
Copy link
Contributor Author

@pavanjoshi914 any suggestions?

@rajanarahul93
Copy link
Contributor Author

@stackingsaunter any suggestions from you side to solve the issue?

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.

[Feature] Copy content of QR codes when clicking

2 participants