Skip to content

Conversation

Nabhag8848
Copy link
Contributor

@Nabhag8848 Nabhag8848 commented Jul 22, 2025

as discussed here #13292 (comment) with @prastoin

  • introduce optional message param to copyToClipboard method in useCopyToClipboard 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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:

  1. Adds an optional message parameter to the copyToClipboard method to allow for context-specific success messages
  2. Implements proper error handling for cases where users have disabled clipboard permissions in their browser
  3. Consolidates clipboard operations across the application to use this centralized hook
  4. 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

  1. This PR is safe to merge as it adds defensive programming without changing core functionality
  2. The changes are focused on error handling and user feedback, with no risk to existing clipboard operations
  3. 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

Edit Code Review Bot Settings | Greptile

@Nabhag8848 Nabhag8848 marked this pull request as draft July 22, 2025 09:13
Copy link
Contributor

github-actions bot commented Jul 22, 2025

🚀 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.

@Nabhag8848 Nabhag8848 force-pushed the refactor/clipboard-access branch from 7bc1d95 to 46e988c Compare July 23, 2025 10:40
@Nabhag8848 Nabhag8848 marked this pull request as ready for review July 23, 2025 10:56
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

  1. This PR is not safe to merge as it will break the user experience for all Russian-speaking users
  2. The confidence score is 1/5 because the Russian locale file is completely empty, which will cause missing translations across the entire application
  3. 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

Edit Code Review Bot Settings | Greptile

#. js-lingui-id: UZQ5eW
#: src/modules/object-record/record-field/meta-types/input/components/EmailsFieldInput.tsx
msgid "Email copied to clipboard"
msgstr ""
Copy link
Contributor

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

@Nabhag8848
Copy link
Contributor Author

Nabhag8848 commented Jul 23, 2025

ready for review !

edit: I see we have github action for translation catalog extraction, have made the changes accordingly

@Nabhag8848 Nabhag8848 force-pushed the refactor/clipboard-access branch from 0e76deb to dc7228f Compare July 25, 2025 09:03
Copy link
Contributor

@prastoin prastoin left a 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} />,
Copy link
Contributor

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

@prastoin prastoin merged commit 316f2ec into twentyhq:main Jul 30, 2025
51 checks passed
Copy link
Contributor

Thanks @Nabhag8848 for your contribution!
This marks your 29th PR on the repo. You're top 2% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

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

Successfully merging this pull request may close these issues.

2 participants