~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
main
38 lines · 1.2 KB Raw History
<script lang="ts">
  import '../app.css';
  import SiteHeader from '#lib/organisms/SiteHeader.svelte';
  import { brandStyle } from '#lib/brand.ts';
  import SiteFooter from '#lib/organisms/SiteFooter.svelte';
  import LeaveGuard from '#lib/molecules/LeaveGuard.svelte';
  import { page } from '$app/state';
  import { onMount } from 'svelte';
  let { data, children } = $props();
  // The page answers in the browser from here: what is typed or picked
  // before then may be put back as it hydrates. The e2e flows wait for it.
  onMount(() => {
    document.documentElement.dataset.hydrated = '';
  });
  // The operator's colour, as the one that acts: only a colour, as #rgb
  // or #rrggbb, is let into it.
  const style = $derived(brandStyle(data.brand));
</script>

<svelte:head>
  {#if style}{@html `<style>${style}</style>`}{/if}
</svelte:head>

<!-- A page on its own, as an app's request is, draws its own frame. -->
{#if page.data.alone}
  {@render children()}
{:else}
  <SiteHeader
    viewer={data.viewer}
    brand={data.brand}
    invites={data.invitations.length}
    accounts={data.accounts}
    signUpAt={data.signUpAt}
  />
  <main class="wrap">{@render children()}</main>
  <SiteFooter host={page.url.hostname} brand={data.brand} />
{/if}
<LeaveGuard />