diff --git a/frontend/src/lib/components/ui/avatar.svelte b/frontend/src/lib/components/ui/avatar.svelte index cab8227..61e8c13 100644 --- a/frontend/src/lib/components/ui/avatar.svelte +++ b/frontend/src/lib/components/ui/avatar.svelte @@ -7,6 +7,20 @@ }; let { src, class: klass }: Props = $props(); + + let valid_src = $state(false); + + $effect.pre(() => { + if (!src) { + valid_src = false; + return; + } + // create img instance + const img = new Image(); + img.onload = () => (valid_src = true); + img.onerror = () => (valid_src = false); + img.src = src; + });
- {#if src} + {#if valid_src} {:else} { + if (!authStore.state.is_authenticated) return false; + if (authStore.state.profile && quiblet) { + return quiblet.members?.includes(authStore.state.profile.id); + } + }); @@ -25,7 +34,10 @@ >
- +

q/{quiblet?.name}

@@ -34,7 +46,7 @@ Create Quib