Implement logic for validator setuo workflow

This commit is contained in:
Hristo Nedelkov 2023-09-01 00:52:12 +03:00
parent 9e0057bc61
commit ec0cb296d1
2 changed files with 16 additions and 26 deletions

View File

@ -1,16 +1,20 @@
import { Stack, XStack, YStack } from 'tamagui' import { Stack, XStack, YStack } from 'tamagui'
import Icon from '../../../components/General/Icon' import Icon from '../../../components/General/Icon'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import { selectClient } from '../../../redux/ValidatorOnboarding/ValidatorSetup/slice'
// make func component import { useDispatch, useSelector } from 'react-redux'
type ExecClientCardProps = { type ExecClientCardProps = {
name: string name: string
icon: string icon: string
isSelected?: boolean
isComingSoon?: boolean isComingSoon?: boolean
} }
const ExecClientCard = ({ name, icon, isSelected, isComingSoon }: ExecClientCardProps) => { const ExecClientCard = ({ name, icon, isComingSoon }: ExecClientCardProps) => {
const dispatch = useDispatch()
const selectedClient = useSelector(selectClient)
const isSelected = selectedClient.payload.execClient.selectedClient === name
return ( return (
<YStack <YStack
style={{ style={{
@ -25,6 +29,9 @@ const ExecClientCard = ({ name, icon, isSelected, isComingSoon }: ExecClientCard
width: '19%', width: '19%',
}} }}
space={'$12'} space={'$12'}
onClick={() => {
dispatch(selectClient(name))
}}
> >
<Stack> <Stack>
<Text size={27} weight={'semibold'} color={isComingSoon ? '#DCE0E5' : ''}> <Text size={27} weight={'semibold'} color={isComingSoon ? '#DCE0E5' : ''}>

View File

@ -33,28 +33,11 @@ const ValidatorSetup = () => {
Select Execution client Select Execution client
</TextTam> </TextTam>
<XStack justifyContent={'space-between'}> <XStack justifyContent={'space-between'}>
<ExecClientCard <ExecClientCard name={'Nethermind'} icon={'/icons/nethermind-circle.png'} />
name={'Nethermind'} <ExecClientCard name={'Besu'} icon={'/icons/hyperledger-besu-circle.png'} />
icon={'/icons/nethermind-circle.png'} <ExecClientCard name={'Geth'} icon={'/icons/gethereum-mascot-circle.png'} />
isSelected={false}
/>
<ExecClientCard
name={'Besu'}
icon={'/icons/hyperledger-besu-circle.png'}
isSelected={false}
/>
<ExecClientCard
name={'Geth'}
icon={'/icons/gethereum-mascot-circle.png'}
isSelected={true}
/>
<ExecClientCard name={'Erigon'} icon={'/icons/erigon-circle.png'} isSelected={false} /> <ExecClientCard name={'Erigon'} icon={'/icons/erigon-circle.png'} isSelected={false} />
<ExecClientCard <ExecClientCard name={'Nimbus'} icon={'/icons/NimbusDisabled.svg'} isComingSoon={true} />
name={'Nimbus'}
icon={'/icons/NimbusDisabled.svg'}
isSelected={false}
isComingSoon={true}
/>
</XStack> </XStack>
<Stack marginTop={'10%'}> <Stack marginTop={'10%'}>
<Text size={15} weight={'semibold'} color="#2A4CF4"> <Text size={15} weight={'semibold'} color="#2A4CF4">