~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
main
34 lines · 1.3 KB Raw History
<script lang="ts">
  import SignIn from '#lib/molecules/SignIn.svelte';
  import SignInDialog from '#lib/organisms/SignInDialog.svelte';
  import SiteBrand from '#lib/molecules/SiteBrand.svelte';
  import UserMenu from '#lib/molecules/UserMenu.svelte';
  import type { Brand } from '#lib/brand.ts';
  import { page } from '$app/state';
  /** The top of every page: the way home, by the host's name and logo (`brand`), and the menu of whoever is signed in, marking the invites waiting for them (`invites`) and offering the other accounts the browser is signed in to (`accounts`), or the way in; and where to make an account (`signUpAt`, a PDS), from the sign-in that adds one too. */
  let {
    viewer,
    brand,
    invites = 0,
    accounts = [],
    signUpAt = 'https://bsky.social'
  }: {
    viewer: { did: string; handle?: string } | null;
    brand: Brand;
    invites?: number;
    accounts?: { did: string; handle?: string }[];
    signUpAt?: string;
  } = $props();
</script>

<header class="top">
  <div class="wrap">
    <SiteBrand {brand} />
    {#if viewer}
      <UserMenu did={viewer.did} handle={viewer.handle} {invites} {accounts} />
    {:else}
      <div class="sign-in"><SignIn quiet /></div>
    {/if}
  </div>
</header>
<SignInDialog back={`${page.url.pathname}${page.url.search}`} {signUpAt} />