aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/InvoiceData.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-05 00:10:30 -0800
committerAdam Soltys <[email protected]>2024-11-05 00:10:30 -0800
commit674de46a6a9f1b793313b5c027a34d396217ed84 (patch)
tree1000b455727ac54e78e0cdeee72e9e2b63257198 /src/components/InvoiceData.svelte
parent4ef5028356e566220e9f1588757800db8a739aed (diff)
downloadcoinos-ui-674de46a6a9f1b793313b5c027a34d396217ed84.tar.gz
coinos-ui-674de46a6a9f1b793313b5c027a34d396217ed84.zip
dark styles
Diffstat (limited to 'src/components/InvoiceData.svelte')
-rw-r--r--src/components/InvoiceData.svelte72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/components/InvoiceData.svelte b/src/components/InvoiceData.svelte
new file mode 100644
index 00000000..7723eb56
--- /dev/null
+++ b/src/components/InvoiceData.svelte
@@ -0,0 +1,72 @@
+<script>
+ import { btc, f, sat, s, sats } from "$lib/utils";
+ export let showQr,
+ src,
+ link,
+ qr,
+ txt,
+ invoice,
+ amount,
+ amountFiat,
+ currency,
+ tip,
+ rate;
+</script>
+
+{#if showQr}
+ <div>
+ <a href={link}>
+ <img
+ {src}
+ class="mx-auto z-10 max-w-[360px] border-4 border-white"
+ bind:this={qr}
+ alt={txt}
+ />
+ </a>
+ </div>
+{/if}
+
+{#if !showQr || !txt.startsWith("ln")}
+ <div class="break-all text-center text-secondary text-xl">
+ {txt}
+ </div>
+{/if}
+
+{#each invoice.items as i}
+ <div class="grid grid-cols-12 text-xl">
+ <div class="col-span-1 my-auto">{i.quantity}</div>
+ <div class="mr-auto grow col-span-7 my-auto">
+ {i.name}
+ </div>
+ <div class="col-span-2 font-semibold text-right my-auto">
+ {f(i.price * i.quantity, currency)}
+ </div>
+ <div class="col-span-2 text-secondary text-right text-lg my-auto">
+ {sat(btc(i.price * i.quantity, rate))}
+ </div>
+ </div>
+{/each}
+
+{#if amount > 0}
+ <div class="text-center font-bold text-2xl">
+ <div>
+ {f(amountFiat, currency)}
+
+ {#if tip}
+ <span class="text-sm">
+ +{f(tip * (rate / sats), currency)}
+ </span>
+ {/if}
+ </div>
+ <div>
+ <span class="text-secondary font-normal text-xl">⚡️{`${s(amount)}`}</span
+ >
+
+ {#if tip}
+ <span class="text-sm text-secondary font-normal">
+ +⚡️{s(tip)}
+ </span>
+ {/if}
+ </div>
+ </div>
+{/if}