diff --git a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte index a74cfea3f57..cd139d7f688 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte @@ -6,11 +6,13 @@ import { chainConfig } from '$chainConfig'; import { FlatAlert } from '$components/Alert'; import ChainSelectorWrapper from '$components/Bridge/ChainSelectorWrapper.svelte'; + import { Button } from '$components/Button'; import { Card } from '$components/Card'; import { successToast, warningToast } from '$components/NotificationToast'; import { errorToast, infoToast } from '$components/NotificationToast/NotificationToast.svelte'; import { OnAccount } from '$components/OnAccount'; import { OnNetwork } from '$components/OnNetwork'; + import { Step, Stepper } from '$components/Stepper'; import { TokenDropdown } from '$components/TokenDropdown'; import { type BridgeArgs, @@ -41,8 +43,18 @@ import Amount from './Amount.svelte'; import { ProcessingFee } from './ProcessingFee'; import Recipient from './Recipient.svelte'; - import { bridgeService, destNetwork, enteredAmount, processingFee, recipientAddress, selectedToken } from './state'; - + import { + activeBridge, + bridgeService, + destNetwork, + enteredAmount, + processingFee, + recipientAddress, + selectedToken, + } from './state'; + import { BridgeTypes, NFTSteps } from './types'; + + let activeStep: NFTSteps = NFTSteps.IMPORT; let amountComponent: Amount; let recipientComponent: Recipient; let processingFeeComponent: ProcessingFee; @@ -296,33 +308,68 @@ } } } + + const nextStep = () => (activeStep = Math.min(activeStep + 1, NFTSteps.CONFIRM)); + const back = () => (activeStep = Math.max(activeStep - 1, NFTSteps.IMPORT)); + + let nftStepTitle: string; + let nftStepDescription: string; + + $: { + const stepKey = NFTSteps[activeStep].toLowerCase(); // Convert enum to string and to lowercase + nftStepTitle = $t(`bridge.title.nft.${stepKey}`); + nftStepDescription = $t(`bridge.description.nft.${stepKey}`); + } + $: if ($selectedToken && amountComponent) { amountComponent.validateAmount(); } - -
-
- -
+{#if $activeBridge === BridgeTypes.FUNGIBLE} + +
+
+ +
- - {#if $selectedToken?.symbol === 'BLL' && !$selectedToken?.imported} - - {/if} - + + {#if $selectedToken?.symbol === 'BLL' && !$selectedToken?.imported} + + {/if} + -
- - -
+
+ + +
-
+
- + +
+ +{:else if $activeBridge === BridgeTypes.NFT} +
+ + {$t('bridge.title.nft.import')} + {$t('bridge.title.nft.review')} + {$t('bridge.title.nft.confirm')} + + + +
+ + +
+
- +{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/BridgeTabs.svelte b/packages/bridge-ui-v2/src/components/Bridge/BridgeTabs.svelte index b5a4b7c1495..4235447004c 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/BridgeTabs.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/BridgeTabs.svelte @@ -1,25 +1,37 @@ {#if PUBLIC_NFT_BRIDGE_ENABLED === 'true'}
- + - +
{/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/state.ts b/packages/bridge-ui-v2/src/components/Bridge/state.ts index 3a9ea5360c7..7b9c406ee73 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/state.ts +++ b/packages/bridge-ui-v2/src/components/Bridge/state.ts @@ -5,6 +5,8 @@ import { bridges } from '$libs/bridge'; import { chains } from '$libs/chain'; import type { Token } from '$libs/token'; +import { type BridgeType, BridgeTypes } from './types'; + // Note: we could combine this with Context API, but since we'll only // have one Bridge component, it would be an overkill. If we wanted to // instantiate multiple Bridge components, then we'd need to use @@ -14,6 +16,7 @@ import type { Token } from '$libs/token'; // but once again, we don't need such level of security that we have to // prevent other components outside the Bridge from accessing this store. +export const activeBridge = writable(BridgeTypes.FUNGIBLE); export const selectedToken = writable>(null); export const tokenBalance = writable>(null); export const enteredAmount = writable(BigInt(0)); diff --git a/packages/bridge-ui-v2/src/components/Bridge/types.ts b/packages/bridge-ui-v2/src/components/Bridge/types.ts new file mode 100644 index 00000000000..ff01ce4e5b0 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/types.ts @@ -0,0 +1,12 @@ +export enum BridgeTypes { + FUNGIBLE = 'FUNGIBLE', + NFT = 'NFT', +} + +export enum NFTSteps { + IMPORT, + REVIEW, + CONFIRM, +} + +export type BridgeType = BridgeTypes;