aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/[username]/receive/+page.server.js20
-rw-r--r--src/routes/invoice/[id]/+page.server.js5
-rw-r--r--src/routes/invoice/[id]/+page.svelte9
-rw-r--r--src/routes/invoice/[id]/paid/+page.svelte23
4 files changed, 17 insertions, 40 deletions
diff --git a/src/routes/[username]/receive/+page.server.js b/src/routes/[username]/receive/+page.server.js
index 60e94f0e..1068f273 100644
--- a/src/routes/[username]/receive/+page.server.js
+++ b/src/routes/[username]/receive/+page.server.js
@@ -1,21 +1,5 @@
-import { auth, get, post } from '$lib/utils';
-import { redirect } from '@sveltejs/kit';
+import invoice from '$lib/invoice';
export const actions = {
- default: async ({ cookies, request }) => {
- let form = await request.formData();
-
- let invoice = {
- amount: parseInt(form.get('amount')),
- network: 'lightning',
- prompt: form.get('prompt') === 'true',
- rate: await get('/rate')
- };
-
- let user = { username: form.get('username') };
-
- let { uuid } = await post('/invoice', { invoice, user }, auth(cookies));
-
- throw redirect(307, `/invoice/${uuid}`);
- }
+ default: invoice
};
diff --git a/src/routes/invoice/[id]/+page.server.js b/src/routes/invoice/[id]/+page.server.js
new file mode 100644
index 00000000..1068f273
--- /dev/null
+++ b/src/routes/invoice/[id]/+page.server.js
@@ -0,0 +1,5 @@
+import invoice from '$lib/invoice';
+
+export const actions = {
+ default: invoice
+};
diff --git a/src/routes/invoice/[id]/+page.svelte b/src/routes/invoice/[id]/+page.svelte
index 9d140bd5..04a31813 100644
--- a/src/routes/invoice/[id]/+page.svelte
+++ b/src/routes/invoice/[id]/+page.svelte
@@ -19,7 +19,6 @@
user: { username, currency }
} = invoice;
- let showCustomAmount = false;
let showMobileTip = false;
let qr;
@@ -39,15 +38,13 @@
user: { username, currency }
} = invoice);
- amount -= tip;
-
tipPercent = (tip / amount) * 100;
};
$: tip = Math.round((amount / 100) * tipPercent);
$invoices[id] = { amount, id, rate, received, text, tip, username };
- $: $invoices[id]?.received >= $invoices[id]?.amount && goto(`/invoice/${id}/paid`);
+ $: browser && $invoices[id]?.received >= $invoices[id]?.amount && goto(`/invoice/${id}/paid`);
$: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2));
@@ -73,15 +70,11 @@
{#if invoice.prompt}
<Tip
bind:amountFiat
- bind:showCustomAmount
bind:showMobileTip
bind:tipPercent
bind:tipAmount
bind:amount
bind:tip
- bind:rate
- bind:prompt
- bind:text
bind:currency
bind:username
/>
diff --git a/src/routes/invoice/[id]/paid/+page.svelte b/src/routes/invoice/[id]/paid/+page.svelte
index 456ee3ba..1b212a92 100644
--- a/src/routes/invoice/[id]/paid/+page.svelte
+++ b/src/routes/invoice/[id]/paid/+page.svelte
@@ -1,15 +1,19 @@
<script>
+ import { scale } from 'svelte/transition';
+ import { onMount } from 'svelte';
+ import { quintOut } from 'svelte/easing';
+ import { Icon } from '$comp';
import { toast } from '@zerodevx/svelte-toast';
import { browser } from '$app/environment';
import { t } from '$lib/translations';
import { f, s, sats } from '$lib/utils';
- import { LottiePlayer } from '@lottiefiles/svelte-lottie-player';
import { goto } from '$app/navigation';
import { invoices } from '$lib/store';
export let data;
let { invoice } = data;
let { amount, rate } = invoice;
+ let yeah;
toast.pop(0);
@@ -21,19 +25,10 @@
};
</script>
-<div class="text-center mt-20 md:mt-0">
- {#if browser}
- <div class="w-full mx-auto max-w-xl">
- <LottiePlayer
- src="/lottie/success.json"
- autoplay={true}
- loop={true}
- controls={false}
- renderer="svg"
- background="transparent"
- />
- </div>
- {/if}
+<div class="container px-4 text-center">
+ <div class="flex w-full py-10" in:scale={{ start: 0.5 }}>
+ <Icon icon="check" style="mx-auto" />
+ </div>
<h1 class="text-3xl md:text-4xl font-bold mb-6">{$t('invoice.paymentSuccessful')}</h1>
<h2 class="text-2xl md:text-3xl font-semibold">
{f(amountFiat, invoice.currency)}