From 66a6935a7050be9490780102bd80205f7c1ff6c3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 26 Sep 2022 23:56:19 -0700 Subject: tip refactoring --- src/components/Tip.svelte | 212 ++++++++++++++++++++++++++++ src/components/index.js | 1 + src/lib/utils.js | 5 + src/routes/invoice/+server.js | 17 +-- src/routes/invoice/[id]/+page.svelte | 221 +++--------------------------- src/routes/invoice/[id]/paid/+page.svelte | 4 +- 6 files changed, 241 insertions(+), 219 deletions(-) create mode 100644 src/components/Tip.svelte (limited to 'src') diff --git a/src/components/Tip.svelte b/src/components/Tip.svelte new file mode 100644 index 00000000..44728326 --- /dev/null +++ b/src/components/Tip.svelte @@ -0,0 +1,212 @@ + + +
+
+ + +
+

{$t('invoice.addTipq')}

+ {#if !showCustomAmount} +
+ {f(tipAmount, currency)}{`(${s(tip)} SAT)`} + {Math.round(tipPercent)}% +
+ + (showMobileTip = false)} + /> + {/if} +
+ {#if !showCustomAmount} + {#each tipAmounts as amount} + + {/each} + {/if} + {#if showCustomAmount} +
+ $ + handleCustomTipAmount(e)} + class="pl-10" + placeholder="Other" + /> + + +
+ {:else} +
+ +
+ {/if} +
+
+ +