FCLauncher/fclauncher/frontend/src/Modpacks.svelte

31 lines
881 B
Svelte
Raw Normal View History

2024-11-25 12:36:29 -07:00
<script lang="ts">
import {onMount} from 'svelte'
import {GetModpacks} from '../wailsjs/go/main/ModpackManager.js'
import {ImportModpack} from '../wailsjs/go/main/InstanceManager.js'
2024-11-25 12:36:29 -07:00
import { main } from '../wailsjs/go/models';
import {loading} from './global.js'
2024-11-25 12:36:29 -07:00
let modpacks: main.Modpack[] = []
let pack: main.Modpack
2024-11-25 12:36:29 -07:00
onMount(() => {
GetModpacks().then((result) => {
modpacks = result
pack = result[0]
2024-11-25 12:36:29 -07:00
})
})
function AddModpack(){
$loading = true
ImportModpack(pack, pack.Name).then(() => $loading = false)
}
2024-11-25 12:36:29 -07:00
</script>
<main>
<select id="pack" bind:value={pack} name="pack">Select a Modpack:
{#each modpacks as pack}
<option value={pack}>{pack.Name}</option>
{/each}
</select>
<button on:click={AddModpack}>Add Modpack</button>
2024-11-25 12:36:29 -07:00
</main>