Skip to content

feat(frontend): add title & desc mode to menu selector#1707

Merged
UNIkeEN merged 2 commits into
mainfrom
feat/issue-1706
Jun 14, 2026
Merged

feat(frontend): add title & desc mode to menu selector#1707
UNIkeEN merged 2 commits into
mainfrom
feat/issue-1706

Conversation

@UNIkeEN

@UNIkeEN UNIkeEN commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Checklist

  • Changes have been tested locally and work as expected.
  • All tests in workflows pass successfully.
  • Documentation has been updated if necessary.
  • Code formatting and commit messages align with the project's conventions.
  • Comments have been added for any complex logic or functionality if possible.

This PR is a ..

  • 🆕 New feature
  • 🐞 Bug fix
  • 🛠 Refactoring
  • ⚡️ Performance improvement
  • 🌐 Internationalization
  • 📄 Documentation improvement
  • 🎨 Code style optimization
  • ❓ Other (Please specify below)

Related Issues

close #1706

Description

  • Please insert your description here and provide info about the "what" this PR is solving.

Additional Context

  • Add any other relevant information or screenshots here.

Summary by Sourcery

Add support for title-and-description labels in the shared menu selector and apply it to advanced game settings menus.

New Features:

  • Allow menu selector options to provide structured title and description labels and render them with appropriate styling.
  • Show Java selection entries and game file validation policies using separate title and description fields in the UI.

Enhancements:

  • Update i18n locale files to include descriptions for game file validation policy options displayed in the menu selector.

@UNIkeEN UNIkeEN requested a review from baiyuansjtu June 13, 2026 18:04
@sourcery-ai

sourcery-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Extends the MenuSelector component to support labels with separate title and description fields and updates game settings menus and i18n resources to use this new title/description display mode for certain options.

File-Level Changes

Change Details Files
Extend MenuSelector to support labels with title/description and render them differently in the menu vs the trigger button.
  • Broaden OptionLabel type to accept either a ReactNode or an object with title and desc fields.
  • Add a type guard to detect title/description label objects and a renderLabel helper that renders them using Chakra Text and VStack.
  • Adjust button label rendering to show only the title part when a title/description label is used, and keep existing behavior for plain labels.
  • Update MenuItemOption rendering to use renderLabel so menu items show both title and description where available.
src/components/common/menu-selector.tsx
Adopt title/description labels for specific game settings menus.
  • Change game file validation policy options to pass a label object with localized title and description strings to MenuSelector.
  • Change the Java selector label to use a title/description object, showing version/LTS in the title and the execPath as the description.
src/components/game-advanced-settings-group.tsx
src/components/game-settings-groups.tsx
Add or update i18n strings to support descriptions for game file validation policies in all supported locales.
  • Introduce new translation keys for gameFileValidatePolicy descriptions alongside existing title keys across all locale JSON files.
  • Ensure each locale has consistent structure for the new description keys, matching the English keys.
src/locales/en.json
src/locales/fr.json
src/locales/ja.json
src/locales/lzh.json
src/locales/zh-Hans.json
src/locales/zh-Hant.json

Assessment against linked issues

Issue Objective Addressed Explanation
#1706 Add in-UI descriptive text explaining the differences between the game file integrity check policy options (e.g., 普通检查 and 增强检查), so that each option shows an explanatory description beneath its label.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 13, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The isTitleDescLabel runtime check relies on typeof label === "object", which will also be true for React elements; consider using a more robust discriminator (e.g., a dedicated type field or explicitly excluding React.isValidElement(label)) so ReactNodes are not misclassified as { title, desc }.
  • In renderButtonLabel, getLabel can still return a non-string ReactNode for non-title/desc labels, but you then call .join(", ") in the multi-select case—normalizing these labels to strings (or handling non-string labels explicitly) would avoid potential runtime issues and inconsistent button text.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `isTitleDescLabel` runtime check relies on `typeof label === "object"`, which will also be true for React elements; consider using a more robust discriminator (e.g., a dedicated type field or explicitly excluding `React.isValidElement(label)`) so ReactNodes are not misclassified as `{ title, desc }`.
- In `renderButtonLabel`, `getLabel` can still return a non-string ReactNode for non-title/desc labels, but you then call `.join(", ")` in the multi-select case—normalizing these labels to strings (or handling non-string labels explicitly) would avoid potential runtime issues and inconsistent button text.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…djust java menu

Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
@UNIkeEN UNIkeEN merged commit e690599 into main Jun 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 为「游戏文件完整性检查策略」各选项添加说明描述

1 participant