aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-07 13:58:00 -0700
committerAdam Soltys <[email protected]>2022-09-07 13:58:00 -0700
commit3170bcd8c9ed53d548b51254e20d1e027cb2c138 (patch)
tree64192da314d8428746f649a1e8fc9fb7abb97633 /src/components
parente0616f3ddd0cc006fa2a2f4493e623a4b86f276f (diff)
downloadcoinos-ui-3170bcd8c9ed53d548b51254e20d1e027cb2c138.tar.gz
coinos-ui-3170bcd8c9ed53d548b51254e20d1e027cb2c138.zip
image uploads
Diffstat (limited to 'src/components')
-rw-r--r--src/components/AppHeader.svelte25
-rw-r--r--src/components/Qr.svelte5
2 files changed, 20 insertions, 10 deletions
diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte
index 7b3987d5..35e6f250 100644
--- a/src/components/AppHeader.svelte
+++ b/src/components/AppHeader.svelte
@@ -1,6 +1,4 @@
<script>
- // we will want to dynamically use the users avatar on this screen if they have uploaded one
-
import OutClick from 'svelte-outclick';
import { user, newPayment, colorTheme } from '$lib/store';
import { goto } from '$app/navigation';
@@ -26,9 +24,11 @@
goto(`/${$user.username + '/' + item}`);
}
};
+
+ $: background = $user?.banner ? `url(/api/public/${$user.username}-banner.png)` : undefined;
</script>
-<header class="bg-gradient-to-r {$colorTheme} h-[175px] w-full relative">
+<header class="bg-gradient-to-r {$colorTheme} h-[175px] w-full relative" style:background>
<nav class="flex justify-end items-center space-x-4 p-5">
{#if $user}
<a href={`/${$user.username}/receive`}>
@@ -91,11 +91,20 @@
</a>
{/if}
</nav>
- <div
- class="absolute top-[calc(175px-48px)] {avatarPosition} rounded-full border-4 border-white p-4 bg-gradient-to-r {$colorTheme} w-24 h-24"
- >
- <Icon icon="logo-symbol-white" style="mx-auto" />
- </div>
+ {#if $user.profile}
+ <div class="absolute top-[calc(175px-48px)] {avatarPosition} rounded-full overflow-hidden text-center w-24 h-24 my-auto">
+ <img
+ src={`/api/public/${$user.username}-profile.png`}
+ class="absolute w-full h-full object-cover object-center visible overflow-hidden"
+ />
+ </div>
+ {:else}
+ <div
+ class="absolute top-[calc(175px-48px)] {avatarPosition} rounded-full border-4 border-white p-4 bg-gradient-to-r {$colorTheme} w-24 h-24"
+ >
+ <Icon icon="logo-symbol-white" style="mx-auto" />
+ </div>
+ {/if}
</header>
<style>
diff --git a/src/components/Qr.svelte b/src/components/Qr.svelte
index 52bb7a65..4929137a 100644
--- a/src/components/Qr.svelte
+++ b/src/components/Qr.svelte
@@ -5,7 +5,8 @@
export let image, text, qr;
- onMount(async () => {
+ $: update(text);
+ let update = async (text) => {
if (!(browser && text)) return;
let { default: QRCodeStyling } = await import('qr-code-styling');
@@ -28,7 +29,7 @@
while (qr.firstChild) qr.removeChild(qr.lastChild);
qrCode.append(qr);
- });
+ }
</script>
<div bind:this={qr} on:click={() => copy(text)} />