diff --git a/packages/ui-components/src/lib/components/deployment/wizard/DeploymentSteps.svelte b/packages/ui-components/src/lib/components/deployment/wizard/DeploymentSteps.svelte index 177e65b75..3c469daff 100644 --- a/packages/ui-components/src/lib/components/deployment/wizard/DeploymentSteps.svelte +++ b/packages/ui-components/src/lib/components/deployment/wizard/DeploymentSteps.svelte @@ -4,14 +4,6 @@ import SelectToken from '../SelectToken.svelte'; import TokenInputButtons from './TokenInputButtons.svelte'; import TokenOutputButtons from './TokenOutputButtons.svelte'; - import type { - WizardStep, - SelectTokenStep, - FieldStep, - DepositStep, - TokenInputStep, - TokenOutputStep - } from '../../../types/wizardSteps'; import type { DotrainOrderGui, @@ -22,6 +14,8 @@ Vault } from '@rainlanguage/orderbook/js_api'; import { Button } from 'flowbite-svelte'; + import { getDeploymentSteps } from './getDeploymentSteps'; + import deploymentStore from './deploymentStore'; export let gui: DotrainOrderGui; export let selectTokens: SelectTokens; @@ -36,65 +30,24 @@ export let handleAddOrder: () => Promise; export let tokenInfos: TokenInfos; - $: if (currentStep) { - const fieldValues = gui.getAllFieldValues(); - console.log(fieldValues); - } - - let deploymentSteps: WizardStep[] = [ - ...(selectTokens.size > 0 && isLimitStrat - ? Array.from(selectTokens.entries()).map( - ([token]): SelectTokenStep => ({ - type: 'tokens', - token, - gui, - selectTokens - }) - ) - : []), + let deploymentSteps = getDeploymentSteps( + selectTokens, + isLimitStrat, + allFieldDefinitions, + gui, + allDeposits, + allTokenInputs, + allTokenOutputs, + inputVaultIds, + outputVaultIds, + tokenInfos + ); - ...allFieldDefinitions.map( - (fieldDefinition): FieldStep => ({ - type: 'fields', - fieldDefinition, - gui - }) - ), + deploymentStore.populateDeploymentSteps(deploymentSteps); - ...allDeposits.map( - (deposit): DepositStep => ({ - type: 'deposits', - deposit, - gui, - tokenInfos - }) - ), - - ...allTokenInputs.map( - (input, i): TokenInputStep => ({ - type: 'tokenInput', - input, - gui, - tokenInfos, - i, - inputVaultIds - }) - ), - ...allTokenOutputs.map( - (output, i): TokenOutputStep => ({ - type: 'tokenOutput', - output, - gui, - tokenInfos, - i, - outputVaultIds - }) - ) - ]; + $: console.log('DEPLOYMENT STEPS', $deploymentStore.deploymentSteps); let currentStep = deploymentSteps[0]; - $: console.log('current step in parent', currentStep); - $: console.log('all steps in parent', deploymentSteps); const nextStep = () => { if (deploymentSteps.indexOf(currentStep) < deploymentSteps.length - 1) @@ -124,14 +77,7 @@ {/if} -
- {#if deploymentSteps.indexOf(currentStep) > 0} {/if} diff --git a/packages/ui-components/src/lib/components/deployment/wizard/FieldDefinitionButtons.svelte b/packages/ui-components/src/lib/components/deployment/wizard/FieldDefinitionButtons.svelte index b4f81df15..078101eef 100644 --- a/packages/ui-components/src/lib/components/deployment/wizard/FieldDefinitionButtons.svelte +++ b/packages/ui-components/src/lib/components/deployment/wizard/FieldDefinitionButtons.svelte @@ -1,12 +1,21 @@