Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
681d8a68
Commit
681d8a68
authored
Nov 29, 2022
by
Yuri Mikhin
Committed by
Yuri Mikhin
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the Stats type to the HomeStats type.
parent
87185029
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
14 deletions
+14
-14
index.ts
mocks/stats/index.ts
+2
-2
stats.ts
types/api/stats.ts
+1
-1
LatestBlocks.tsx
ui/home/LatestBlocks.tsx
+2
-2
Stats.tsx
ui/home/Stats.tsx
+2
-2
ChainIndicatorItem.tsx
ui/home/indicators/ChainIndicatorItem.tsx
+3
-3
ChainIndicators.tsx
ui/home/indicators/ChainIndicators.tsx
+2
-2
types.ts
ui/home/indicators/types.ts
+2
-2
No files found.
mocks/stats/index.ts
View file @
681d8a68
import
type
{
Stats
}
from
'
types/api/stats
'
;
import
type
{
Home
Stats
}
from
'
types/api/stats
'
;
export
const
base
:
Stats
=
{
export
const
base
:
Home
Stats
=
{
average_block_time
:
6212.0
,
average_block_time
:
6212.0
,
coin_price
:
'
0.00199678
'
,
coin_price
:
'
0.00199678
'
,
gas_prices
:
{
gas_prices
:
{
...
...
types/api/stats.ts
View file @
681d8a68
export
type
Stats
=
{
export
type
Home
Stats
=
{
total_blocks
:
string
;
total_blocks
:
string
;
total_addresses
:
string
;
total_addresses
:
string
;
total_transactions
:
string
;
total_transactions
:
string
;
...
...
ui/home/LatestBlocks.tsx
View file @
681d8a68
...
@@ -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
{
Home
Stats
}
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
,
Home
Stats
>
(
[
QueryKeys
.
stats
],
[
QueryKeys
.
stats
],
()
=>
fetch
(
'
/node-api/stats
'
),
()
=>
fetch
(
'
/node-api/stats
'
),
);
);
...
...
ui/home/Stats.tsx
View file @
681d8a68
...
@@ -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
T
Stats
}
from
'
types/api/stats
'
;
import
type
{
Home
Stats
}
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
,
T
Stats
>
(
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
Home
Stats
>
(
[
QueryKeys
.
stats
],
[
QueryKeys
.
stats
],
async
()
=>
await
fetch
(
`/node-api/stats`
),
async
()
=>
await
fetch
(
`/node-api/stats`
),
);
);
...
...
ui/home/indicators/ChainIndicatorItem.tsx
View file @
681d8a68
...
@@ -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
{
Home
Stats
}
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
:
Home
Stats
)
=>
string
;
icon
:
React
.
ReactNode
;
icon
:
React
.
ReactNode
;
isSelected
:
boolean
;
isSelected
:
boolean
;
onClick
:
(
id
:
ChainIndicatorId
)
=>
void
;
onClick
:
(
id
:
ChainIndicatorId
)
=>
void
;
stats
:
UseQueryResult
<
Stats
>
;
stats
:
UseQueryResult
<
Home
Stats
>
;
}
}
const
ChainIndicatorItem
=
({
id
,
title
,
value
,
icon
,
isSelected
,
onClick
,
stats
}:
Props
)
=>
{
const
ChainIndicatorItem
=
({
id
,
title
,
value
,
icon
,
isSelected
,
onClick
,
stats
}:
Props
)
=>
{
...
...
ui/home/indicators/ChainIndicators.tsx
View file @
681d8a68
...
@@ -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
{
Home
Stats
}
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
,
Home
Stats
>
(
[
QueryKeys
.
stats
],
[
QueryKeys
.
stats
],
()
=>
fetch
(
'
/node-api/stats
'
),
()
=>
fetch
(
'
/node-api/stats
'
),
);
);
...
...
ui/home/indicators/types.ts
View file @
681d8a68
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
{
Home
Stats
}
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
:
Home
Stats
)
=>
string
;
icon
:
React
.
ReactNode
;
icon
:
React
.
ReactNode
;
hint
?:
string
;
hint
?:
string
;
api
:
{
api
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment