|
1 | 1 | import { FC, PropsWithChildren, useCallback } from 'react'; |
2 | 2 | import { useForm, FormProvider } from 'react-hook-form'; |
3 | 3 | import { zodResolver } from '@hookform/resolvers/zod'; |
4 | | -import { useCreateVault } from 'features/create-vault/create-vault-form/use-create-vault'; |
5 | 4 |
|
6 | 5 | import { FormController } from 'shared/hook-form/form-controller'; |
7 | 6 |
|
8 | 7 | import { CreateVaultSchema } from 'features/create-vault/types'; |
9 | | -import { createVaultSchema } from './validation'; |
10 | 8 | import { |
11 | 9 | CREATE_VAULT_FORM_STEPS, |
12 | 10 | CREATE_VAULT_STEPS, |
13 | 11 | getSectionNameByStep, |
14 | 12 | } from 'features/create-vault/consts'; |
15 | 13 |
|
16 | | -import { FormTitle, FormBlock } from './styles'; |
| 14 | +import { createVaultSchema } from './validation'; |
| 15 | +import { useCreateVault } from './use-create-vault'; |
| 16 | + |
17 | 17 | import { MainSettings } from './stages/main-settings'; |
18 | 18 | import { Confirmation } from './stages/confirmation'; |
| 19 | +import { ResultOverview } from './stages/result-overview'; |
| 20 | + |
| 21 | +import { FormTitle, FormBlock, FormSubtitle } from './styles'; |
19 | 22 |
|
20 | 23 | import type { Address } from 'viem'; |
21 | | -import { ResultOverview } from './stages/result-overview'; |
22 | 24 |
|
23 | 25 | const defaultValues: CreateVaultSchema = { |
24 | 26 | nodeOperator: '' as Address, |
@@ -53,22 +55,24 @@ export const CreateVaultForm: FC<PropsWithChildren> = () => { |
53 | 55 |
|
54 | 56 | return ( |
55 | 57 | <FormProvider {...formObject}> |
56 | | - <FormBlock> |
57 | | - <FormController onSubmit={onSubmit} retryEvent={retryEvent}> |
| 58 | + <FormController onSubmit={onSubmit} retryEvent={retryEvent}> |
| 59 | + <FormBlock> |
58 | 60 | {mutation.isSuccess ? ( |
59 | 61 | <ResultOverview transactionResult={mutation.data} /> |
60 | 62 | ) : ( |
61 | 63 | <> |
62 | | - Step {step} of {CREATE_VAULT_STEPS} |
| 64 | + <FormSubtitle> |
| 65 | + Step {step} of {CREATE_VAULT_STEPS} |
| 66 | + </FormSubtitle> |
63 | 67 | <FormTitle>{getSectionNameByStep(step)}</FormTitle> |
64 | 68 | <MainSettings isShown={step === CREATE_VAULT_FORM_STEPS.main} /> |
65 | 69 | <Confirmation |
66 | 70 | isShown={step === CREATE_VAULT_FORM_STEPS.confirm} |
67 | 71 | /> |
68 | 72 | </> |
69 | 73 | )} |
70 | | - </FormController> |
71 | | - </FormBlock> |
| 74 | + </FormBlock> |
| 75 | + </FormController> |
72 | 76 | </FormProvider> |
73 | 77 | ); |
74 | 78 | }; |
0 commit comments