fix: change validator number to name

This commit is contained in:
RadoslavDimchev 2024-01-18 11:41:43 +02:00
parent bbbf821730
commit 2785e03c44
6 changed files with 18 additions and 18 deletions

View File

@ -4,21 +4,21 @@ import { XStack } from 'tamagui'
import ValidatorNameAddress from './ValidatorNameAddress' import ValidatorNameAddress from './ValidatorNameAddress'
type ValidatorProfileProps = { type ValidatorProfileProps = {
number: number name: string
address: string address: string
} }
const ValidatorProfile = ({ number, address }: ValidatorProfileProps) => { const ValidatorProfile = ({ name, address }: ValidatorProfileProps) => {
return ( return (
<XStack space={'$2'}> <XStack space={'$2'}>
<Avatar <Avatar
type="user" type="user"
size={32} size={32}
src="/icons/validator-request.svg" src="/icons/validator-request.svg"
name={number.toString()} name={name}
indicator="online" indicator="online"
/> />
<ValidatorNameAddress number={number} address={address} /> <ValidatorNameAddress name={name} address={address} />
</XStack> </XStack>
) )
} }

View File

@ -73,7 +73,7 @@ export const VALIDATOR_TABS_MANAGEMENT = [
export const VALIDATORS_DATA = [ export const VALIDATORS_DATA = [
{ {
number: 1, name: '1',
address: 'zQ3asdf9d4Gs0', address: 'zQ3asdf9d4Gs0',
balance: 32.0786, balance: 32.0786,
income: 0.0786, income: 0.0786,
@ -83,7 +83,7 @@ export const VALIDATORS_DATA = [
status: 'Active', status: 'Active',
}, },
{ {
number: 1, name: '1',
address: 'zQ3asdf9d4Gs0', address: 'zQ3asdf9d4Gs0',
balance: 32.0786, balance: 32.0786,
income: 0.0786, income: 0.0786,
@ -93,7 +93,7 @@ export const VALIDATORS_DATA = [
status: 'Active', status: 'Active',
}, },
{ {
number: 1, name: '1',
address: 'zQ3asdf9d4Gs0', address: 'zQ3asdf9d4Gs0',
balance: 32.0786, balance: 32.0786,
income: 0.0786, income: 0.0786,
@ -103,7 +103,7 @@ export const VALIDATORS_DATA = [
status: 'Active', status: 'Active',
}, },
{ {
number: 1, name: '1',
address: 'zQ3asdf9d4Gs0', address: 'zQ3asdf9d4Gs0',
balance: 32.0786, balance: 32.0786,
income: 0.0786, income: 0.0786,

View File

@ -15,7 +15,7 @@ type ManagementTableProps = {
} }
export type Validator = { export type Validator = {
number: number name: string
address: string address: string
balance: number balance: number
income: number income: number
@ -35,12 +35,12 @@ const isValidStatus = (validatorStatus: string, tabStatus: string) => {
return false return false
} }
const isValidNumberOrAddress = ( const isValidNameOrAddress = (
validatorNumber: number, validatorName: string,
validatorAddress: string, validatorAddress: string,
searchValue: string, searchValue: string,
) => { ) => {
if (validatorNumber.toString().includes(searchValue) || validatorAddress.includes(searchValue)) { if (validatorName.includes(searchValue) || validatorAddress.includes(searchValue)) {
return true return true
} }
return false return false
@ -61,7 +61,7 @@ const ManagementTable = ({ tab, searchValue, changeSearchValue }: ManagementTabl
const filteredValidators = useMemo(() => { const filteredValidators = useMemo(() => {
return validators return validators
.filter(validator => isValidStatus(validator.status, tab)) .filter(validator => isValidStatus(validator.status, tab))
.filter(validator => isValidNumberOrAddress(validator.number, validator.address, searchValue)) .filter(validator => isValidNameOrAddress(validator.name, validator.address, searchValue))
}, [validators, tab, searchValue]) }, [validators, tab, searchValue])
const handleSelectAll = () => { const handleSelectAll = () => {

View File

@ -32,7 +32,7 @@ const ManagementTableRow = ({ validator, isAllSelected }: ManagementTableRowProp
/> />
</td> </td>
<td> <td>
<ValidatorProfile number={validator.number} address={validator.address} /> <ValidatorProfile name={validator.name} address={validator.address} />
</td> </td>
<td> <td>
<Text size={15} color={'#647084'} weight={'semibold'}> <Text size={15} color={'#647084'} weight={'semibold'}>

View File

@ -52,7 +52,7 @@ const Deposit = () => {
{Array.from({ length: validatorCount }).map((_, index) => ( {Array.from({ length: validatorCount }).map((_, index) => (
<ValidatorRequest <ValidatorRequest
key={index} key={index}
number={index + 1} name={(index + 1).toString()}
isTransactionConfirmation={isTransactionConfirmation} isTransactionConfirmation={isTransactionConfirmation}
/> />
))} ))}

View File

@ -5,11 +5,11 @@ import TransactionStatus from './TransactionStatus'
import ValidatorProfile from '../../../../components/General/ValidatorProfile' import ValidatorProfile from '../../../../components/General/ValidatorProfile'
type ValidatorRequestProps = { type ValidatorRequestProps = {
number: number name: string
isTransactionConfirmation?: boolean isTransactionConfirmation?: boolean
} }
const ValidatorRequest = ({ number, isTransactionConfirmation }: ValidatorRequestProps) => { const ValidatorRequest = ({ name, isTransactionConfirmation }: ValidatorRequestProps) => {
let transactionStatus = 'Complete' let transactionStatus = 'Complete'
const isTransactionCompleted = transactionStatus === 'Complete' const isTransactionCompleted = transactionStatus === 'Complete'
@ -17,7 +17,7 @@ const ValidatorRequest = ({ number, isTransactionConfirmation }: ValidatorReques
<YStack space={'$3'} style={{ width: '100%' }}> <YStack space={'$3'} style={{ width: '100%' }}>
<XStack style={{ justifyContent: 'space-between', width: '100%', alignItems: 'center' }}> <XStack style={{ justifyContent: 'space-between', width: '100%', alignItems: 'center' }}>
<XStack style={{ justifyContent: 'space-between', width: '44%', alignItems: 'center' }}> <XStack style={{ justifyContent: 'space-between', width: '44%', alignItems: 'center' }}>
<ValidatorProfile number={number} address={'zQ3asdf9d4Gs0'} /> <ValidatorProfile name={name} address={'zQ3asdf9d4Gs0'} />
<Text size={13} color="#647084" weight={'semibold'}> <Text size={13} color="#647084" weight={'semibold'}>
Keys Generated Keys Generated
</Text> </Text>