Files
tom goriunovandGitHub fae4990e1f API resource refactoring (#2699)
* add prefix to API resources

* fix pw tests

* refactor config

* remove unnecessary prefixes in resource names

* fixes

* update screenshots
2025-05-01 15:22:38 +02:00

34 lines
1.0 KiB
TypeScript

import { Box } from '@chakra-ui/react';
import React from 'react';
import config from 'configs/app';
import useApiQuery from 'lib/api/useApiQuery';
import { VALIDATORS_BLACKFORT_COUNTERS } from 'stubs/validators';
import StatsWidget from 'ui/shared/stats/StatsWidget';
const ValidatorsCounters = () => {
const countersQuery = useApiQuery('general:validators_blackfort_counters', {
queryOptions: {
enabled: config.features.validators.isEnabled,
placeholderData: VALIDATORS_BLACKFORT_COUNTERS,
},
});
if (!countersQuery.data) {
return null;
}
return (
<Box columnGap={ 3 } rowGap={ 3 } mb={ 6 } display="grid" gridTemplateColumns={{ base: '1fr', lg: 'repeat(2, 1fr)' }}>
<StatsWidget
label="Total validators"
value={ Number(countersQuery.data.validators_count).toLocaleString() }
diff={ Number(countersQuery.data.new_validators_count_24h).toLocaleString() }
isLoading={ countersQuery.isPlaceholderData }
/>
</Box>
);
};
export default React.memo(ValidatorsCounters);