mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-02 06:36:05 +00:00
feat: separate func for number and address
This commit is contained in:
parent
ab363ec22a
commit
66093a8f9c
@ -70,17 +70,24 @@ const testValidatorStatus = (validatorStatus: string, tabStatus: string) => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const testNumberAndAddress = (
|
||||||
|
validatorNumber: number,
|
||||||
|
validatorAddress: string,
|
||||||
|
searchValue: string,
|
||||||
|
) => {
|
||||||
|
if (validatorNumber.toString().includes(searchValue) || validatorAddress.includes(searchValue)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const ManagementTable = ({ tab }: ManagementTableProps) => {
|
const ManagementTable = ({ tab }: ManagementTableProps) => {
|
||||||
const [searchValue, setSearchValue] = useState('')
|
const [searchValue, setSearchValue] = useState('')
|
||||||
|
|
||||||
const filteredValidators = useMemo(() => {
|
const filteredValidators = useMemo(() => {
|
||||||
return validators
|
return validators
|
||||||
.filter(validator => testValidatorStatus(validator.status, tab))
|
.filter(validator => testValidatorStatus(validator.status, tab))
|
||||||
.filter(
|
.filter(validator => testNumberAndAddress(validator.number, validator.address, searchValue))
|
||||||
validator =>
|
|
||||||
validator.number.toString().includes(searchValue) ||
|
|
||||||
validator.address.includes(searchValue),
|
|
||||||
)
|
|
||||||
}, [tab, searchValue])
|
}, [tab, searchValue])
|
||||||
|
|
||||||
const changeSearchValue = (value: string) => {
|
const changeSearchValue = (value: string) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user