Skip to content

[Google translate] Add a preference for the default action#12078

Merged
pernielsentikaer merged 10 commits intoraycast:mainfrom
Popalay:google-translate-default-action
May 2, 2024
Merged

[Google translate] Add a preference for the default action#12078
pernielsentikaer merged 10 commits intoraycast:mainfrom
Popalay:google-translate-default-action

Conversation

@Popalay
Copy link
Contributor

@Popalay Popalay commented Apr 29, 2024

Description

This PR adds the ability to specify the default action for the translation:

  • Copy to Clipboard (default)
  • Paste to App

Screencast

Screenshot 2024-04-29 at 18 56 51
Screenshot 2024-04-29 at 18 57 22

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: google-translate Issues related to the google-translate extension labels Apr 29, 2024
@raycastbot
Copy link
Collaborator

raycastbot commented Apr 29, 2024

Thank you for your contribution! 🎉

🔔 @gebeto @FezVrasta @ickas @metakirby5 @tangerine1202 @nirtamir2 @pernielsentikaer @rasitayaz you might want to have a look.

@Popalay Popalay changed the title [Google translator] Add a preference for the default action [Google translate] Add a preference for the default action Apr 29, 2024
@Popalay Popalay force-pushed the google-translate-default-action branch from 3be18b6 to 6bfd2e5 Compare April 29, 2024 16:05
Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Hi 👋

Thanks for your contribution 💪

I have now tested your extension, and I have some feedback ready for you 🙂

"include": ["src/**/*", "raycast-env.d.ts"],

I'm looking forward to testing this extension again 🔥

Request a new review when you are ready. Feel free to contact me here or at Slack if you have any questions.

@pernielsentikaer pernielsentikaer self-assigned this Apr 30, 2024
Copy link
Contributor

@gebeto gebeto left a comment

Choose a reason for hiding this comment

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

let's merge it only after proper refactoring

@Popalay Popalay force-pushed the google-translate-default-action branch from 53f6619 to 8651980 Compare April 30, 2024 10:47
Copy link
Contributor

@gebeto gebeto left a comment

Choose a reason for hiding this comment

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

this is a last thing 😅 Looks great!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gebeto Just curious why it's needed here?

Copy link
Contributor

@gebeto gebeto Apr 30, 2024

Choose a reason for hiding this comment

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

<></> is a shorthand for <React.Fragment></React.Fragment>, when we are assigning the key, we need to use React.Fragment, because we can't do <key={index}>

we need a key right on fragment here because it is an element that we are returning from the map. Key was used on nested elements before, and you could see an error in the console:
Screenshot 2024-04-30 at 13 52 02

More details about key you can get in official react docs here: https://react.dev/learn/rendering-lists
And here is also more details about Fragments and keys: https://react.dev/reference/react/Fragment#rendering-a-list-of-fragments

long story short - key should be applied to the root element which is returning from the map, in this case it is a Fragment

Minor code style fixes.
@Popalay Popalay force-pushed the google-translate-default-action branch from 8651980 to 0c64e0d Compare April 30, 2024 10:51
@gebeto
Copy link
Contributor

gebeto commented Apr 30, 2024

@pernielsentikaer I think we are good to merge here 🙌

@pernielsentikaer pernielsentikaer merged commit acc026b into raycast:main May 2, 2024
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2024

Published to the Raycast Store:
https://raycast.com/gebeto/translate

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

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

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: google-translate Issues related to the google-translate extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants