aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Invoice.svelte
blob: d68824a81c1af5a7e8039cb795b92b1499bd8861 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script>
	import { f, sat, sats } from '$lib/utils';
	import { fly } from 'svelte/transition';
	import { Avatar, Icon } from '$comp';
	import { invoice } from '$lib/store';

	export let user;
</script>

{#if $invoice}
	<div class="fixed bottom-0 border-t w-full p-4 bg-white z-50" in:fly>
		<div class="flex flex-wrap md:flex-nowrap max-w-xl mx-auto gap-2">
			<div class="my-auto mx-auto">
				<div class="flex">
					<Avatar user={$invoice.user.username} size={12} />
					<h1 class="my-auto">
						<b>{$invoice.user.username}</b> sent an invoice for
						<b>{f(($invoice.amount * $invoice.rate) / sats, $invoice.currency)}</b>
						{sat($invoice.amount)}
					</h1>
				</div>
			</div>
			<div class="mx-auto my-auto flex gap-2">
				<a href={`/invoice/${$invoice.uuid}/tip`}>
					<button class="text-lg rounded-full border py-3 px-7 font-bold hover:opacity-80 w-40">
						Pay
					</button>
				</a>
				<button
					class="text-lg rounded-full border py-3 px-7 font-bold hover:opacity-80 w-40"
					on:click={() => ($invoice = undefined)}
				>
					Dismiss
				</button>
			</div>
		</div>
	</div>
{/if}