diff options
| author | Adam Soltys <[email protected]> | 2026-02-27 23:45:57 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-27 23:45:57 -0800 |
| commit | a13df7e6333514843a12832f6d75ce5a4a8eade9 (patch) | |
| tree | 66685c5487ee571e18e0e18575ca2608d4a04273 /src/routes/(app)/settings/profile | |
| parent | 7f52cb3b1613e8acb50755483ef210a4f9e15ac3 (diff) | |
| download | coinos-ui-a13df7e6333514843a12832f6d75ce5a4a8eade9.tar.gz coinos-ui-a13df7e6333514843a12832f6d75ce5a4a8eade9.zip | |
ui updates
Diffstat (limited to 'src/routes/(app)/settings/profile')
| -rw-r--r-- | src/routes/(app)/settings/profile/+page.svelte | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/routes/(app)/settings/profile/+page.svelte b/src/routes/(app)/settings/profile/+page.svelte index 201a9c30..a6e86d58 100644 --- a/src/routes/(app)/settings/profile/+page.svelte +++ b/src/routes/(app)/settings/profile/+page.svelte @@ -3,6 +3,9 @@ import { avatar, banner as bannerStore } from "$lib/store"; import { t } from "$lib/translations"; import { page } from "$app/stores"; + import { copy } from "$lib/utils"; + import { bech32 } from "@scure/base"; + import { PUBLIC_DOMAIN } from "$env/static/public"; import PasswordInput from "$comp/PasswordInput.svelte"; let { data } = $props(); @@ -60,6 +63,20 @@ let full = $derived(`${$page.url.protocol}//${url}`); let addr = $derived(`${username}@${$page.url.host}`); + let { encode, toWords } = bech32; + let stripped = $derived((username as string)?.replace(/\s/g, "")); + let lnurl = $derived( + stripped + ? encode( + "lnurl", + toWords( + new TextEncoder().encode(`https://${PUBLIC_DOMAIN}/p/${user?.anon ? user.npub : stripped}`), + ), + 20000, + ) + : "", + ); + $effect(() => { if (!user) return; if (typeof about === "undefined") about = user.about; @@ -179,3 +196,29 @@ <textarea name="about" bind:value={about} placeholder={$t("user.settings.aboutPlaceholder")} ></textarea> </div> + +{#if lnurl} + <div> + <span class="font-bold">{$t("user.paymentCode")}</span> + <div class="flex gap-4"> + <div class="break-all grow text-xl">{lnurl}</div> + <div class="flex mb-auto gap-1"> + <button + type="button" + class="my-auto" + aria-label="Copy payment code" + onclick={() => copy(`lightning:${lnurl}`)} + > + <iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon> + </button> + <a + href={`/${username}/accepted/${encodeURIComponent(`lightning:${lnurl}`)}`} + class="my-auto" + aria-label="Show payment code QR" + > + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> + </a> + </div> + </div> + </div> +{/if} |
