From 3e1fe715e305e550cc6d386e4e727fb5c51c7f96 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Mon, 23 Oct 2023 20:35:01 +0300 Subject: [PATCH] fix: use MAC constant instead of string --- src/constants.ts | 1 + .../ValidatorSetup/ValidatorInstalling/OSCards.tsx | 8 ++++---- .../ValidatorSetup/ValidatorInstalling/OsCard.stories.ts | 2 +- .../ValidatorInstalling/ValidatorInstall.tsx | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 23be379f..602cfdd7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -31,6 +31,7 @@ export const KEYSTORE_FILES = 'KeystoreFiles' export const RECOVERY_PHRASE = 'Recovery Phrase' export const BOTH_KEY_AND_RECOVERY = 'Both KeystoreFiles & Recovery Phrase' export const ETH_PER_VALIDATOR = 32 + export const MAC = 'Mac' export const WINDOWS = 'Windows' export const LINUX = 'Linux' diff --git a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/OSCards.tsx b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/OSCards.tsx index 21001422..d7d05f4e 100644 --- a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/OSCards.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/OSCards.tsx @@ -2,18 +2,18 @@ import { XStack } from 'tamagui' import { useState } from 'react' import OSCard from './OSCard' -import { LINUX, WINDOWS } from '../../../../constants' +import { LINUX, MAC, WINDOWS } from '../../../../constants' const OSCards = () => { - const [selectedOs, setSelectedOs] = useState('MAC') + const [selectedOs, setSelectedOs] = useState(MAC) return ( setSelectedOs('MAC')} + isSelected={selectedOs === MAC} + onClick={() => setSelectedOs(MAC)} /> export const Default: Story = { args: { icon: '/icons/apple-logo.svg', - name: 'MAC', + name: MAC, isSelected: true, }, } diff --git a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/ValidatorInstall.tsx b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/ValidatorInstall.tsx index 1c079bce..605d37b8 100644 --- a/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/ValidatorInstall.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorSetup/ValidatorInstalling/ValidatorInstall.tsx @@ -6,11 +6,11 @@ import { useSelector } from 'react-redux' import SyntaxHighlighterBox from './SyntaxHighlighter' import { RootState } from '../../../../redux/store' -import { LINUX, WINDOWS } from '../../../../constants' +import { LINUX, MAC, WINDOWS } from '../../../../constants' import OSCard from './OSCard' const ValidatorSetupInstall = () => { - const [selectedOs, setSelectedOs] = useState('MAC') + const [selectedOs, setSelectedOs] = useState(MAC) const selectedClient = useSelector((state: RootState) => state.execClient.selectedClient) return ( @@ -60,8 +60,8 @@ const ValidatorSetupInstall = () => { setSelectedOs('MAC')} + isSelected={selectedOs === MAC} + onClick={() => setSelectedOs(MAC)} />