From 878de2e452e3164752844527533e684cf6238513 Mon Sep 17 00:00:00 2001 From: tdgao Date: Thu, 2 Jul 2026 14:31:26 -0700 Subject: [PATCH] feat: auto select loader after selecting a game version, if only one loader is left compatible --- .../ui/ProjectDownloadModal/DownloadProject.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue b/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue index 9ede36219f..9294a1fd37 100644 --- a/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue +++ b/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue @@ -374,6 +374,7 @@ function selectGameVersion(gameVersion?: string) { if (!gameVersion) return userSelectedGameVersion.value = gameVersion emit('selectGameVersion', gameVersion) + selectOnlyCompatiblePlatform() } function selectPlatform(platform?: string) { @@ -421,6 +422,18 @@ function isPlatformUnavailable(platform: string) { return incompatibleLoadersSet.value.has(platform) || !possiblePlatforms.value.includes(platform) } +function selectOnlyCompatiblePlatform() { + const compatiblePlatforms = props.project.loaders.filter( + (platform) => + possiblePlatforms.value.includes(platform) && !incompatibleLoadersSet.value.has(platform), + ) + + if (compatiblePlatforms.length !== 1) return + + userSelectedPlatform.value = compatiblePlatforms[0] + emit('selectPlatform', compatiblePlatforms[0]) +} + function gameVersionOptionTooltip(gameVersion: string) { if (incompatibleGameVersionsSet.value.has(gameVersion)) { return formatMessage(messages.baseGameVersionIncompatibleTooltip)