Skip to content

Commit

Permalink
refactor(frontend): update IcSendReview component
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysKarmazynDFINITY committed Oct 8, 2024
1 parent f34d778 commit 7e30b37
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions src/frontend/src/icp/components/send/IcSendReview.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
<script lang="ts">
import { isNullish, nonNullish } from '@dfinity/utils';
import { createEventDispatcher, getContext } from 'svelte';
import IcFeeDisplay from '$icp/components/send/IcFeeDisplay.svelte';
import IcReviewNetwork from '$icp/components/send/IcReviewNetwork.svelte';
import { isNullish } from '@dfinity/utils';
import { getContext } from 'svelte';
import { isInvalidDestinationIc } from '$icp/utils/ic-send.utils';
import { SEND_CONTEXT_KEY, type SendContext } from '$icp-eth/stores/send.store';
import SendData from '$lib/components/send/SendData.svelte';
import Button from '$lib/components/ui/Button.svelte';
import ButtonBack from '$lib/components/ui/ButtonBack.svelte';
import ButtonGroup from '$lib/components/ui/ButtonGroup.svelte';
import ContentWithToolbar from '$lib/components/ui/ContentWithToolbar.svelte';
import { balance } from '$lib/derived/balances.derived';
import { i18n } from '$lib/stores/i18n.store';
import SendReview from '$lib/components/send/SendReview.svelte';
import type { NetworkId } from '$lib/types/network';
import { invalidAmount } from '$lib/utils/input.utils';
Expand All @@ -20,7 +12,7 @@
export let networkId: NetworkId | undefined = undefined;
export let source: string;
const { sendToken, sendTokenStandard } = getContext<SendContext>(SEND_CONTEXT_KEY);
const { sendTokenStandard } = getContext<SendContext>(SEND_CONTEXT_KEY);
// Should never happen given that the same checks are performed on previous wizard step
let invalid = true;
Expand All @@ -32,22 +24,6 @@
networkId
}) ||
invalidAmount(amount);
const dispatch = createEventDispatcher();
</script>

<ContentWithToolbar>
{#if nonNullish($sendToken)}
<SendData {amount} {destination} token={$sendToken} balance={$balance} {source}>
<IcFeeDisplay slot="fee" {networkId} />
<IcReviewNetwork {networkId} slot="network" />
</SendData>
{/if}

<ButtonGroup slot="toolbar">
<ButtonBack on:click={() => dispatch('icBack')} />
<Button disabled={invalid} on:click={() => dispatch('icSend')}>
{$i18n.send.text.send}
</Button>
</ButtonGroup>
</ContentWithToolbar>
<SendReview {source} {amount} {destination} disabled={invalid} />

0 comments on commit 7e30b37

Please sign in to comment.