From 6229830e7075c2aa972074de0d1587b132d707fd Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Tue, 5 Sep 2023 09:14:32 +0300 Subject: [PATCH] fix: clean code and errors --- src/components/General/LinkWithArrow.stories.tsx | 2 +- .../Activation/Activation.stories.ts | 2 +- .../Activation/ActivationCard.stories.ts | 2 +- .../Activation/ActivationSyncCard.stories.ts | 2 +- .../ValidatorOnboarding.stories.ts | 11 +---------- .../ValidatorOnboarding/ValidatorOnboarding.tsx | 11 ++++++----- .../ValidatorSetup/ConsensusSelection.tsx | 16 ++++++++-------- .../ValidatorSetup/PairedDeviceCard.tsx | 1 - .../ValidatorSetup/ValidatorSetup.stories.ts | 13 +------------ 9 files changed, 20 insertions(+), 40 deletions(-) diff --git a/src/components/General/LinkWithArrow.stories.tsx b/src/components/General/LinkWithArrow.stories.tsx index 74102321..da3b3470 100644 --- a/src/components/General/LinkWithArrow.stories.tsx +++ b/src/components/General/LinkWithArrow.stories.tsx @@ -10,7 +10,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter()], + decorators: [withRouter], } satisfies Meta export default meta diff --git a/src/pages/ValidatorOnboarding/Activation/Activation.stories.ts b/src/pages/ValidatorOnboarding/Activation/Activation.stories.ts index 9dfef079..1f840a06 100644 --- a/src/pages/ValidatorOnboarding/Activation/Activation.stories.ts +++ b/src/pages/ValidatorOnboarding/Activation/Activation.stories.ts @@ -10,7 +10,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter()], + decorators: [withRouter], } satisfies Meta export default meta diff --git a/src/pages/ValidatorOnboarding/Activation/ActivationCard.stories.ts b/src/pages/ValidatorOnboarding/Activation/ActivationCard.stories.ts index 695e12b5..c70a48b1 100644 --- a/src/pages/ValidatorOnboarding/Activation/ActivationCard.stories.ts +++ b/src/pages/ValidatorOnboarding/Activation/ActivationCard.stories.ts @@ -10,7 +10,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter()], + decorators: [withRouter], } satisfies Meta export default meta diff --git a/src/pages/ValidatorOnboarding/Activation/ActivationSyncCard.stories.ts b/src/pages/ValidatorOnboarding/Activation/ActivationSyncCard.stories.ts index e4fc3429..5c9c2696 100644 --- a/src/pages/ValidatorOnboarding/Activation/ActivationSyncCard.stories.ts +++ b/src/pages/ValidatorOnboarding/Activation/ActivationSyncCard.stories.ts @@ -10,7 +10,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter()], + decorators: [withRouter], } satisfies Meta export default meta diff --git a/src/pages/ValidatorOnboarding/ValidatorOnboarding.stories.ts b/src/pages/ValidatorOnboarding/ValidatorOnboarding.stories.ts index c22304db..cba26c5d 100644 --- a/src/pages/ValidatorOnboarding/ValidatorOnboarding.stories.ts +++ b/src/pages/ValidatorOnboarding/ValidatorOnboarding.stories.ts @@ -2,16 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react' import { withRouter } from 'storybook-addon-react-router-v6' import ValidatorOnboarding from './ValidatorOnboarding' -import { Provider as ReduxProvider } from 'react-redux' -import store from '../../redux/store' -const withRedux = (StoryComponent: any) => { - return ( - - - - ); -} const meta = { title: 'Pages/ValidatorOnboarding', component: ValidatorOnboarding, @@ -19,7 +10,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter(), withRedux], + decorators: [withRouter], } satisfies Meta export default meta diff --git a/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx b/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx index 9752bae8..33bc225d 100644 --- a/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx @@ -1,19 +1,20 @@ import { Stack, YStack } from 'tamagui' +import { useNavigate } from 'react-router-dom' +import { useState } from 'react' +import { Button } from '@status-im/components' + import FormStepper from './FormStepper/FormStepper' import Titles from '../../components/General/Titles' -import { useState } from 'react' import Overview from './Overview/Overview' import KeyGeneration from './KeyGeneration/KeyGeneration' import Activation from './Activation/Activation' -import './layoutGradient.css' import ValidatorBoxWrapper from './ValidatorBoxWrapper/ValidatorBoxWrapper' -import { Button } from '@status-im/components' -import { useNavigate } from 'react-router-dom' import ClientSetup from './ClientSetup/ClientSetup' import ConsensusSelection from './ValidatorSetup/ConsensusSelection' import Advisories from './Advisories/Advisories' import ValidatorSetup from './ValidatorSetup/ValidatorSetup' import ValidatorSetupInstall from './ValidatorSetup/ValidatorInstall' +import './layoutGradient.css' const ValidatorOnboarding = () => { const [activeStep, setActiveStep] = useState(0) @@ -66,7 +67,7 @@ const ValidatorOnboarding = () => { {activeStep === 3 && subStepValidatorSetup === 0 && } {activeStep === 3 && subStepValidatorSetup === 1 && } {activeStep === 3 && subStepValidatorSetup === 2 && } - + {activeStep === 4 && } {activeStep === 5 && } diff --git a/src/pages/ValidatorOnboarding/ValidatorSetup/ConsensusSelection.tsx b/src/pages/ValidatorOnboarding/ValidatorSetup/ConsensusSelection.tsx index 6dbd1080..7b693038 100644 --- a/src/pages/ValidatorOnboarding/ValidatorSetup/ConsensusSelection.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorSetup/ConsensusSelection.tsx @@ -8,6 +8,14 @@ import ConsensusClientCard from './ConsensusClientCard' import LinkWithArrow from '../../../components/General/LinkWithArrow' import { RootState } from '../../../redux/store' +const clientIcons = { + Nethermind: '/icons/nethermind-circle.png', + Besu: '/icons/hyperledger-besu-circle.png', + Geth: '/icons/gethereum-mascot-circle.png', + Erigon: '/icons/erigon-circle.png', + Nimbus: '/icons/NimbusDisabled.svg', +} + const ConsensusSelection = () => { const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient) as | 'Nethermind' @@ -16,14 +24,6 @@ const ConsensusSelection = () => { | 'Erigon' | 'Nimbus' - const clientIcons = { - Nethermind: '/icons/nethermind-circle.png', - Besu: '/icons/hyperledger-besu-circle.png', - Geth: '/icons/gethereum-mascot-circle.png', - Erigon: '/icons/erigon-circle.png', - Nimbus: '/icons/NimbusDisabled.svg', - } - const clients = [ { name: selectedClient, diff --git a/src/pages/ValidatorOnboarding/ValidatorSetup/PairedDeviceCard.tsx b/src/pages/ValidatorOnboarding/ValidatorSetup/PairedDeviceCard.tsx index 6c779894..3bcc3177 100644 --- a/src/pages/ValidatorOnboarding/ValidatorSetup/PairedDeviceCard.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorSetup/PairedDeviceCard.tsx @@ -15,7 +15,6 @@ const PairedDeviceCard = () => { > - Paired Device diff --git a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorSetup.stories.ts b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorSetup.stories.ts index 0881028f..c37f71aa 100644 --- a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorSetup.stories.ts +++ b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorSetup.stories.ts @@ -1,17 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react' -import { Provider as ReduxProvider } from 'react-redux' import { withRouter } from 'storybook-addon-react-router-v6' -import React from 'react' import ValidatorSetup from './ValidatorSetup' -import store from '../../../redux/store' - -const withRedux = (StoryComponent: any) => { - return ( - - - - ); -} const meta = { title: 'ValidatorOnboarding/ValidatorSetup', @@ -20,7 +9,7 @@ const meta = { layout: 'centered', }, tags: ['autodocs'], - decorators: [withRouter(), withRedux], + decorators: [withRouter], } satisfies Meta export default meta