[+] Functioning launcher

This commit is contained in:
2024-12-17 00:38:15 -05:00
parent c0c64d4fb8
commit 3d48caada0
2 changed files with 28 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
<script lang="ts">
import App from "./App.svelte";
import { Backend, type Checkpoint } from "./utils";
// Get puzzle id from params
const urlParams = new URLSearchParams(window.location.search);
const puzzleId = urlParams.get("puzzle");
let puzzleData: Checkpoint | null = null;
if (!puzzleId) window.location.href = "/?puzzle=meow";
else Backend.get(puzzleId).then((data) => (puzzleData = data));
</script>
{#if puzzleData !== null && puzzleId !== null}
<App {puzzleData} {puzzleId} />
{:else}
<div class="overlay">
<div>
{#if puzzleId === null}
<a href="/?puzzle=meow">Redirecting...</a>
{:else}
<div>Loading...</div>
{/if}
</div>
</div>
{/if}
+2 -2
View File
@@ -2,9 +2,9 @@ import { mount } from 'svelte'
import './app.sass'
import './puzzle.sass'
import './fonts/caveat.sass'
import App from './App.svelte'
import Launcher from './Launcher.svelte'
const app = mount(App, {
const app = mount(Launcher, {
target: document.getElementById('app')!,
})