-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): ConvertAmount component (#3632)
# Motivation In this PR, except a new component, I also updated related prop types according to the latest change from main. Desktop: <img width="492" alt="Screenshot 2024-11-18 at 10 58 41" src="https://github.com/user-attachments/assets/e5a510bf-ce42-459c-bdc0-28236b69822c"> Mobile: <img width="415" alt="Screenshot 2024-11-18 at 10 58 48" src="https://github.com/user-attachments/assets/6182ec8f-dcf0-424f-9bcd-843d0bc331c7">
- Loading branch information
1 parent
34d3bfd
commit 74e3dc7
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/frontend/src/lib/components/convert/ConvertAmount.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script lang="ts"> | ||
import ConvertAmountDestination from '$lib/components/convert/ConvertAmountDestination.svelte'; | ||
import ConvertAmountSource from '$lib/components/convert/ConvertAmountSource.svelte'; | ||
import IconMoveDown from '$lib/components/icons/lucide/IconMoveDown.svelte'; | ||
import type { OptionAmount } from '$lib/types/send'; | ||
export let sendAmount: OptionAmount; | ||
export let receiveAmount: number | undefined; | ||
export let totalFee: bigint | undefined; | ||
export let insufficientFunds: boolean; | ||
export let insufficientFundsForFee: boolean; | ||
</script> | ||
|
||
<ConvertAmountSource | ||
bind:sendAmount | ||
bind:insufficientFunds | ||
bind:insufficientFundsForFee | ||
{totalFee} | ||
/> | ||
|
||
<div class="my-4 flex justify-center"> | ||
<div class="flex h-12 w-12 items-center justify-center rounded-full bg-secondary"> | ||
<IconMoveDown /> | ||
</div> | ||
</div> | ||
|
||
<ConvertAmountDestination bind:receiveAmount {sendAmount} {totalFee} {insufficientFunds} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/frontend/src/lib/components/convert/ConvertForm.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script lang="ts"> | ||
import { createEventDispatcher } from 'svelte'; | ||
import ConvertAmount from '$lib/components/convert/ConvertAmount.svelte'; | ||
import Button from '$lib/components/ui/Button.svelte'; | ||
import ButtonGroup from '$lib/components/ui/ButtonGroup.svelte'; | ||
import ContentWithToolbar from '$lib/components/ui/ContentWithToolbar.svelte'; | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
import type { OptionAmount } from '$lib/types/send'; | ||
export let sendAmount: OptionAmount; | ||
export let receiveAmount: number | undefined; | ||
export let totalFee: bigint | undefined; | ||
export let disabled: boolean; | ||
export let insufficientFunds: boolean; | ||
export let insufficientFundsForFee: boolean; | ||
const dispatch = createEventDispatcher(); | ||
</script> | ||
|
||
<ContentWithToolbar> | ||
<ConvertAmount | ||
bind:sendAmount | ||
bind:receiveAmount | ||
bind:insufficientFunds | ||
bind:insufficientFundsForFee | ||
{totalFee} | ||
/> | ||
|
||
<div class="mt-16 pb-5"> | ||
<slot name="message" /> | ||
|
||
<slot name="fee" /> | ||
</div> | ||
|
||
<ButtonGroup slot="toolbar"> | ||
<slot name="cancel" /> | ||
|
||
<Button {disabled} on:click={() => dispatch('icNext')}> | ||
{$i18n.convert.text.review_button} | ||
</Button> | ||
</ButtonGroup> | ||
</ContentWithToolbar> |