blob: 380336d39257cc8c35dee67b9f22848e29d16cd0 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<script>
import { enhance, applyAction } from "$app/forms";
import { t } from "$lib/translations";
import Icon from "$comp/Icon.svelte";
import Numpad from "$comp/Numpad.svelte";
import Spinner from "$comp/Spinner.svelte";
import { page } from "$app/stores";
import { rate } from "$lib/store";
import { fail, s } from "$lib/utils";
import handler from "$lib/handler";
export let data;
let { rates, user, wellrates } = data;
let { balance, username } = user;
let currency = "CAD";
rates["CAD"] = wellrates.sellMarketRate;
let amount = 0;
let submit, fiat;
$: update(data);
let update = () => ($rate = data.rates[currency]);
let setMax = () => {
fiat = false;
amount = balance;
};
let submitting;
let toggle = () => (submitting = !submitting);
let email;
</script>
<a href="/send">
<button type="button" class="ml-5 md:ml-20 mt-5 md:mt-10 hover:opacity-80">
<Icon icon="arrow-left" style="w-10" />
</button>
</a>
<div class="container px-4 max-w-xl mx-auto space-y-5 text-center">
<h1 class="text-3xl md:text-4xl font-semibold mb-2">Send e-Transfer</h1>
<img src="/images/well.svg" class="w-72 mx-auto" />
<input
type="text"
name="email"
bind:value={email}
placeholder="Recipient email"
/>
<form use:enhance={handler(toggle)} method="POST">
<Numpad bind:amount bind:fiat {currency} {submit} bind:rate={$rate} />
<input type="hidden" name="amount" bind:value={amount} />
<div class="flex justify-center gap-2">
<button
type="button"
class="hover:opacity-80 bg-black text-white rounded-2xl py-3 px-4 mt-2 border font-bold"
on:click|preventDefault={setMax}
disabled={submitting}
on:keydown={setMax}>Max ⚡️{s(balance)}</button
>
<button
use:focus
bind:this={submit}
type="submit"
class="opacity-100 hover:opacity-80 rounded-2xl border py-3 font-bold mt-2 bg-black text-white px-4 w-24"
>
{#if submitting}
<Spinner />
{:else}
Send
{/if}
</button>
</div>
</form>
</div>
|