Skip to content
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: adds ability to copy data from across locales #8203

Merged
merged 79 commits into from
Nov 26, 2024

Conversation

JessChowdhury
Copy link
Member

@JessChowdhury JessChowdhury commented Sep 13, 2024

What?

Adds ability to copy data from one locale to another at a document level.

Feature request can be found here.

[Internal] Design here.

How?

For any localized collection, you will find a new option in the document controls called Copy to Locale.
Screenshot 2024-11-22 at 11 16 21 AM

This option will open a drawer, from here you can select your origin and destination locales.
Screenshot 2024-11-22 at 11 16 40 AM

If data already exists in the destination locale, you can choose to:

  1. Overwrite this data (this will copy any empty fields in your origin locale)
  2. Not overwrite existing data (this will only copy data into empty fields in the destination locale)

You can change your selection using the following checkbox:
Screenshot 2024-11-22 at 11 17 05 AM

Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

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

Looks good other than the error handling and translation todo. Nice work!

packages/ui/src/elements/CopyLocaleData/index.tsx Outdated Show resolved Hide resolved
packages/ui/src/elements/CopyLocaleData/index.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

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

I was going ot merge this but then I noticed there are a handful of missing translations to fix.
unsavedChanges: undefined,

Do you want to take care of that before I merge?

@JessChowdhury
Copy link
Member Author

I was going ot merge this but then I noticed there are a handful of missing translations to fix. unsavedChanges: undefined,

Do you want to take care of that before I merge?

@DanRibbens undefined translations have been fixed 👍

@denolfe denolfe self-assigned this Oct 9, 2024
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

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

I tried to test the feature with blocks and it errored for me.
This was taken from our test/localization suite working with the Nested Arrays collection.
image
I'm not sure if this is because the collection has versions enabled or if it was nested data that couldn't be handled.

Aside from this, I have UX concerns about this feature as it would be too easy for a user to click the wrong locale and overwrite some existing data. It feels to me like we should have a modal or something to add an additional step for acknowledging that they might be overwriting everything in a document on the target locale.

The copy button should look more like a secondary actions with dropdown options like this:
image

@denolfe denolfe removed the v3 label Nov 19, 2024
@JarrodMFlesch JarrodMFlesch self-assigned this Nov 26, 2024
@JarrodMFlesch JarrodMFlesch dismissed DanRibbens’s stale review November 26, 2024 22:05

copy button appears and was moved into actions popup

@JarrodMFlesch JarrodMFlesch merged commit 601759d into main Nov 26, 2024
53 checks passed
@JarrodMFlesch JarrodMFlesch deleted the feat/copy-locale-data branch November 26, 2024 22:06
Copy link

🚀 This is included in version v3.2.0

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.

4 participants