Set count of current tab validators
This commit is contained in:
parent
bc05e5e979
commit
17b9c17325
|
@ -2,8 +2,13 @@ import { Stack, YStack } from 'tamagui'
|
||||||
import ValidatorListItem from './ValidatorListItem'
|
import ValidatorListItem from './ValidatorListItem'
|
||||||
import InputSearch from './SearchInput'
|
import InputSearch from './SearchInput'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
|
import { useDispatch } from 'react-redux'
|
||||||
|
import { setCountOfValidators } from '../../../redux/RightSidebar/slice'
|
||||||
|
|
||||||
|
|
||||||
const ValidatorsList = () => {
|
const ValidatorsList = () => {
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
const [searchValue, setSearchValue] = useState('')
|
const [searchValue, setSearchValue] = useState('')
|
||||||
const validators = [
|
const validators = [
|
||||||
{
|
{
|
||||||
|
@ -25,8 +30,11 @@ const ValidatorsList = () => {
|
||||||
const filtered = validators.filter(validator =>
|
const filtered = validators.filter(validator =>
|
||||||
validator.name.toLowerCase().includes(searchValue.toLowerCase()),
|
validator.name.toLowerCase().includes(searchValue.toLowerCase()),
|
||||||
)
|
)
|
||||||
|
const filteredCount = filtered.length
|
||||||
|
dispatch(setCountOfValidators(filteredCount))
|
||||||
setFilteredValidators(filtered)
|
setFilteredValidators(filtered)
|
||||||
} else {
|
} else {
|
||||||
|
dispatch(setCountOfValidators(validators.length))
|
||||||
setFilteredValidators(validators)
|
setFilteredValidators(validators)
|
||||||
}
|
}
|
||||||
}, [searchValue, validators])
|
}, [searchValue, validators])
|
||||||
|
|
Loading…
Reference in New Issue