diff options
| author | Adam Soltys <[email protected]> | 2023-05-03 10:45:56 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-05-26 11:47:17 -0700 |
| commit | 1ffbf4f91c9112080bae0953ec7abe86d16a1d94 (patch) | |
| tree | 3784e27bccd50f7cc6f4d140bb5b564e0c4a18a6 /src | |
| parent | 6fa039f234c850741851e0f97b03752b76f4b2a6 (diff) | |
| download | coinos-ui-1ffbf4f91c9112080bae0953ec7abe86d16a1d94.tar.gz coinos-ui-1ffbf4f91c9112080bae0953ec7abe86d16a1d94.zip | |
display address
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+page.svelte | 2 | ||||
| -rw-r--r-- | src/routes/(app)/buy/+page.server.js | 6 | ||||
| -rw-r--r-- | src/routes/(app)/buy/+page.svelte | 20 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index 02f5f9ea..ecdfeb1a 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -104,7 +104,7 @@ </a> <a href={`/buy`}> - <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60"> + <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60 bg-black text-white"> <div class="mx-auto flex"> <!-- <Icon icon="plus" style="my-auto h-6 mr-2" /> --> diff --git a/src/routes/(app)/buy/+page.server.js b/src/routes/(app)/buy/+page.server.js index fc7ae473..b97ac88b 100644 --- a/src/routes/(app)/buy/+page.server.js +++ b/src/routes/(app)/buy/+page.server.js @@ -3,6 +3,12 @@ import { error, fail, redirect } from '@sveltejs/kit'; import { post, auth } from '$lib/utils'; import { createTicket } from '$lib/ticket'; +export let load = async ({ cookies }) => { + let invoice = await post('/invoice', { invoice: { type: 'bitcoin' }}, auth(cookies)); + let { hash } = invoice; + return { address: hash }; +} + export const actions = { default: async ({ cookies, request }) => { let form = await request.formData(); diff --git a/src/routes/(app)/buy/+page.svelte b/src/routes/(app)/buy/+page.svelte index 05e003df..bf4d3889 100644 --- a/src/routes/(app)/buy/+page.svelte +++ b/src/routes/(app)/buy/+page.svelte @@ -1,6 +1,9 @@ <script> import { Icon } from '$comp'; - import { ONRAMPER } from '$env/static/private'; + import { copy } from '$lib/utils'; + import { PUBLIC_ONRAMPER } from '$env/static/public'; + export let data; + let { address } = data; </script> <div class="container px-4 max-w-xl mx-auto mt-10 space-y-5"> @@ -10,11 +13,24 @@ </a> </div> + <div class="pt-10"> + <div class="flex w-full justify-center">Your bitcoin address</div> + <div class="flex w-full justify-center font-bold"> + <div> + {address} + </div> + </div> + <button class="flex mx-auto mt-5" on:click={() => copy(address)} + ><Icon icon="copy" style="w-10 max-w-none" /> + <div class="my-auto">Copy</div></button + > + </div> + <div class="flex justify-center items-center"> <div class="shadow-xl rounded-3xl px-10 pt-5 pb-10 space-y-5 w-full mx-5"> <iframe style="border-radius: 4px; border: 1px solid #58585f; margin: auto;max-width: 420px" - src={`https://buy.onramper.com/?apiKey=${ONRAMPER}`} + src={`https://buy.onramper.com/?apiKey=${PUBLIC_ONRAMPER}`} height="630px" width="420px" title="Onramper widget" |
