You've already forked AstralRinth
forked from didirus/AstralRinth
* feat: migrate frontend notifications to dependency injection based notificaton manager * fix: lint * fix: issues * fix: compile error + notif binding issue * refactor: move org context to new DI setup * feat: migrate app notifications to DI + frontend styling * fix: sidebar issues * fix: dont use delete in computed * fix: import and prop issue * refactor: move handleError to main notification manager class * fix: lint & build * fix: merge issues * fix: lint issues * fix: lint issues --------- Signed-off-by: IMB11 <hendersoncal117@gmail.com> Signed-off-by: Cal H. <hendersoncal117@gmail.com>
35 lines
1.0 KiB
Vue
35 lines
1.0 KiB
Vue
<script setup>
|
|
import JavaSelector from '@/components/ui/JavaSelector.vue'
|
|
import { get_java_versions, set_java_version } from '@/helpers/jre'
|
|
import { injectNotificationManager } from '@modrinth/ui'
|
|
import { ref } from 'vue'
|
|
|
|
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>
|