diff options
| author | Adam Soltys <[email protected]> | 2024-11-09 23:33:36 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-09 23:33:36 -0800 |
| commit | 9b7c321602f91ea568f5742674ba798be26bfd65 (patch) | |
| tree | 536dda3876fb6d2b397136b1a069b615f1adf9fc /src/components/AppHeader.svelte | |
| parent | e0d2cf06e41778e83e23f5c6fe7be02067fd8e66 (diff) | |
| download | coinos-ui-9b7c321602f91ea568f5742674ba798be26bfd65.tar.gz coinos-ui-9b7c321602f91ea568f5742674ba798be26bfd65.zip | |
fix avatars
Diffstat (limited to 'src/components/AppHeader.svelte')
| -rw-r--r-- | src/components/AppHeader.svelte | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index fef2f0f4..1431bb6f 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -1,5 +1,5 @@ <script> - import { run } from 'svelte/legacy'; + import { run } from "svelte/legacy"; import { banner, theme, newPayment } from "$lib/store"; import { goto } from "$app/navigation"; @@ -11,18 +11,17 @@ let { user, subject = $bindable() } = $props(); let w = $state(); - run(() => { - if (!subject) subject = user; - }); + $effect(() => (subject ||= user)); - let bg = - $derived($banner?.id && $banner.id === subject.id + let bg = $derived( + $banner?.id && $banner.id === subject.id ? `url(${$banner.src})` : subject?.banner ? subject.banner.includes(":") ? `url(${subject.banner})` : `url(/api/public/${subject.banner}.webp)` - : undefined); + : undefined, + ); const links = [ { @@ -47,7 +46,8 @@ let opacity = $derived((href) => $page.url.pathname === href ? "opacity-100" - : "opacity-90 hover:opacity-none"); + : "opacity-90 hover:opacity-none", + ); </script> <svelte:window bind:innerWidth={w} /> @@ -62,7 +62,8 @@ {#each links as { href, icon, flip }} <a {href} data-sveltekit-preload-code="eager"> <button class="btn-menu {opacity(href)}"> - <iconify-icon {icon} width={w > 640 ? 32 : 24} {flip}></iconify-icon> + <iconify-icon {icon} width={w > 640 ? 32 : 24} {flip} + ></iconify-icon> </button> </a> {/each} |
