flotilla/src/routes/+layout.svelte

59 lines
1.4 KiB
Svelte
Raw Normal View History

2024-08-05 21:45:16 +00:00
<script lang="ts">
2024-08-06 20:10:10 +00:00
import "@src/app.css"
2024-08-05 22:28:46 +00:00
import {page} from "$app/stores"
2024-08-06 22:46:37 +00:00
import {fly} from "@lib/transition"
2024-08-08 21:02:46 +00:00
import ModalBox from "@lib/components/ModalBox.svelte"
2024-08-08 23:32:46 +00:00
import Toast from "@app/components/Toast.svelte"
2024-08-06 20:10:10 +00:00
import PrimaryNav from "@app/components/PrimaryNav.svelte"
import SecondaryNav from "@app/components/SecondaryNav.svelte"
2024-08-08 23:32:46 +00:00
import {modals} from "@app/modal"
2024-08-05 21:45:16 +00:00
const login = async () => {
2024-08-05 22:28:46 +00:00
const nl = await import("nostr-login")
2024-08-05 21:45:16 +00:00
nl.init({
noBanner: true,
2024-08-05 22:28:46 +00:00
title: "Welcome to Flotilla!",
description: "Log in with your Nostr account or sign up to join.",
methods: ["connect", "extension", "local"],
2024-08-05 21:45:16 +00:00
onAuth(npub: string) {
console.log(npub)
2024-08-05 22:28:46 +00:00
},
2024-08-05 21:45:16 +00:00
})
nl.launch()
}
2024-08-05 22:25:04 +00:00
let modal: HTMLDialogElement
2024-08-05 21:45:16 +00:00
$: {
if ($page.state.modal) {
modal?.showModal()
} else {
modal?.close()
}
}
</script>
2024-08-08 21:02:46 +00:00
<div data-theme="dark">
<div class="flex h-screen">
<PrimaryNav />
<SecondaryNav />
<div class="flex-grow bg-base-200">
<slot />
</div>
2024-08-05 21:45:16 +00:00
</div>
2024-08-08 23:32:46 +00:00
<dialog bind:this={modal} class="modal modal-bottom sm:modal-middle !z-modal">
2024-08-05 21:45:16 +00:00
{#if $page.state.modal}
2024-08-08 21:02:46 +00:00
{#key $page.state.modal}
<ModalBox {...modals.get($page.state.modal)} />
{/key}
2024-08-08 23:32:46 +00:00
<Toast />
2024-08-05 21:45:16 +00:00
{/if}
2024-08-08 21:02:46 +00:00
<form method="dialog" class="modal-backdrop">
<button />
</form>
</dialog>
2024-08-08 23:32:46 +00:00
<Toast />
2024-08-08 21:02:46 +00:00
</div>