fix receive modal closing and copy address#317
Conversation
WalkthroughThe code refactors the click-outside-to-close logic in the ReceiveModal component by replacing a global event listener with localized event handling on the modal's outermost div. Corresponding tests are updated to target the modal container directly when simulating outside clicks. The CopyToClipboard usage within the modal is also streamlined for simpler JSX structure. Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm warn config production Use ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/apps/pillarx-app/components/ReceiveModal/ReceiveModal.tsx (1)
92-124: Verify the UX change in CopyToClipboard behavior.The refactoring changes the copy functionality from icon-only to entire container clickability. This is a significant UX change where users can now click anywhere in the address container to copy, not just the copy icon.
Additionally, the
stopPropagation()on the copy icon (line 119) may be redundant since the entire container is now wrapped inCopyToClipboard.Please verify:
- Is the expanded clickable area for copying intentional?
- Consider removing the
stopPropagation()on line 119 since it may no longer be necessary:<img src={CopyIcon} alt="copy-evm-address" className="w-3 h-3.5" - onClick={(e) => e.stopPropagation()} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (2)
src/apps/pillarx-app/components/ReceiveModal/ReceiveModal.tsx(2 hunks)src/apps/pillarx-app/components/ReceiveModal/test/ReceiveModal.test.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: lint
- GitHub Check: unit-tests
- GitHub Check: build
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
src/apps/pillarx-app/components/ReceiveModal/ReceiveModal.tsx (2)
68-69: LGTM! Improved event handling approach.The change from global event listener to localized
onMouseDownhandler is a good improvement. It's more contained, easier to manage, and avoids potential memory leaks from global listeners.
75-75: Correct implementation of event propagation control.The
stopPropagation()call properly prevents the modal from closing when clicking inside the modal content, which is the expected behavior.src/apps/pillarx-app/components/ReceiveModal/test/ReceiveModal.test.tsx (1)
149-152: Excellent test update aligned with component changes.The test correctly targets the modal container using
data-testidinstead of the global document, which properly aligns with the refactored event handling approach in the component.
Deploying x with
|
| Latest commit: |
06e8882
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8f8a5a02.x-e62.pages.dev |
| Branch Preview URL: | https://feat-pro-3182-portfolio-tile.x-e62.pages.dev |
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit
Refactor
Tests