-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: Add "copy to clipboard" feature #1521
base: master
Are you sure you want to change the base?
FEAT: Add "copy to clipboard" feature #1521
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1521 +/- ##
==========================================
- Coverage 71.42% 71.37% -0.05%
==========================================
Files 364 364
Lines 6708 6714 +6
Branches 474 474
==========================================
+ Hits 4791 4792 +1
- Misses 1527 1532 +5
Partials 390 390
☔ View full report in Codecov by Sentry. |
const CopyTextToClipboard = async () => { | ||
const track_element = document.getElementById('track_name'); | ||
try { | ||
await navigator.clipboard.writeText(track_element.innerHTML); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be done this way in React. Instead, you can get the title from the redux store.
try { | ||
await navigator.clipboard.writeText(track_element.innerHTML); | ||
} catch (err) { | ||
console.error('Failed to copy: ', err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use console.error, instead you can show a notification toast.
Hi, thanks for the pull request. Please check the contribution guidelines: https://nukeop.gitbook.io/nuclear/contributing/contribution-guidelines There are a few things missing but I'm sure if we iterate on it we can get it into a good shape.
|
Logs:
2023-11-02.08-33-53.mp4It would be cool to add a notification toast. |
In this pull request, users can now able to copy the song title to the clipboard by simply clicking on its name.
Fixes #1516
Demonstration Video
https://github.com/nukeop/nuclear/assets/75296055/87a86b75-63bc-47b8-90b4-9343f09a010a