diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/[username]/index.js | 10 | ||||
| -rw-r--r-- | src/routes/invoice/[id].js | 7 | ||||
| -rw-r--r-- | src/routes/invoice/[id].svelte | 97 | ||||
| -rw-r--r-- | src/routes/invoice/index.js | 2 |
4 files changed, 60 insertions, 56 deletions
diff --git a/src/routes/[username]/index.js b/src/routes/[username]/index.js index 5229cc50..5de1316f 100644 --- a/src/routes/[username]/index.js +++ b/src/routes/[username]/index.js @@ -4,11 +4,11 @@ export async function GET({ params }) { let { username } = params; let body; - try { - body = await get(`/users/${username}`); - } catch(e) { - body = {}; - } + try { + body = await get(`/users/${username}`); + } catch (e) { + body = {}; + } return { body }; } diff --git a/src/routes/invoice/[id].js b/src/routes/invoice/[id].js index 514e5d69..5f85d192 100644 --- a/src/routes/invoice/[id].js +++ b/src/routes/invoice/[id].js @@ -3,7 +3,12 @@ import { get } from '$lib/utils'; export async function GET({ params }) { let { id } = params; let res = await get(`/invoice?uuid=${id}`); - let { amount, rate, text, user: { username }} = await get(`/invoice?uuid=${id}`); + let { + amount, + rate, + text, + user: { username } + } = await get(`/invoice?uuid=${id}`); return { body: { amount, rate, username, text } }; } diff --git a/src/routes/invoice/[id].svelte b/src/routes/invoice/[id].svelte index 0bb6c41a..b302d12d 100644 --- a/src/routes/invoice/[id].svelte +++ b/src/routes/invoice/[id].svelte @@ -146,10 +146,10 @@ <Icon icon="arrow-left" style="w-10" /> </button> - <div class="flex justify-center items-center mb-20 md:mt-[20px] px-3"> - <div - class="block lg:flex justify-center items-center space-y-10 lg:space-y-0 space-x-0 lg:space-x-24" - > + <div class="flex justify-center items-center mb-20 md:mt-[20px] px-3"> + <div + class="block lg:flex justify-center items-center space-y-10 lg:space-y-0 space-x-0 lg:space-x-24" + > <!-- tipping section --> <div class="w-[100%] md:w-auto absolute {showMobileTip @@ -158,12 +158,12 @@ > <h1 class="hidden md:block text-4xl font-semibold">Add a tip?</h1> - <div> - <span class="font-semibold mr-1">{tipAmountFormatted}</span><span - class="text-secondary font-semibold text-sm">{`(${tipAmountSats} SATS)`}</span - > - <span class="block text-secondary text-sm">{tipPercent}%</span> - </div> + <div> + <span class="font-semibold mr-1">{tipAmountFormatted}</span><span + class="text-secondary font-semibold text-sm">{`(${tipAmountSats} SATS)`}</span + > + <span class="block text-secondary text-sm">{tipPercent}%</span> + </div> <input id="slider" @@ -212,51 +212,50 @@ ? 'opacity-50' : 'opacity-100' : !customTipAmount - - ? 'opacity-50' - : 'opacity-100'}" - disabled={showMobileTip ? !customTipAmount && !tipAmount : !customTipAmount} - on:click={() => (showMobileTip = false)}>Done</button - > + ? 'opacity-50' + : 'opacity-100'}" + disabled={showMobileTip ? !customTipAmount && !tipAmount : !customTipAmount} + on:click={() => (showMobileTip = false)}>Done</button + > + </div> </div> </div> - </div> - <div - class="hidden md:block h-[1px] lg:h-[600px] w-full lg:w-[1px] bg-lightgrey rounded-xl" - id="section-divider" - /> + <div + class="hidden md:block h-[1px] lg:h-[600px] w-full lg:w-[1px] bg-lightgrey rounded-xl" + id="section-divider" + /> - <!-- invoice section --> - <div class="text-center space-y-5"> - <button - class="block md:hidden bg-black {showMobileTip - ? 'text-white/50' - : 'text-white'} rounded-xl px-6 py-3 block text-sm font-semibold mx-auto flex justify-center items-center" - on:click={() => (showMobileTip = true)} - disabled={showMobileTip} - > - <svg - width="24" - height="24" - class="mr-1" - viewBox="0 0 24 24" - fill="none" - xmlns="http://www.w3.org/2000/svg" + <!-- invoice section --> + <div class="text-center space-y-5"> + <button + class="block md:hidden bg-black {showMobileTip + ? 'text-white/50' + : 'text-white'} rounded-xl px-6 py-3 block text-sm font-semibold mx-auto flex justify-center items-center" + on:click={() => (showMobileTip = true)} + disabled={showMobileTip} > - <path - d="M4.31802 6.31802C2.56066 8.07538 2.56066 10.9246 4.31802 12.682L12.0001 20.364L19.682 12.682C21.4393 10.9246 21.4393 8.07538 19.682 6.31802C17.9246 4.56066 15.0754 4.56066 13.318 6.31802L12.0001 7.63609L10.682 6.31802C8.92462 4.56066 6.07538 4.56066 4.31802 6.31802Z" - stroke="currentColor" - stroke-width="2" - stroke-linecap="round" - stroke-linejoin="round" - /> - </svg> Add a tip - </button> + <svg + width="24" + height="24" + class="mr-1" + viewBox="0 0 24 24" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M4.31802 6.31802C2.56066 8.07538 2.56066 10.9246 4.31802 12.682L12.0001 20.364L19.682 12.682C21.4393 10.9246 21.4393 8.07538 19.682 6.31802C17.9246 4.56066 15.0754 4.56066 13.318 6.31802L12.0001 7.63609L10.682 6.31802C8.92462 4.56066 6.07538 4.56066 4.31802 6.31802Z" + stroke="currentColor" + stroke-width="2" + stroke-linecap="round" + stroke-linejoin="round" + /> + </svg> Add a tip + </button> - <span class="text-secondary block" - >Scan to pay <span class="text-black font-semibold">{username}</span></span - > + <span class="text-secondary block" + >Scan to pay <span class="text-black font-semibold">{username}</span></span + > <div bind:this={qr} diff --git a/src/routes/invoice/index.js b/src/routes/invoice/index.js index 8ac33a09..cf26b3c6 100644 --- a/src/routes/invoice/index.js +++ b/src/routes/invoice/index.js @@ -4,7 +4,7 @@ let network = 'lightning'; export async function POST({ request }) { let { amount, rate, username, text } = await request.json(); - if (!text) ({ text } = await post('/lightning/invoice', { amount })); + if (!text) ({ text } = await post('/lightning/invoice', { amount })); let { uuid: id } = await post('/invoice', { invoice: { amount, currency: 'USD', network, rate, text }, user: { username } |
