forked from didirus/AstralRinth
* refactor: migrate to common eslint+prettier configs * fix: prettier frontend * feat: config changes * fix: lint issues * fix: lint * fix: type imports * fix: cyclical import issue * fix: lockfile * fix: missing dep * fix: switch to tabs * fix: continue switch to tabs * fix: rustfmt parity * fix: moderation lint issue * fix: lint issues * fix: ui intl * fix: lint issues * Revert "fix: rustfmt parity" This reverts commit cb99d2376c321d813d4b7fc7e2a213bb30a54711. * feat: revert last rs
36 lines
1021 B
Vue
36 lines
1021 B
Vue
<script setup>
|
|
import { injectNotificationManager } from '@modrinth/ui'
|
|
import { ref } from 'vue'
|
|
|
|
import JavaSelector from '@/components/ui/JavaSelector.vue'
|
|
import { get_java_versions, set_java_version } from '@/helpers/jre'
|
|
|
|
const { handleError } = injectNotificationManager()
|
|
|
|
const javaVersions = ref(await get_java_versions().catch(handleError))
|
|
async function updateJavaVersion(version) {
|
|
if (version?.path === '') {
|
|
version.path = undefined
|
|
}
|
|
|
|
if (version?.path) {
|
|
version.path = version.path.replace('java.exe', 'javaw.exe')
|
|
}
|
|
|
|
await set_java_version(version).catch(handleError)
|
|
}
|
|
</script>
|
|
<template>
|
|
<div v-for="(javaVersion, index) in [21, 17, 8]" :key="`java-${javaVersion}`">
|
|
<h2 class="m-0 text-lg font-extrabold text-contrast" :class="{ 'mt-4': index !== 0 }">
|
|
Java {{ javaVersion }} location
|
|
</h2>
|
|
<JavaSelector
|
|
:id="'java-selector-' + javaVersion"
|
|
v-model="javaVersions[javaVersion]"
|
|
:version="javaVersion"
|
|
@update:model-value="updateJavaVersion"
|
|
/>
|
|
</div>
|
|
</template>
|