Commit 681d8a68 authored by Yuri Mikhin's avatar Yuri Mikhin Committed by Yuri Mikhin

Rename the Stats type to the HomeStats type.

parent 87185029
import type { Stats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
export const base: Stats = { export const base: HomeStats = {
average_block_time: 6212.0, average_block_time: 6212.0,
coin_price: '0.00199678', coin_price: '0.00199678',
gas_prices: { gas_prices: {
......
export type Stats = { export type HomeStats = {
total_blocks: string; total_blocks: string;
total_addresses: string; total_addresses: string;
total_transactions: string; total_transactions: string;
......
...@@ -5,7 +5,7 @@ import React from 'react'; ...@@ -5,7 +5,7 @@ import React from 'react';
import type { SocketMessage } from 'lib/socket/types'; import type { SocketMessage } from 'lib/socket/types';
import type { Block } from 'types/api/block'; import type { Block } from 'types/api/block';
import type { Stats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
import { QueryKeys } from 'types/client/queries'; import { QueryKeys } from 'types/client/queries';
import useFetch from 'lib/hooks/useFetch'; import useFetch from 'lib/hooks/useFetch';
...@@ -31,7 +31,7 @@ const LatestBlocks = () => { ...@@ -31,7 +31,7 @@ const LatestBlocks = () => {
); );
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const statsQueryResult = useQuery<unknown, unknown, Stats>( const statsQueryResult = useQuery<unknown, unknown, HomeStats>(
[ QueryKeys.stats ], [ QueryKeys.stats ],
() => fetch('/node-api/stats'), () => fetch('/node-api/stats'),
); );
......
...@@ -2,7 +2,7 @@ import { Grid } from '@chakra-ui/react'; ...@@ -2,7 +2,7 @@ import { Grid } from '@chakra-ui/react';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import React from 'react'; import React from 'react';
import type { Stats as TStats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
import { QueryKeys } from 'types/client/queries'; import { QueryKeys } from 'types/client/queries';
import appConfig from 'configs/app/config'; import appConfig from 'configs/app/config';
...@@ -26,7 +26,7 @@ let itemsCount = 5; ...@@ -26,7 +26,7 @@ let itemsCount = 5;
const Stats = () => { const Stats = () => {
const fetch = useFetch(); const fetch = useFetch();
const { data, isLoading, isError } = useQuery<unknown, unknown, TStats>( const { data, isLoading, isError } = useQuery<unknown, unknown, HomeStats>(
[ QueryKeys.stats ], [ QueryKeys.stats ],
async() => await fetch(`/node-api/stats`), async() => await fetch(`/node-api/stats`),
); );
......
...@@ -3,18 +3,18 @@ import type { UseQueryResult } from '@tanstack/react-query'; ...@@ -3,18 +3,18 @@ import type { UseQueryResult } from '@tanstack/react-query';
import React from 'react'; import React from 'react';
import type { ChainIndicatorId } from './types'; import type { ChainIndicatorId } from './types';
import type { Stats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
interface Props { interface Props {
id: ChainIndicatorId; id: ChainIndicatorId;
title: string; title: string;
value: (stats: Stats) => string; value: (stats: HomeStats) => string;
icon: React.ReactNode; icon: React.ReactNode;
isSelected: boolean; isSelected: boolean;
onClick: (id: ChainIndicatorId) => void; onClick: (id: ChainIndicatorId) => void;
stats: UseQueryResult<Stats>; stats: UseQueryResult<HomeStats>;
} }
const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => { const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => {
......
...@@ -2,7 +2,7 @@ import { Box, Flex, Icon, Skeleton, Text, Tooltip, useColorModeValue } from '@ch ...@@ -2,7 +2,7 @@ import { Box, Flex, Icon, Skeleton, Text, Tooltip, useColorModeValue } from '@ch
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import React from 'react'; import React from 'react';
import type { Stats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
import { QueryKeys } from 'types/client/queries'; import { QueryKeys } from 'types/client/queries';
import appConfig from 'configs/app/config'; import appConfig from 'configs/app/config';
...@@ -35,7 +35,7 @@ const ChainIndicators = () => { ...@@ -35,7 +35,7 @@ const ChainIndicators = () => {
const queryResult = useFetchChartData(indicator); const queryResult = useFetchChartData(indicator);
const fetch = useFetch(); const fetch = useFetch();
const statsQueryResult = useQuery<unknown, unknown, Stats>( const statsQueryResult = useQuery<unknown, unknown, HomeStats>(
[ QueryKeys.stats ], [ QueryKeys.stats ],
() => fetch('/node-api/stats'), () => fetch('/node-api/stats'),
); );
......
import type { ChartMarketResponse, ChartTransactionResponse } from 'types/api/charts'; import type { ChartMarketResponse, ChartTransactionResponse } from 'types/api/charts';
import type { Stats } from 'types/api/stats'; import type { HomeStats } from 'types/api/stats';
import type { QueryKeys } from 'types/client/queries'; import type { QueryKeys } from 'types/client/queries';
import type { TimeChartData } from 'ui/shared/chart/types'; import type { TimeChartData } from 'ui/shared/chart/types';
...@@ -10,7 +10,7 @@ export type ChainIndicatorId = 'daily_txs' | 'coin_price' | 'market_cup'; ...@@ -10,7 +10,7 @@ export type ChainIndicatorId = 'daily_txs' | 'coin_price' | 'market_cup';
export interface TChainIndicator<Q extends ChartsQueryKeys> { export interface TChainIndicator<Q extends ChartsQueryKeys> {
id: ChainIndicatorId; id: ChainIndicatorId;
title: string; title: string;
value: (stats: Stats) => string; value: (stats: HomeStats) => string;
icon: React.ReactNode; icon: React.ReactNode;
hint?: string; hint?: string;
api: { api: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment