Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions src/components/modals/DepositModal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<script>
import { onMount } from 'svelte';
import { deposit } from '../../lib/pool';
import { balance } from '../../lib/wallet';
import { toasts } from '../../lib/toasts';
import Modal from './Modal.svelte';
import Button from '../Button.svelte';
}
}
Comment on lines +8 to +9

function setMaxAmount() {
amount = $balance;
}

</script>

<style>

<Modal title='Deposit' show={showModal} on:close={closeModal}>

<div class='balance-row'>
<span class='label'>Wallet Balance</span>
<span class='balance-value' on:click={setMaxAmount}>{$balance ? $balance.toFixed(6) : '0.000000'}</span>
</div>

<Input label='Amount' type='number' bind:value={amount} />

<Button on:click={submit} isLoading={isSubmitting}>Deposit</Button>
</Modal>

<style>
.balance-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
font-size: 0.875rem;
}
.label {
color: var(--text-secondary);
}
.balance-value {
color: var(--text-primary);
cursor: pointer;
font-weight: 500;
text-decoration: underline;
}
.balance-value:hover {
color: var(--primary);
}
</style>
<script>
import { onMount } from 'svelte';
import { withdraw } from '../../lib/pool';
Comment on lines +41 to +43
import { poolShare } from '../../lib/pool';
import { toasts } from '../../lib/toasts';
import Modal from './Modal.svelte';
import Button from '../Button.svelte';
}
}

function setMaxAmount() {
amount = $poolShare;
}

</script>

<style>

<Modal title='Withdraw' show={showModal} on:close={closeModal}>

<div class='balance-row'>
<span class='label'>Available to Withdraw</span>
<span class='balance-value' on:click={setMaxAmount}>{$poolShare ? $poolShare.toFixed(6) : '0.000000'}</span>
</div>

<Input label='Amount' type='number' bind:value={amount} />

<Button on:click={submit} isLoading={isSubmitting}>Withdraw</Button>
</Modal>

<style>
.balance-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
font-size: 0.875rem;
}
.label {
color: var(--text-secondary);
}
.balance-value {
color: var(--text-primary);
cursor: pointer;
font-weight: 500;
text-decoration: underline;
}
.balance-value:hover {
color: var(--primary);
}
</style>