<script lang="ts">
  import '../app.css';
  import favicon from '$lib/assets/favicon.svg';
  import { page } from '$app/state';

  let { children } = $props();
</script>

<svelte:head>
  <link rel="icon" href={favicon} />
</svelte:head>

<nav class="header">
  <h1 class="text-4xl">crunched</h1>
  <p>
    <a href="/">home</a> - {#if page.data.session}<a href="/vms">vms</a> -
      <a
        href="/login/undo?next={encodeURIComponent(
          page.url.pathname + page.url.search
        )}">logout</a
      >{:else}<a
        href="/login?scope=default&next={encodeURIComponent(
          page.url.pathname + page.url.search
        )}">login</a
      >{/if}
  </p>
  <div class="my-2">
    <hr />
  </div>
</nav>
{@render children?.()}
