Skip to content

feat(frontend): optimize UX when no suitable Java is found, add default selection in download java modal#1376

Open
UNIkeEN wants to merge 1 commit intomainfrom
feat/issue-808
Open

feat(frontend): optimize UX when no suitable Java is found, add default selection in download java modal#1376
UNIkeEN wants to merge 1 commit intomainfrom
feat/issue-808

Conversation

@UNIkeEN
Copy link
Owner

@UNIkeEN UNIkeEN commented Feb 14, 2026

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 #808

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.

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 improves the user experience when no suitable Java runtime is found for a Minecraft instance. Instead of showing an error toast, it now displays a dialog that guides users to the Java management page where they can add or download Java. Additionally, the download Java modal now has sensible defaults (Mojang, Java 25, JRE) pre-selected, and these defaults are reset each time the modal opens.

Changes:

  • Added error handling for NoSuitableJava error in launch process with a user-friendly dialog
  • Added default selections in download Java modal (Mojang vendor, Java 25, JRE type)
  • Added translations for the new dialog in English and Simplified Chinese
  • Extended the version type to include Java 25 support

Reviewed changes

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

Show a summary per file
File Description
src/locales/zh-Hans.json Added Chinese translations for "NoSuitableJavaDialog"
src/locales/en.json Added English translations for "NoSuitableJavaDialog"
src/enums/service-error.ts Added new LaunchServiceError enum with NoSuitableJava error type
src/components/modals/launch-process-modal.tsx Added error handler for NoSuitableJava that opens a confirmation dialog and navigates to Java settings page
src/components/modals/download-java-modal.tsx Added default values and useEffect to reset form to defaults when modal opens; added Java 25 support

Comment on lines +1422 to +1425
"NoSuitableJavaDialog": {
"title": "No suitable Java runtime found for this instance",
"body": "No suitable Java runtime is available for this instance. Click \"Confirm\" to open Java Management page and add or download Java manually."
},
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The new translation keys for "NoSuitableJavaDialog" are only added to en.json and zh-Hans.json, but are missing from the other locale files (fr.json, ja.json, zh-Hant.json). This will cause missing translations when users switch to French, Japanese, or Traditional Chinese languages. Please add these translation keys to all locale files to maintain consistency across all supported languages.

Copilot uses AI. Check for mistakes.
Comment on lines +122 to +127
useEffect(() => {
if (!props.isOpen) return;
setVendor(DEFAULT_VENDOR);
setVersion(DEFAULT_VERSION);
setType(DEFAULT_TYPE);
}, [props.isOpen]);
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The useEffect hook references props.isOpen in its body but does not include it in the dependency array. According to React best practices and the pattern used consistently throughout the codebase (e.g., manual-add-java-path-modal.tsx:39-43, manage-skin-modal.tsx:88-93), props.isOpen should be included in the dependency array to ensure the effect runs when the modal opens. Please add props.isOpen to the dependency array.

Copilot uses AI. Check for mistakes.
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.

[Feature] 自动下载java

1 participant