aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/express/lib/response.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-08-01 22:17:58 -0700
committerAdam Soltys <[email protected]>2022-08-01 22:17:58 -0700
commit99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8 (patch)
treeb2b6b97328cb9ea4b86d7b32e89aa805af29b04b /node_modules/express/lib/response.js
parent82f9acc60b7edbdfee96f1553d0fb1dcc705b866 (diff)
downloadcoinos-server-99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8.tar.gz
coinos-server-99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8.zip
record invoice status
Diffstat (limited to 'node_modules/express/lib/response.js')
0 files changed, 0 insertions, 0 deletions
[email protected]> 2022-08-22 15:49:08 -0700 migrate to sveltekit-i18n' href='/coinos-ui.git/commit/src/routes/[username]/dashboard/+page.svelte?id=fba3b1db97ca738311e2f9de08d42bd72e491eaa'>fba3b1db ^
8c6649ad ^
886f647a ^


f0f31827 ^














f4c85698 ^
f0f31827 ^


14a9420c ^
8c6649ad ^
14a9420c ^
8c6649ad ^
886f647a ^
8c6649ad ^
14a9420c ^
a172e632 ^

886f647a ^



2ce44501 ^
886f647a ^







ac6aaa74 ^






886f647a ^




ac6aaa74 ^
886f647a ^

ac6aaa74 ^
886f647a ^
ac6aaa74 ^




886f647a ^

ac6aaa74 ^
886f647a ^
















8c6649ad ^
886f647a ^



8c6649ad ^
886f647a ^





f0f31827 ^
886f647a ^

8c6649ad ^
886f647a ^
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        
                                                         
                                      
                                                
                                                  
                                              
 


                            














                                                            
                                           


                 
                                                      
 
                                                                                                     
 
                                                                
 
                                                        

         



                                                                                                   
                                                          







                                                                               






                                                                                                                 




                                                                                                          
                                                               

                         
                                                                                                                                                  
 




                                                                                                 

                                                                        
            
















                                                                                                         
 



                                                                                                                                  
 





                                                                                                                                   
                                 

                              
              
      
<script>
	import { f, s, post, failure } from '$lib/utils';
	import { tick } from 'svelte';
	import { AppHeader, Icon } from '$comp';
	import { selectedRate } from '$lib/store';
	import { t } from '$lib/translations';

	export let data;
	$: user = data.user;

	let payreq = '',
		payreqField,
		withdrawing;

	let toggle = async () => {
		withdrawing = !withdrawing;
		await tick();
		if (withdrawing) payreqField.focus();
	};

	let withdraw = async () => {
		try {
			await post('/withdraw', { payreq });
			withdrawing = false;
		} catch (e) {
			failure(e.message);
		}
	};

	$: btcPrice = f($selectedRate, user.currency);

	$: accountBalanceFiat = f(user.account.balance * ($selectedRate / 100000000), user.currency);

	$: accountBalanceBtc = user.account.balance / 100000000;

	$: accountBalanceSats = s(user.account.balance);
</script>

<AppHeader avatarPosition="left-[calc(50vw-48px)] lg:left-[calc(15vw-48px)]" />

<div class="text-center mx-auto lg:text-left lg:mx-0 lg:ml-[calc(15vw-48px)] mt-12 w-full md:w-72">
	<h2 class="text-2xl font-semibold">{user.username}</h2>
	<span class="text-secondary">{user.address}</span>
</div>

<div class="px-3 md:px-0 flex justify-center items-center mt-10 lg:mt-0 mb-20">
	<div>
		<h1 class="text-3xl md:text-4xl font-semibold mb-8">
			{withdrawing ? 'Withdraw' : 'Dashboard'}
		</h1>
		{#if !withdrawing}
			<!-- <span class="text-secondary mx-auto text-lg font-bold" -->
			<!-- 	>{$t('user.dashboard.bitcoinPrice')} -->
			<!-- 	<span class="text-black" -->
			<!-- 		>{$selectedRate ? btcPrice : $t('user.dashboard.fetchingRate')}</span -->
			<!-- 	> -->
			<!-- </span> -->
      <!--  -->
			<h3 class="text-secondary font-bold border-b pb-1 mt-10 mb-6 w-full md:w-[500px]">
				{$t('user.dashboard.ACCOUNT_BALANCE')}
			</h3>

			<span class="text-3xl font-bold block mb-1"
				>{accountBalanceSats} SAT</span
			>

			<span class="text-secondary text-xl block">{$selectedRate ? accountBalanceFiat : $t('user.dashboard.fetchingRate')}</span>

      <div class="flex space-x-5">
			<button class="rounded-full border py-2 font-bold mt-4" on:click={toggle}
				>{$t('user.dashboard.receive')}</button
			>
			<button class="rounded-full border py-2 font-bold mt-4" on:click={toggle}
				>{$t('user.dashboard.withdraw')}</button
			>
      </div>
		{:else}
			<div class="space-y-3 w-[250px] md:w-[500px] md:pr-20">
				<button on:click={() => (withdrawing = false)}>
					<Icon icon="arrow-left" style="w-8" />
				</button>

				<div>
					<label for="invoice" class="font-bold mb-1 block">Invoice</label>
					<input
						bind:this={payreqField}
						type="text"
						name="payreq"
						required
						bind:value={payreq}
						class="block rounded-2xl p-3 w-full bg-primary"
					/>
				</div>

				<div>
					<label for="note" class="font-bold mb-1 block">{$t('user.dashboard.optionalNote')}</label>
					<textarea name="note" rows={2} class="block rounded-2xl p-3 w-full bg-primary" />
				</div>

				<button
					disabled={!payreq}
					class="{!payreq
						? 'opacity-50'
						: 'opacity-100'} rounded-2xl border py-3 font-bold w-full mt-2 bg-black text-white"
					on:click={withdraw}>{$t('user.dashboard.send')}</button
				>
			</div>
		{/if}
	</div>
</div>