Create redux for validator onboarding

Create logic in redux for validator setup
This commit is contained in:
Hristo Nedelkov 2023-09-01 00:38:36 +03:00
parent d631096678
commit 9e0057bc61
3 changed files with 45 additions and 34 deletions

View File

@ -4,31 +4,6 @@ import { Text } from '@status-im/components'
import ExecClientCard from './ExecClientCard'
import { Link } from 'react-router-dom'
const execClientCardsContent = [
{
name: 'Nethermind',
icon: '/icons/nethermind-circle.png',
},
{
name: 'Besu',
icon: '/icons/hyperledger-besu-circle.png',
},
{
name: 'Geth',
icon: '/icons/gethereum-mascot-circle.png',
isSelected: true,
},
{
name: 'Erigon',
icon: '/icons/erigon-circle.png',
},
{
name: 'Nimbus',
icon: '/icons/NimbusDisabled.svg',
isComingSoon: true,
},
]
const ValidatorSetup = () => {
return (
<YStack style={{ width: '100%', padding: '16px 32px' }}>
@ -58,15 +33,28 @@ const ValidatorSetup = () => {
Select Execution client
</TextTam>
<XStack justifyContent={'space-between'}>
{execClientCardsContent.length &&
execClientCardsContent.map(e => (
<ExecClientCard
name={e.name}
icon={e.icon}
isSelected={e.isSelected || false}
isComingSoon={e.isComingSoon}
/>
))}
<ExecClientCard
name={'Nethermind'}
icon={'/icons/nethermind-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={'Nimbus'}
icon={'/icons/NimbusDisabled.svg'}
isSelected={false}
isComingSoon={true}
/>
</XStack>
<Stack marginTop={'10%'}>
<Text size={15} weight={'semibold'} color="#2A4CF4">

View File

@ -0,0 +1,21 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface ExecClientState {
selectedClient: string
}
const initialState: ExecClientState = {
selectedClient: '',
}
const execClientSlice = createSlice({
name: 'execClient',
initialState,
reducers: {
selectClient: (state: ExecClientState, action: PayloadAction<string>) => {
state.selectedClient = action.payload
},
},
})
export const { selectClient } = execClientSlice.actions
export default execClientSlice.reducer

View File

@ -1,11 +1,13 @@
import { configureStore } from '@reduxjs/toolkit'
import deviceHealthReducer from './deviceHealthCheck/slice'
import pinnedMessageReducer from './PinnedMessage/slice'
import execClientReducer from './ValidatorOnboarding/ValidatorSetup/slice'
const store = configureStore({
reducer: {
deviceHealth: deviceHealthReducer,
pinnedMessage: pinnedMessageReducer,
execClient: execClientReducer,
},
})