EZPPLauncher/src/pages/Launch.svelte

58 lines
1.6 KiB
Svelte
Raw Normal View History

2024-01-10 15:26:45 +00:00
<script lang="ts">
import { Button } from "flowbite-svelte";
2024-01-10 15:26:45 +00:00
import Progressbar from "../lib/Progressbar.svelte";
2024-01-12 11:09:11 +00:00
import {
launching,
patch,
launchStatus,
launchPercentage
2024-01-12 11:09:11 +00:00
} from "./../storage/localStore";
2024-01-11 11:59:52 +00:00
let progressbarFix = true;
setTimeout(() => {
progressbarFix = false;
}, 1000);
2024-01-11 21:50:01 +00:00
const launch = () => {
launching.set(true);
2024-01-18 18:47:56 +00:00
const patching = $patch;
2024-01-25 09:23:03 +00:00
window.dispatchEvent(
new CustomEvent("launch", { detail: { patch: patching } })
);
2024-01-12 11:09:11 +00:00
};
2024-01-10 15:26:45 +00:00
</script>
2024-01-11 11:59:52 +00:00
<main
class="h-[265px] my-auto flex flex-col justify-center items-center p-5 animate-fadeIn"
>
2024-01-10 15:26:45 +00:00
<div
2024-01-11 11:59:52 +00:00
class="container flex flex-col items-center justify-center gap-3 rounded-lg p-3"
2024-01-10 15:26:45 +00:00
>
2024-01-11 11:59:52 +00:00
<Button
color="light"
size="xl"
2024-01-25 09:23:03 +00:00
class="{$launching
2024-01-11 11:59:52 +00:00
? ''
: 'active:scale-95 '}transition-transform duration-75"
disabled={$launching}
2024-01-12 11:09:11 +00:00
on:click={launch}>Launch</Button
>
2024-01-11 11:59:52 +00:00
<div
class="w-full flex flex-col justify-center items-center gap-2 mt-2 {$launching
2024-01-11 11:59:52 +00:00
? 'animate-fadeIn '
: 'animate-fadeOut '}{progressbarFix ? '!opacity-0' : 'opacity-0'}"
2024-01-10 15:26:45 +00:00
>
<Progressbar
animate={true}
2024-01-12 11:09:11 +00:00
progress={$launchPercentage}
indeterminate={$launchPercentage == -1}
2024-01-10 15:26:45 +00:00
labelInside={true}
2024-01-11 11:59:52 +00:00
size="h-3"
2024-01-12 11:09:11 +00:00
class=""
labelInsideClass="bg-primary-600 drop-shadow-xl text-gray-100 text-base font-medium text-center p-1 leading-none rounded-full !text-[0.7rem] !leading-[0.45]"
2024-01-10 15:26:45 +00:00
/>
2024-01-11 21:50:01 +00:00
<p class="m-0 p-0 dark:text-gray-400 font-light">{$launchStatus}</p>
2024-01-10 15:26:45 +00:00
</div>
</div>
</main>