Skip to content

Conversation

@ironAiken2
Copy link
Contributor

@ironAiken2 ironAiken2 commented Jan 6, 2026

resolves #4949 (FR-1866)

Summary

  • Add dedicated Branding page accessible from the side menu for theme customization
  • Implement Theme JSON Configuration modal with Monaco editor for advanced theme editing
    • Import/Export JSON functionality for theme configuration
    • Real-time JSON schema validation using theme.schema.json and antdThemeConfig.schema.json
    • Prevents saving invalid configurations by checking Monaco markers before apply
  • Add i18n translations for new theme-related strings across all 21 supported languages

Changes

New Features

  • Branding Page (BrandingPage.tsx): New dedicated page for branding settings, moved from Configurations page
  • Theme JSON Config Modal (ThemeJsonConfigModal.tsx):
    • Monaco editor with JSON syntax highlighting and dark/light theme support
    • JSON schema validation with $ref resolution for nested schemas
    • Import JSON file to load theme configuration
    • Export current theme as JSON file
    • Validation error prevention - cannot save if schema validation fails

Technical Details

  • Monaco editor schema URIs use inmemory://model/ prefix to match Monaco's internal path resolution for $ref references
  • Uses monacoRef to access editor markers at save time for immediate validation feedback

Checklist: (if applicable)

  • Documentation
  • Minium required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

Copy link
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ironAiken2 ironAiken2 marked this pull request as ready for review January 6, 2026 06:32
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
4.89% (-0.01% 🔻)
589/12036
🔴 Branches
4.46% (-0.02% 🔻)
377/8460
🔴 Functions
2.74% (-0.01% 🔻)
101/3690
🔴 Lines
4.72% (-0.01% 🔻)
555/11754
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / ThemeColorPicker.tsx
0%
0% (-100% 🔻)
0% 0%

Test suite run success

173 tests passing in 13 suites.

Report generated by 🧪jest coverage report action from adcdc8a

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a comprehensive theme customization feature that allows users to import and export custom themes via JSON configuration. The key addition is a Monaco editor-based modal with real-time JSON schema validation, replacing the previous read-only code editor implementation. The feature includes proper i18n support across all 21 supported languages.

Key Changes:

  • Replaced read-only code editor with editable Monaco editor featuring JSON schema validation
  • Added Import/Export functionality for theme JSON files
  • Refactored theme config API to distinguish between incremental updates and full replacements
  • Added comprehensive i18n translations for theme-related messages

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
react/src/components/BrandingSettingItems/ThemeJsonConfigModal.tsx Complete rewrite: Replaced BAICodeEditor with Monaco editor, added import functionality, JSON schema validation, and proper error handling structure
react/src/components/BrandingSettingList.tsx Updated to use renamed API methods and wrapped modal with BAIUnmountAfterClose for proper cleanup
react/src/helper/customThemeConfig.ts Refactored API: Added updateUserCustomThemeConfig for incremental updates while exposing setUserCustomThemeConfig for full replacement
react/src/components/BrandingSettingItems/ThemeColorPicker.tsx Updated to use renamed updateUserCustomThemeConfig method
react/src/components/BrandingSettingItems/LogoSizeSettingItem.tsx Updated to use renamed updateUserCustomThemeConfig method
react/src/components/BrandingSettingItems/LogoPreviewer.tsx Updated to use renamed updateUserCustomThemeConfig method
react/package.json Added @monaco-editor/react dependency and ESLint rule to enforce custom useThemeMode hook usage
pnpm-lock.yaml Lock file updates for Monaco editor and its dependencies (monaco-editor, dompurify, marked)
resources/i18n/*.json (21 files) Added 4 new translation keys for theme JSON configuration messages across all supported languages
.cspell.json Added "inmemory" to dictionary for Monaco's schema URI prefix
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines 170 to 174
return {
themeConfig,
userCustomThemeConfig: mergedThemeConfig,
setUserCustomThemeConfig: updateThemeConfig,
userCustomThemeConfig,
mergedThemeConfig,
updateUserCustomThemeConfig: updateThemeConfig,
setUserCustomThemeConfig,
getThemeValue,
};
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The API refactoring introduces both updateUserCustomThemeConfig and setUserCustomThemeConfig with different behaviors, which could confuse API consumers.

updateUserCustomThemeConfig performs incremental updates with merging logic and path-based updates, while setUserCustomThemeConfig directly replaces the entire config. Consider either:

  1. Making setUserCustomThemeConfig internal/private (prefix with underscore or keep it unexported for internal use only)
  2. Adding clear JSDoc documentation explaining when to use each function
  3. Renaming to make the distinction clearer (e.g., replaceThemeConfig vs updateThemeConfig)

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A comprehensive revision of useUserCustomThemeConfig appears necessary.

Modifications:
- Revised behaviour where theme.json values were used when userCustomThemeConfig values were absent > Modified to use antd token default values when absent
- Naming revisions

  • Revised naming for updateThemeConfig (which modifies specific fields of UserCustomThemeConfig) and setUserCustomThemeConfig (which modifies the entire configuration)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hook has been modified. To allow another reviewer to verify, I will not resolve this comment. Please resolve it after another reviewer has checked.

Modification details:

1. Does not utilise the repository's theme.json value.
The userCustomThemeConfig stored in localStorage only clones the theme.json settings during initial load and subsequently does not use theme.json values. This is to directly display any side effects that occur when modifying the JSON content manually within the preview window. Instead, it uses the default token value from antd.

2. themeConfig is no longer provided.
themeConfig is no longer provided in this hook. If you require themeConfig, please use useCustomThemeConfig.

@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from 90ec72f to 636a47e Compare January 6, 2026 07:28
@ironAiken2 ironAiken2 force-pushed the feat/FR-1849-add-branding-page branch from c637eaf to d308329 Compare January 6, 2026 07:28
@ironAiken2 ironAiken2 requested a review from Copilot January 6, 2026 07:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@ironAiken2 ironAiken2 changed the base branch from feat/FR-1849-add-branding-page to graphite-base/4948 January 6, 2026 08:10
@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from 636a47e to cfccc87 Compare January 6, 2026 08:57
@ironAiken2 ironAiken2 changed the base branch from graphite-base/4948 to feat/FR-1849-add-branding-page January 6, 2026 08:57
@ironAiken2 ironAiken2 requested a review from Copilot January 6, 2026 09:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from cfccc87 to d108b4e Compare January 6, 2026 09:22
Copy link
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

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

.

Copilot AI review requested due to automatic review settings January 7, 2026 03:19
@ironAiken2 ironAiken2 force-pushed the feat/FR-1849-add-branding-page branch from 4111d3b to dca87a5 Compare January 7, 2026 03:19
@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from d108b4e to 706f979 Compare January 7, 2026 03:19
@ironAiken2 ironAiken2 requested a review from agatha197 January 7, 2026 03:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

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

Could you resolve copilot review first?

@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from 706f979 to d2dd78d Compare January 7, 2026 04:07
@ironAiken2 ironAiken2 requested a review from nowgnuesLee January 7, 2026 04:11
@ironAiken2 ironAiken2 changed the base branch from feat/FR-1849-add-branding-page to graphite-base/4948 January 7, 2026 07:29
Copilot AI review requested due to automatic review settings January 7, 2026 07:30
@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from d2dd78d to 3f60b15 Compare January 7, 2026 07:30
@ironAiken2 ironAiken2 changed the base branch from graphite-base/4948 to feat/FR-1849-add-branding-page January 7, 2026 07:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

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

Please resolve the copilot's reviews.

@ironAiken2 ironAiken2 force-pushed the feat/FR-1849-add-branding-page branch from 361958e to 5737794 Compare January 8, 2026 08:38
@ironAiken2 ironAiken2 force-pushed the feat/FR-1866-import-custon-theme-via-json branch from 3f60b15 to adcdc8a Compare January 8, 2026 08:38
@ironAiken2 ironAiken2 requested a review from agatha197 January 8, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n Localization area:ux UI / UX issue. size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants