Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

Summary

Successfully implemented the "Attach all variables" feature for the Manage themes dialog as requested.

Completed Tasks

  • Explore repository structure and understand the "Attach local variables" feature
  • Identify key components: ManageThemesModal, ThemeVariableManagement, ThemeStyleManagementCategory
  • Understand the async message handler attachLocalVariablesToTheme
  • Test build and run tests to verify baseline
  • Create new "Attach all variables" button in ManageThemesModal footer
  • Implement logic to iterate through all themes and attach variables
  • Add loading state to the new button
  • Add loading prop to existing "Attach local variables" button in ThemeVariableManagement
  • Add loading prop to existing "Attach local styles" button in ThemeStyleManagementCategory
  • Test the implementation - build and tests pass (10/10 tests)
  • Run linter and fix any issues - no issues found
  • Create changeset as required
  • Add tests for the new feature
  • Code review - no issues found
  • Final verification - build successful
  • Add translations for all supported languages (en, es, fr, hi, nl, zh)

Implementation Highlights

New Button

Added "Attach all variables" button in the Manage themes dialog footer (left of "New theme" button) that:

  • Iterates through ALL themes
  • Attaches local variables to each theme using existing logic
  • Respects collection and mode names (e.g., Collection "Appearance" with modes "Light", "Dark" attaches the right variables to matching themes)
  • Shows loading spinner during processing
  • Disabled when no themes exist
  • Now fully translated in all supported languages

Loading States (New Requirement)

Added loading prop to buttons to show visual feedback:

  1. The new "Attach all variables" button
  2. Individual "Attach local variables" buttons in theme editor
  3. "Attach local styles" buttons in theme editor

Translations Added

Added "attachAllVariables" translation key to all supported languages:

  • English: "Attach all variables"
  • Spanish: "Adjuntar todas las variables"
  • French: "Attacher toutes les variables"
  • Hindi: "सभी चर संलग्न करें"
  • Dutch: "Voeg alle variabelen toe"
  • Chinese: "附加所有变量"

Technical Details

  • Uses same ATTACH_LOCAL_VARIABLES_TO_THEME message handler as single-theme attachment
  • Graceful error handling (continues if one theme fails)
  • Analytics tracking for total variables attached
  • Performance profiling with wrapTransaction

Files Changed (8 files)

  1. ManageThemesModal.tsx - New button and handler, uses translation key
  2. ThemeVariableManagement.tsx - Loading prop
  3. ThemeStyleManagementCategory.tsx - Loading prop
  4. ManageThemesModal.test.tsx - Tests
  5. .changeset/attach-all-variables-feature.md - Changeset
  6. en/tokens.json - English translation
  7. es/tokens.json - Spanish translation
  8. fr/tokens.json - French translation
  9. hi/tokens.json - Hindi translation
  10. nl/tokens.json - Dutch translation
  11. zh/tokens.json - Chinese translation

All tests pass ✓ | Linter clean ✓ | Build successful ✓ | Code review passed ✓ | Translations added ✓

Original prompt

The "Attach local variables" feature in the Manage themes dialog.. users right now have to go through every theme one by one to do that. I need a feature in the overall Manage themes dialog (left of "New theme") that lets me Attach all variables. And basically it would go through each theme and check to see what variables it can attach (same logic as if we were to do it one by one), whats important is that it retains the logic it has meaning if a Collection is named Appearance and it has modes of Light, Dark - that we then attach the variables of Appearance/Light to the relevant set, and Apeprance/Dark to the relevant sets


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Oct 15, 2025

🦋 Changeset detected

Latest commit: 6188bf3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

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

Copilot AI and others added 2 commits October 15, 2025 07:29
Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Copilot AI changed the title [WIP] Add attach all variables feature in manage themes dialog Add "Attach all variables" button to batch attach variables to all themes Oct 15, 2025
Copilot AI requested a review from six7 October 15, 2025 07:39
Copilot finished work on behalf of six7 October 15, 2025 07:39
@six7
Copy link
Collaborator

six7 commented Oct 15, 2025

@copilot Make sure youre adding translations

Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 15, 2025

@copilot Make sure youre adding translations

Added translations for the "Attach all variables" button in all supported languages (en, es, fr, hi, nl, zh). The button now uses the translation key attachAllVariables instead of hardcoded text. Commit: ea8b0b3

Copilot finished work on behalf of six7 October 15, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants