fix: format and clean code

This commit is contained in:
RadoslavDimchev 2023-09-01 09:37:14 +03:00
parent 12cdfcacba
commit c92e30018e
13 changed files with 36 additions and 19 deletions

View File

@ -1,18 +1,19 @@
import { Stack, YStack } from 'tamagui' import { Stack, YStack } from 'tamagui'
import Icon from '../../../components/General/Icon'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import Icon from '../../../components/General/Icon'
type ConsensusClientCardProps = { type ConsensusClientCardProps = {
name: string name: string
icon: string icon: string
} }
const ConsensusClientCard = ({ name, icon }: ConsensusClientCardProps) => { const ConsensusClientCard = ({ name, icon }: ConsensusClientCardProps) => {
return ( return (
<YStack <YStack
style={{ style={{
backgroundColor: '#2A4AF50D', backgroundColor: '#2A4AF50D',
border: '1px solid #2A4AF5', border: '1px solid #2A4AF5',
borderRadius: '16px', borderRadius: '16px',
padding: '12px 16px', padding: '12px 16px',
width: '29%', width: '29%',
@ -28,4 +29,5 @@ const ConsensusClientCard = ({ name, icon }: ConsensusClientCardProps) => {
</YStack> </YStack>
) )
} }
export default ConsensusClientCard export default ConsensusClientCard

View File

@ -1,6 +1,7 @@
import { Stack, XStack, YStack } from 'tamagui' import { Stack, XStack, YStack } from 'tamagui'
import { ClearIcon } from '@status-im/icons' import { ClearIcon } from '@status-im/icons'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import StandardGauge from '../../../components/Charts/StandardGauge' import StandardGauge from '../../../components/Charts/StandardGauge'
import BorderBox from '../../../components/General/BorderBox' import BorderBox from '../../../components/General/BorderBox'
import { formatNumberForGauge } from '../../../utilities' import { formatNumberForGauge } from '../../../utilities'

View File

@ -1,10 +1,11 @@
import { XStack, Stack, Text as TextTam, YStack } from 'tamagui' import { XStack, Stack, Text as TextTam, YStack } from 'tamagui'
import PairedDeviceCard from './PairedDeviceCard'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import { useSelector } from 'react-redux'
import PairedDeviceCard from './PairedDeviceCard'
import ConsensusGaugeCard from './ConsensusGaugeCard' import ConsensusGaugeCard from './ConsensusGaugeCard'
import ConsensusClientCard from './ConsensusClientCard' import ConsensusClientCard from './ConsensusClientCard'
import LinkWithArrow from '../../../components/General/LinkWithArrow' import LinkWithArrow from '../../../components/General/LinkWithArrow'
import { useSelector } from 'react-redux'
import { RootState } from '../../../redux/store' import { RootState } from '../../../redux/store'
const ConsensusSelection = () => { const ConsensusSelection = () => {
@ -23,12 +24,13 @@ const ConsensusSelection = () => {
Nimbus: '/icons/NimbusDisabled.svg', Nimbus: '/icons/NimbusDisabled.svg',
} }
const a = [ const clients = [
{ {
name: selectedClient, name: selectedClient,
icon: clientIcons[selectedClient], icon: clientIcons[selectedClient],
}, },
] ]
return ( return (
<YStack style={{ width: '100%', padding: '32px' }}> <YStack style={{ width: '100%', padding: '32px' }}>
<XStack justifyContent={'space-between'}> <XStack justifyContent={'space-between'}>
@ -66,7 +68,7 @@ const ConsensusSelection = () => {
</TextTam> </TextTam>
<XStack space={'$8'}> <XStack space={'$8'}>
<ConsensusClientCard name={a[0].name} icon={a[0].icon} /> <ConsensusClientCard name={clients[0].name} icon={clients[0].icon} />
<YStack width={'67%'} space={'$4'}> <YStack width={'67%'} space={'$4'}>
<Text size={27}>The resource efficient Ethereum Clients.</Text> <Text size={27}>The resource efficient Ethereum Clients.</Text>
<Text size={15}> <Text size={15}>

View File

@ -1,6 +1,7 @@
import { Stack, XStack, YStack } from 'tamagui' import { Stack, XStack, YStack } from 'tamagui'
import Icon from '../../../components/General/Icon'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import Icon from '../../../components/General/Icon'
import { selectClient } from '../../../redux/ValidatorOnboarding/ValidatorSetup/slice' import { selectClient } from '../../../redux/ValidatorOnboarding/ValidatorSetup/slice'
import { useDispatch, useSelector } from 'react-redux' import { useDispatch, useSelector } from 'react-redux'
import { RootState } from '../../../redux/store' import { RootState } from '../../../redux/store'
@ -8,9 +9,9 @@ import { RootState } from '../../../redux/store'
type ExecClientCardProps = { type ExecClientCardProps = {
name: string name: string
icon: string icon: string
isComingSoon?: boolean isComingSoon?: boolean
} }
const ExecClientCard = ({ name, icon, isComingSoon }: ExecClientCardProps) => { const ExecClientCard = ({ name, icon, isComingSoon }: ExecClientCardProps) => {
const dispatch = useDispatch() const dispatch = useDispatch()
const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient) const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient)
@ -60,4 +61,5 @@ const ExecClientCard = ({ name, icon, isComingSoon }: ExecClientCardProps) => {
</YStack> </YStack>
) )
} }
export default ExecClientCard export default ExecClientCard

View File

@ -1,14 +1,15 @@
import { Stack, YStack } from 'tamagui' import { Stack, YStack } from 'tamagui'
import Icon from '../../../components/General/Icon'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import Icon from '../../../components/General/Icon'
type OsCardProps = { type OsCardProps = {
name: string name: string
icon: string icon: string
onClick?: () => void onClick?: () => void
isSelected?: boolean isSelected?: boolean
} }
const OsCard = ({ name, icon, onClick, isSelected }: OsCardProps) => { const OsCard = ({ name, icon, onClick, isSelected }: OsCardProps) => {
return ( return (
<YStack <YStack
@ -31,4 +32,5 @@ const OsCard = ({ name, icon, onClick, isSelected }: OsCardProps) => {
</YStack> </YStack>
) )
} }
export default OsCard export default OsCard

View File

@ -1,5 +1,3 @@
// make func component for this file
import { XStack, YStack } from 'tamagui' import { XStack, YStack } from 'tamagui'
import { ClearIcon } from '@status-im/icons' import { ClearIcon } from '@status-im/icons'
import { Avatar, Text } from '@status-im/components' import { Avatar, Text } from '@status-im/components'
@ -31,4 +29,5 @@ const PairedDeviceCard = () => {
</XStack> </XStack>
) )
} }
export default PairedDeviceCard export default PairedDeviceCard

View File

@ -1,5 +1,6 @@
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { solarizedlight } from 'react-syntax-highlighter/dist/esm/styles/prism' import { solarizedlight } from 'react-syntax-highlighter/dist/esm/styles/prism'
type SyntaxHighlighterBoxProps = { type SyntaxHighlighterBoxProps = {
rows: string[] rows: string[]
} }
@ -12,6 +13,7 @@ const customStyle = {
}, },
backgroundColor: 'white', backgroundColor: 'white',
} }
const SyntaxHighlighterBox = ({ rows }: SyntaxHighlighterBoxProps) => { const SyntaxHighlighterBox = ({ rows }: SyntaxHighlighterBoxProps) => {
return ( return (
<SyntaxHighlighter <SyntaxHighlighter
@ -25,4 +27,5 @@ const SyntaxHighlighterBox = ({ rows }: SyntaxHighlighterBoxProps) => {
</SyntaxHighlighter> </SyntaxHighlighter>
) )
} }
export default SyntaxHighlighterBox export default SyntaxHighlighterBox

View File

@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react' import type { Meta, StoryObj } from '@storybook/react'
import ValidatorSetupInstall from './ValidatorInstall'
import ValidatorSetupInstall from './ValidatorInstall'
const meta = { const meta = {
title: 'ValidatorOnboarding/ValidatorSetupInstall', title: 'ValidatorOnboarding/ValidatorSetupInstall',

View File

@ -1,14 +1,17 @@
import { XStack, Stack, YStack } from 'tamagui' import { XStack, Stack, YStack } from 'tamagui'
import { InformationBox, Text } from '@status-im/components' import { InformationBox, Text } from '@status-im/components'
import { CloseCircleIcon } from '@status-im/icons' import { CloseCircleIcon } from '@status-im/icons'
import OsCard from './OsCard'
import SyntaxHighlighterBox from './SyntaxHighlighter'
import { useState } from 'react' import { useState } from 'react'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import OsCard from './OsCard'
import SyntaxHighlighterBox from './SyntaxHighlighter'
import { RootState } from '../../../redux/store' import { RootState } from '../../../redux/store'
const ValidatorSetupInstall = () => { const ValidatorSetupInstall = () => {
const [selectedOs, setSelectedOs] = useState('Mac') const [selectedOs, setSelectedOs] = useState('Mac')
const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient) const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient)
return ( return (
<YStack style={{ width: '100%', padding: '16px 32px' }}> <YStack style={{ width: '100%', padding: '16px 32px' }}>
<XStack justifyContent={'space-between'} style={{ marginBottom: '10px' }}> <XStack justifyContent={'space-between'} style={{ marginBottom: '10px' }}>

View File

@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react' import type { Meta, StoryObj } from '@storybook/react'
import { withRouter } from 'storybook-addon-react-router-v6'
import ValidatorSetup from './ValidatorSetup' import ValidatorSetup from './ValidatorSetup'
import { withRouter } from 'storybook-addon-react-router-v6'
const meta = { const meta = {
title: 'ValidatorOnboarding/ValidatorSetup', title: 'ValidatorOnboarding/ValidatorSetup',

View File

@ -1,9 +1,10 @@
import { XStack, Stack, Text as TextTam, YStack } from 'tamagui' import { XStack, Stack, Text as TextTam, YStack } from 'tamagui'
import PairedDeviceCard from './PairedDeviceCard'
import { Text } from '@status-im/components' import { Text } from '@status-im/components'
import ExecClientCard from './ExecClientCard'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import PairedDeviceCard from './PairedDeviceCard'
import ExecClientCard from './ExecClientCard'
const ValidatorSetup = () => { const ValidatorSetup = () => {
return ( return (
<YStack style={{ width: '100%', padding: '16px 32px' }}> <YStack style={{ width: '100%', padding: '16px 32px' }}>

View File

@ -3,9 +3,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface ExecClientState { interface ExecClientState {
selectedClient: string selectedClient: string
} }
const initialState: ExecClientState = { const initialState: ExecClientState = {
selectedClient: '', selectedClient: '',
} }
const execClientSlice = createSlice({ const execClientSlice = createSlice({
name: 'execClient', name: 'execClient',
initialState, initialState,