FCLauncher/fclauncher/frontend/src/Instancepage.svelte

129 lines
2.8 KiB
Svelte

<script lang="ts">
import {instances, loading, navMargin} from './global'
import {InstallVanilla, LaunchInstance, GetInstances, InstallForge, InstallQuilt, InstallFabric, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
import {GetVersions} from '../wailsjs/go/main/App.js'
import {onMount} from 'svelte'
var testArray = ["test","test2","test3"];
let pack: string = "";
let instance: string
let radio: string = "";
let marginScale: string= $navMargin + "rem";
function launchclick(event) {
$loading = true
LaunchInstance(radio).then(() => {
$loading = false
})
}
</script>
<main>
<div class="header">
<div>Instances</div>
<div class="container">
<div class="tile-group">
{#each $instances as instance}
<div class="input-container">
<input id={instance} bind:group={radio} type="radio" name="radio" value={instance}>
<div class="radio-tile">
<!--icon goes here later-->
<label for={instance}>{instance}</label>
</div>
</div>
{/each}
</div>
</div>
</div>
<div class="options-container">
<button class="launch-button" on:click={launchclick}>Launch {radio}</button>
</div>
</main>
<style>
* {
box-sizing: border-box;
font-family: sans-serif;
--text-primary: #b6b6b6;
--text-secondary: #ececec;
--bg-primary: #23232e;
--bg-secondary: #141418;
}
body{
background-color: var(--bg-secondary);
}
main{
display: flex;
flex-direction: row;
}
.header{
flex: 3;
}
.options-container{
display: flex;
height: 100vh;
justify-self: right;
justify-content: center;
align-items: center;
width: 15rem;
}
.launch-button{
height: 3rem;
}
.container{
display: flex;
min-height: fit-content;
}
.tile-group{
display: flex;
flex-wrap: wrap;
flex: 1;
flex-grow:1 ;
}
.input-container{
position: relative;
height: 7rem;
width: 7rem;
margin: 0.5rem;
}
.input-container input{
position: absolute;
height: 100%;
width: 100%;
margin-left: -3.5rem;
z-index: 0;
opacity: 0;
cursor: pointer;
}
.input-container .radio-tile{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
border: 2px solid purple;
border-radius: 8px;
transition: all 300ms ease;
}
.input-container label{
color: purple;
font-size: 1.2rem;
font-weight: 600;
}
input:checked + .radio-tile{
background-color: purple;
box-shadow: 0 0 12px purple;
}
input:hover + .radio-tile{
box-shadow: 0 0 12px purple;
}
input:checked + .radio-tile label{
color: var(--text-primary);
}
</style>