-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactor: to useCopyToClipboard to catch errors - when user has disable copy clipboard permission in browser #13330
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
Conversation
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.
Greptile Summary
This PR introduces better error handling for clipboard operations by refactoring the useCopyToClipboard
hook. The main changes:
- Adds an optional
message
parameter to thecopyToClipboard
method to allow for context-specific success messages - Implements proper error handling for cases where users have disabled clipboard permissions in their browser
- Consolidates clipboard operations across the application to use this centralized hook
- Updates all locale files to remove the generic "Copied to clipboard!" message in favor of context-specific messages
The refactoring improves the user experience by providing better feedback when clipboard operations fail due to permission issues, while maintaining the existing functionality when permissions are granted.
Confidence score: 5/5
- This PR is safe to merge as it adds defensive programming without changing core functionality
- The changes are focused on error handling and user feedback, with no risk to existing clipboard operations
- The files that need attention are:
- packages/twenty-front/src/hooks/useCopyToClipboard.tsx (core functionality)
- Components using direct clipboard API calls (to ensure they've been migrated to the hook)
41 files reviewed, 4 comments
packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOSAMLForm.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOOIDCForm.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOOIDCForm.tsx
Show resolved
Hide resolved
...odules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
Show resolved
Hide resolved
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:46880 This environment will automatically shut down when the PR is closed or after 5 hours. |
7bc1d95
to
46e988c
Compare
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.
Greptile Summary
This PR addresses the missing Russian translations that resulted from the clipboard functionality refactor. The ru-RU.po
file was completely emptied during the lingui extract
process, which removed all Russian translations for the application. This is a critical issue that needs immediate attention as Russian users will see untranslated UI text throughout the application.
The refactor introduced new clipboard-related translation strings like 'Email copied to clipboard', 'Copied to clipboard', and 'Couldn't copy to clipboard' that require Russian translations. However, the extraction process appears to have cleared the entire Russian locale file instead of properly updating it with the new strings while preserving existing translations.
Confidence score: 1/5
- This PR is not safe to merge as it will break the user experience for all Russian-speaking users
- The confidence score is 1/5 because the Russian locale file is completely empty, which will cause missing translations across the entire application
- The file that needs immediate attention is
packages/twenty-front/src/locales/ru-RU.po
- it needs to be restored with proper Russian translations for all application strings, not just the new clipboard-related ones
44 files reviewed, 1 comment
#. js-lingui-id: UZQ5eW | ||
#: src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx | ||
msgid "Email copied to clipboard" | ||
msgstr "" |
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.
style: Korean translation is missing for the new 'Email copied to clipboard' message
ready for review ! edit: I see we have github action for translation catalog extraction, have made the changes accordingly |
0e76deb
to
dc7228f
Compare
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.
Hey there, that's a very good refactor
Thanks a lot for the good work !
enqueueSuccessSnackBar({ | ||
message: t`Copied to clipboard!`, | ||
options: { | ||
icon: <IconCopy size={theme.icon.size.md} />, |
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.
Remark: default duration value might differ from 2000, but anw that's a good standardizatin to have here
Thanks @Nabhag8848 for your contribution! |
as discussed here #13292 (comment) with @prastoin
introduce optional message param to
copyToClipboard
method inuseCopyToClipboard
and refactor it across app, as in case if user has disallowed clipboard permission in BROWSER unprotected clipboard access breaks without catch.Email copied to clipboard
run lingui extract