From c230185c795b8518e4d94d1cbe80c2596be53ecf Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 08:31:25 -0600 Subject: add mobile view with dynamic tipping menu --- src/routes/invoice/[amount].svelte | 284 +++++++++++++++++++++++-------------- static/icons/heart.svg | 3 + 2 files changed, 177 insertions(+), 110 deletions(-) create mode 100644 static/icons/heart.svg diff --git a/src/routes/invoice/[amount].svelte b/src/routes/invoice/[amount].svelte index 2cf16e37..d1dea907 100644 --- a/src/routes/invoice/[amount].svelte +++ b/src/routes/invoice/[amount].svelte @@ -74,6 +74,9 @@ type: 'svg', data: text, image: '/images/invoice.svg', + backgroundOptions: { + color: 'rgba(0, 0, 0, 0)' + }, dotsOptions: { type: 'rounded' }, @@ -85,132 +88,189 @@ qrCode.append(document.getElementById('qr')); } }); + + let showMobileTip = false; + + const handleBackButton = () => { + if (showMobileTip) { + tipPercent = 0; + customInput.value = ''; + customTipAmount = 0; + tipAmount = 0; + showMobileTip = false; + } else { + goto('/receive'); + } + }; + + let customInput; {#if $user} - - -
-
- {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} - -
-

Add a tip?

- -
- {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {tipPercent}% -
- - { - customTipAmount = ''; - tipPercent = e.target.value; - }} - /> +
+ + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

-
- {#each tipAmounts as amount} - + {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {/each} + {tipPercent}% +
-
- $ - handleCustomTipAmount(e)} - class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" - placeholder="Other" - /> - + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
-
- -
- - -
- Scan to pay insert name here
-
-
- Invoice - {invoiceAmountFiatFormatted} - {`(${invoiceAmountFormatted} SATS)`} -
- -
- Tip - {tipAmountFormatted} - {`(${tipAmountSats} SATS)`} +
+
+ + Add a tip + + + Scan to pay {$user.username} -
- Total - {totalAmountFormatted} - {`(${totalAmountSats} SATS)`} +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
-
- {:else} -
-
-
- {/if} + {:else} +
+
+
+ {/if} +
{/if} @@ -255,4 +315,8 @@ input[type='number'] { -moz-appearance: textfield; } + + .full-shadow { + box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, 0.25); + } diff --git a/static/icons/heart.svg b/static/icons/heart.svg new file mode 100644 index 00000000..f3a5f757 --- /dev/null +++ b/static/icons/heart.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3