forked from akanyan/STARTLINER
initial commit
This commit is contained in:
32
src/components/ModList.vue
Normal file
32
src/components/ModList.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { Reactive, onMounted, reactive } from 'vue';
|
||||
import Fieldset from 'primevue/fieldset';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import ModListEntry from './ModListEntry.vue';
|
||||
import { ModEntry, Profile } from '../types';
|
||||
|
||||
const mods: Reactive<{ [key: string]: ModEntry[] }> = reactive({});
|
||||
|
||||
const props = defineProps({
|
||||
profile: Object as () => Profile,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const modsRaw: ModEntry[] = await invoke('get_packages');
|
||||
modsRaw.forEach((m) => {
|
||||
if (props.profile?.mods.includes(`${m.namespace}-${m.name}`)) {
|
||||
m.enabled = true;
|
||||
}
|
||||
});
|
||||
Object.assign(
|
||||
mods,
|
||||
Object.groupBy(modsRaw, ({ namespace }) => namespace)
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Fieldset v-for="(namespace, key) in mods" :legend="key.toString()">
|
||||
<ModListEntry v-for="m in namespace" :mod="m" />
|
||||
</Fieldset>
|
||||
</template>
|
Reference in New Issue
Block a user