feat(frontend): optimize UX when no suitable Java is found, add default selection in download java modal#1376
feat(frontend): optimize UX when no suitable Java is found, add default selection in download java modal#1376
Conversation
…lt selection in download java modal
There was a problem hiding this comment.
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
NoSuitableJavaerror 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 |
| "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." | ||
| }, |
There was a problem hiding this comment.
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.
| useEffect(() => { | ||
| if (!props.isOpen) return; | ||
| setVendor(DEFAULT_VENDOR); | ||
| setVersion(DEFAULT_VERSION); | ||
| setType(DEFAULT_TYPE); | ||
| }, [props.isOpen]); |
There was a problem hiding this comment.
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.
Checklist
This PR is a ..
Related Issues
close #808
Description
Additional Context