diff options
| author | Adam Soltys <[email protected]> | 2023-01-27 20:58:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-27 20:58:08 -0800 |
| commit | 2dbd712039e4268c6cf8e6240033caf464ebcd50 (patch) | |
| tree | 7f3dc97f2b37b06c8193183f611b5b5abcb0f5e7 /src/components/Lnurlp.svelte | |
| parent | 1ff3877220343972ba8e7008b7338b41cc4c876d (diff) | |
| download | coinos-ui-2dbd712039e4268c6cf8e6240033caf464ebcd50.tar.gz coinos-ui-2dbd712039e4268c6cf8e6240033caf464ebcd50.zip | |
lnurlw
Diffstat (limited to 'src/components/Lnurlp.svelte')
| -rw-r--r-- | src/components/Lnurlp.svelte | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/components/Lnurlp.svelte b/src/components/Lnurlp.svelte new file mode 100644 index 00000000..22364fcf --- /dev/null +++ b/src/components/Lnurlp.svelte @@ -0,0 +1,58 @@ +<script> + import { t } from '$lib/translations'; + import { enhance } from '$app/forms'; + import { Numpad, Spinner } from '$comp'; + import { pin } from '$lib/store'; + + export let data, form; + let { currency } = data.user; + let { minSendable, maxSendable, callback, metadata } = data; + + let amount = minSendable, + loading; + let submit = () => (loading = true); +</script> + +<div class="container px-4 mt-20 max-w-xl mx-auto"> + <div class="text-center mb-8"> + {#each JSON.parse(metadata) as m} + <div> + {#if m[0] === 'text/plain'} + <h1 class="text-3xl md:text-4xl font-semibold mb-2">{m[1]}</h1> + {/if} + {#if m[0].includes('image')} + <img src={`data:image/png;base64,${m[1]}`} alt="Recipient" /> + {/if} + </div> + {/each} + </div> + + {#if form?.error} + <div class="text-red-600 text-center mb-5"> + {form.error} + </div> + {/if} + + <Numpad bind:amount {currency} /> + + <form action="?/pay" method="POST" use:enhance on:submit={submit}> + <input name="amount" value={amount} type="hidden" /> + <input name="minSendable" value={minSendable} type="hidden" /> + <input name="maxSendable" value={maxSendable} type="hidden" /> + <input name="callback" value={callback} type="hidden" /> + <input name="pin" value={$pin} type="hidden" /> + + <div class="flex w-full"> + <button + type="submit" + class="opacity-100 hover:opacity-80'} rounded-2xl border py-3 font-bold mx-auto mt-2 bg-black text-white px-4 w-24" + > + {#if loading} + <Spinner /> + {:else} + {$t('payments.send')} + {/if} + </button> + </div> + </form> +</div> |
