2024-11-25 12:36:29 -07:00
|
|
|
<script lang="ts">
|
|
|
|
import {onMount} from 'svelte'
|
|
|
|
import {GetModpacks} from '../wailsjs/go/main/ModpackManager.js'
|
2024-11-25 13:23:06 -07:00
|
|
|
import {ImportModpack} from '../wailsjs/go/main/InstanceManager.js'
|
2024-11-25 12:36:29 -07:00
|
|
|
import { main } from '../wailsjs/go/models';
|
2024-11-25 13:23:06 -07:00
|
|
|
import {loading} from './global.js'
|
2024-11-25 12:36:29 -07:00
|
|
|
let modpacks: main.Modpack[] = []
|
|
|
|
let pack: main.Modpack
|
2024-11-25 13:23:06 -07:00
|
|
|
|
2024-11-25 12:36:29 -07:00
|
|
|
onMount(() => {
|
|
|
|
GetModpacks().then((result) => {
|
|
|
|
modpacks = result
|
2024-11-25 13:23:06 -07:00
|
|
|
pack = result[0]
|
2024-11-25 12:36:29 -07:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2024-11-25 13:23:06 -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>
|
2024-11-25 13:23:06 -07:00
|
|
|
<button on:click={AddModpack}>Add Modpack</button>
|
2024-11-25 12:36:29 -07:00
|
|
|
</main>
|