Skip to content

Commit

Permalink
types and format
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingjam committed Jan 2, 2025
1 parent 996ab51 commit 462706a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: mockFieldDefinition,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: mockFieldDefinition,
gui: mockGui
}
}
});

Expand All @@ -48,7 +53,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: mockFieldDefinition,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: mockFieldDefinition,
gui: mockGui
}
}
});

Expand All @@ -62,7 +72,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: mockFieldDefinition,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: mockFieldDefinition,
gui: mockGui
}
}
});

Expand All @@ -80,7 +95,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: mockFieldDefinition,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: mockFieldDefinition,
gui: mockGui
}
}
});

Expand All @@ -93,7 +113,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: mockFieldDefinition,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: mockFieldDefinition,
gui: mockGui
}
}
});

Expand All @@ -118,7 +143,12 @@ describe('FieldDefinitionButtons', () => {
props: {
fieldDefinition: fastExitFieldDef,
gui: mockGui,
currentStep: 0
currentStepIndex: 0,
currentStep: {
type: 'fields',
fieldDefinition: fastExitFieldDef,
gui: mockGui
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
export let inputVaultIds: string[];
export let outputVaultIds: string[];
export let isLimitStrat: boolean;
export let useCustomVaultIds: boolean;
export let handleAddOrder: () => Promise<void>;
export let tokenInfos: TokenInfos;
Expand Down Expand Up @@ -74,9 +73,9 @@
{:else if currentStep.type === 'deposits'}
<DepositButtons {...currentStep} />
{:else if currentStep.type === 'tokenInput'}
<TokenInputButtons {...currentStep} {useCustomVaultIds} />
<TokenInputButtons {...currentStep} />
{:else if currentStep.type === 'tokenOutput'}
<TokenOutputButtons {...currentStep} {useCustomVaultIds} />
<TokenOutputButtons {...currentStep} />
{/if}

<div class="flex justify-between gap-4">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script lang="ts">
import { Input } from 'flowbite-svelte';
import type { TokenInfos, Vault, DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
import type { StepType } from '../../../types/wizardSteps';
export let i: number;
export let input: Vault;
export let tokenInfos: TokenInfos;
export let inputVaultIds: string[];
export let gui: DotrainOrderGui;
export let type: StepType;
export let useCustomVaultIds: boolean;
</script>

<div class="flex flex-grow flex-col items-center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<script lang="ts">
import { Label, Input } from 'flowbite-svelte';
import type { TokenInfos, Vault, DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
import type { StepType } from '../../../types/wizardSteps';
export let i: number;
export let output: Vault;
export let tokenInfos: TokenInfos;
export let outputVaultIds: string[];
export let gui: DotrainOrderGui;
export let type: StepType;
export let useCustomVaultIds: boolean;
</script>

<div class="flex items-center gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import type {
} from '@rainlanguage/orderbook/js_api';
import type { WizardStep } from '../../../types/wizardSteps';

// TODO: Add a check to see if the user has selected to use custom token input/outputs
// If they have, then we need to add a step to the wizard to allow them to enter the vault ids
// If they have not, then we can skip this step

export const getDeploymentSteps = (
selectTokens: Map<string, string>,
isLimitStrat: boolean,
Expand Down
4 changes: 1 addition & 3 deletions packages/webapp/src/routes/deployment/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@
{/if}

{#if allFieldDefinitions.length > 0}
<Label class="my-4 whitespace-nowrap border-2 border-red-500 text-2xl underline"
>Field Values</Label
>
<Label class="my-4 whitespace-nowrap text-2xl underline">Field Values</Label>
{#each allFieldDefinitions as fieldDefinition}
<FieldDefinitionDropdown {fieldDefinition} {gui} />
{/each}
Expand Down
3 changes: 0 additions & 3 deletions packages/webapp/src/routes/deployment/new/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,13 @@
}
}
let useCustomVaultIds = false;
let inputVaultIds: string[] = [];
let outputVaultIds: string[] = [];
function initializeVaultIdArrays() {
if (!gui) return;
const deployment = gui.getCurrentDeployment();
inputVaultIds = new Array(deployment.deployment.order.inputs.length).fill('');
outputVaultIds = new Array(deployment.deployment.order.outputs.length).fill('');
useCustomVaultIds = false;
}
</script>

Expand Down Expand Up @@ -226,7 +224,6 @@
<DeploymentSteps
{gui}
{isLimitStrat}
{useCustomVaultIds}
{inputVaultIds}
{outputVaultIds}
{handleAddOrder}
Expand Down

0 comments on commit 462706a

Please sign in to comment.