Skip to content

fix(admin): add copy action for Original translations on translations edit page#14943

Open
LukasKri wants to merge 8 commits intomedusajs:developfrom
LukasKri:feat/adds-copy-button-for-translations-ui
Open

fix(admin): add copy action for Original translations on translations edit page#14943
LukasKri wants to merge 8 commits intomedusajs:developfrom
LukasKri:feat/adds-copy-button-for-translations-ui

Conversation

@LukasKri
Copy link
Copy Markdown
Contributor

@LukasKri LukasKri commented Mar 25, 2026

Summary

What — What changes are introduced in this PR?

  • Added copy support for Original values in:
    • packages/admin/dashboard/src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx
  • Imported and used Copy from @medusajs/ui inside the original column cell renderer.
  • Rendered original text and a mini copy button side-by-side.
  • Displayed copy button only when original value is non-empty.

Why — Why are these changes relevant or necessary?

  • Improves translator workflow by enabling one-click copy from source text.
  • Avoids manual text selection friction in read-only DataGrid cells.

How — How have these changes been implemented?

  • Route-scoped change only in translations edit form (no shared DataGrid changes).
  • In original field rows:
    • compute originalValue safely,
    • render <Copy variant="mini" content={originalValue} className="cursor-pointer" />.
  • Entity/group rows remain unchanged.

Additional TypeScript cleanup included

  • Resolved schema/type naming collisions in the same file:
    • EntityTranslationsSchema (type alias) → EntityTranslations
    • TranslationsFormSchema (type alias) → TranslationsForm
  • Updated all type references accordingly.
  • Fixed TS typing mismatch for references:
    • introduced TranslationReference ({ id: string; [key: string]: unknown })
    • updated relevant function/prop signatures to use this type
  • Runtime behavior unchanged.

Testing — How have these changes been tested, or how can the reviewer test the feature?

  • Manual (ran local @medusajs/dashboard build with local admin setup):
    1. Open /app/settings/translations/edit?reference=product.
    2. Verify copy action appears in Original cells with content.
    3. Click copy and paste into translation input / external translator tool.
    4. Verify rows without original content do not show copy action.
    5. Verify other admin DataGrid pages are unaffected.
image image

Closes #14942


Note

Low Risk
Low risk UI-only change within the translations edit grid; main risk is minor layout/typing regressions in this route component.

Overview
Adds a copy-to-clipboard action to the Original column in the translations edit DataGrid, rendering a mini Copy button next to non-empty source text.

Includes small TypeScript cleanup in the same component: renames inferred schema types to avoid naming collisions and broadens references typing via a new TranslationReference type, updating related function/prop signatures accordingly.

Written by Cursor Bugbot for commit c4b6e71. This will update automatically on new commits. Configure here.

… TranslationsForm to avoid variable name duplication - fixes TS errors:

- "'TranslationsFormSchema' is already defined."
- "'EntityTranslationsSchema' is already defined."
…rence for better type clarity and fix TS error of "Type '{ [x: string]: unknown; id: string; }[]' is not assignable to type '{ [key: string]: string; id: string; }[]'.

  Type '{ [x: string]: unknown; id: string; }' is not assignable to type '{ [key: string]: string; id: string; }'.
    'string' index signatures are incompatible.
      Type 'unknown' is not assignable to type 'string'."
@LukasKri LukasKri requested a review from a team as a code owner March 25, 2026 21:07
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

⚠️ No Changeset found

Latest commit: 031cd20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

@LukasKri is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 27, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@medusa-os-bot
Copy link
Copy Markdown

medusa-os-bot bot commented Apr 9, 2026

Thank you for your contribution!

After reviewing this PR, we need a few things addressed before we can move forward:

Required changes:

  • Missing changeset — this PR modifies source code under packages/, so a changeset file is required. Please run yarn changeset from the repo root and follow the prompts. The message should use the format fix(dashboard): <short description> and the bump type should be patch.

Concerns:

The How section of the PR description states "Route-scoped change only in translations edit form (no shared DataGrid changes)", but the diff includes changes to two shared DataGrid files:

  • packages/admin/dashboard/src/components/data-grid/components/data-grid-root.tsx (+1)
  • packages/admin/dashboard/src/components/data-grid/hooks/use-data-grid-clipboard-events.tsx (+32/-3)

Could you clarify what was changed in these files and why? If those changes are necessary for the feature, please update the PR description to reflect them accurately.

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.

[Bug]: Admin Translations - add copy action for “Original” values in /settings/translations/edit

1 participant