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
346d4948
Commit
346d4948
authored
Dec 07, 2022
by
Yuri Mikhin
Committed by
Yuri Mikhin
Dec 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move home stats data fetching to /node-api/home-stats route.
parent
b22dd2d1
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
23 additions
and
16 deletions
+23
-16
market.ts
pages/api/home-stats/charts/market.ts
+0
-0
transactions.ts
pages/api/home-stats/charts/transactions.ts
+0
-0
index.ts
pages/api/home-stats/index.ts
+7
-0
BlocksTabSlot.tsx
ui/blocks/BlocksTabSlot.tsx
+1
-1
LatestBlocks.pw.tsx
ui/home/LatestBlocks.pw.tsx
+1
-1
LatestBlocks.tsx
ui/home/LatestBlocks.tsx
+1
-1
LatestTxs.pw.tsx
ui/home/LatestTxs.pw.tsx
+2
-2
Stats.pw.tsx
ui/home/Stats.pw.tsx
+1
-1
Stats.tsx
ui/home/Stats.tsx
+1
-1
ChainIndicators.pw.tsx
ui/home/indicators/ChainIndicators.pw.tsx
+2
-2
ChainIndicators.tsx
ui/home/indicators/ChainIndicators.tsx
+1
-1
indicators.tsx
ui/home/indicators/utils/indicators.tsx
+3
-3
Blocks.pw.tsx
ui/pages/Blocks.pw.tsx
+1
-1
Home.pw.tsx
ui/pages/Home.pw.tsx
+2
-2
No files found.
pages/api/stats/charts/market.ts
→
pages/api/
home-
stats/charts/market.ts
View file @
346d4948
File moved
pages/api/stats/charts/transactions.ts
→
pages/api/
home-
stats/charts/transactions.ts
View file @
346d4948
File moved
pages/api/home-stats/index.ts
0 → 100644
View file @
346d4948
import
handler
from
'
lib/api/handler
'
;
const
getUrl
=
()
=>
'
/v2/stats
'
;
const
requestHandler
=
handler
(
getUrl
,
[
'
GET
'
]);
export
default
requestHandler
;
ui/blocks/BlocksTabSlot.tsx
View file @
346d4948
...
...
@@ -21,7 +21,7 @@ const BlocksTabSlot = ({ pagination }: Props) => {
const
statsQuery
=
useQuery
<
unknown
,
unknown
,
HomeStats
>
(
[
QueryKeys
.
homeStats
],
()
=>
fetch
(
'
/node-api/stats
'
),
()
=>
fetch
(
'
/node-api/
home-
stats
'
),
);
if
(
isMobile
)
{
...
...
ui/home/LatestBlocks.pw.tsx
View file @
346d4948
...
...
@@ -8,7 +8,7 @@ import TestApp from 'playwright/TestApp';
import
LatestBlocks
from
'
./LatestBlocks
'
;
const
STATS_API_URL
=
'
/node-api/stats
'
;
const
STATS_API_URL
=
'
/node-api/
home-
stats
'
;
const
BLOCKS_API_URL
=
'
/node-api/index/blocks
'
;
export
const
test
=
base
.
extend
<
socketServer
.
SocketServerFixture
>
({
...
...
ui/home/LatestBlocks.tsx
View file @
346d4948
...
...
@@ -33,7 +33,7 @@ const LatestBlocks = () => {
const
queryClient
=
useQueryClient
();
const
statsQueryResult
=
useQuery
<
unknown
,
unknown
,
HomeStats
>
(
[
QueryKeys
.
homeStats
],
()
=>
fetch
(
'
/node-api/stats
'
),
()
=>
fetch
(
'
/node-api/
home-
stats
'
),
);
const
handleNewBlockMessage
:
SocketMessage
.
NewBlock
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
...
...
ui/home/LatestTxs.pw.tsx
View file @
346d4948
...
...
@@ -14,7 +14,7 @@ export const test = base.extend<socketServer.SocketServerFixture>({
});
test
(
'
default view +@mobile +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
/node-api/
home-
stats
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
...
...
@@ -47,7 +47,7 @@ test.describe('socket', () => {
};
test
(
'
new item
'
,
async
({
mount
,
page
,
createSocket
})
=>
{
await
page
.
route
(
'
/node-api/stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
/node-api/
home-
stats
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
...
...
ui/home/Stats.pw.tsx
View file @
346d4948
...
...
@@ -7,7 +7,7 @@ import TestApp from 'playwright/TestApp';
import
Stats
from
'
./Stats
'
;
const
API_URL
=
'
/node-api/stats
'
;
const
API_URL
=
'
/node-api/
home-
stats
'
;
test
(
'
all items +@mobile +@dark-mode +@desktop-xl
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
...
...
ui/home/Stats.tsx
View file @
346d4948
...
...
@@ -29,7 +29,7 @@ const Stats = () => {
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
HomeStats
>
(
[
QueryKeys
.
homeStats
],
async
()
=>
await
fetch
(
`/node-api/stats`
),
async
()
=>
await
fetch
(
`/node-api/
home-
stats`
),
);
if
(
isError
)
{
...
...
ui/home/indicators/ChainIndicators.pw.tsx
View file @
346d4948
...
...
@@ -7,8 +7,8 @@ import TestApp from 'playwright/TestApp';
import
ChainIndicators
from
'
./ChainIndicators
'
;
const
STATS_API_URL
=
'
/node-api/stats
'
;
const
TX_CHART_API_URL
=
'
/node-api/stats/charts/transactions
'
;
const
STATS_API_URL
=
'
/node-api/
home-
stats
'
;
const
TX_CHART_API_URL
=
'
/node-api/
home-
stats/charts/transactions
'
;
test
(
'
daily txs chart +@mobile +@dark-mode +@dark-mode-mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
STATS_API_URL
,
(
route
)
=>
route
.
fulfill
({
...
...
ui/home/indicators/ChainIndicators.tsx
View file @
346d4948
...
...
@@ -37,7 +37,7 @@ const ChainIndicators = () => {
const
fetch
=
useFetch
();
const
statsQueryResult
=
useQuery
<
unknown
,
unknown
,
HomeStats
>
(
[
QueryKeys
.
homeStats
],
()
=>
fetch
(
'
/node-api/stats
'
),
()
=>
fetch
(
'
/node-api/
home-
stats
'
),
);
const
bgColorDesktop
=
useColorModeValue
(
'
white
'
,
'
gray.900
'
);
...
...
ui/home/indicators/utils/indicators.tsx
View file @
346d4948
...
...
@@ -19,7 +19,7 @@ const dailyTxsIndicator: TChainIndicator<QueryKeys.chartsTxs> = {
hint
:
`The total daily number of transactions on the blockchain for the last month.`
,
api
:
{
queryName
:
QueryKeys
.
chartsTxs
,
path
:
'
/node-api/stats/charts/transactions
'
,
path
:
'
/node-api/
home-
stats/charts/transactions
'
,
dataFn
:
(
response
)
=>
([
{
items
:
response
.
chart_data
.
map
((
item
)
=>
({
date
:
new
Date
(
item
.
date
),
value
:
item
.
tx_count
}))
...
...
@@ -38,7 +38,7 @@ const coinPriceIndicator: TChainIndicator<QueryKeys.chartsMarket> = {
hint
:
`
${
appConfig
.
network
.
currency
.
symbol
}
token daily price in USD.`
,
api
:
{
queryName
:
QueryKeys
.
chartsMarket
,
path
:
'
/node-api/stats/charts/market
'
,
path
:
'
/node-api/
home-
stats/charts/market
'
,
dataFn
:
(
response
)
=>
([
{
items
:
response
.
chart_data
.
map
((
item
)
=>
({
date
:
new
Date
(
item
.
date
),
value
:
Number
(
item
.
closing_price
)
}))
...
...
@@ -58,7 +58,7 @@ const marketPriceIndicator: TChainIndicator<QueryKeys.chartsMarket> = {
hint
:
'
The total market value of a cryptocurrency
\'
s circulating supply. It is analogous to the free-float capitalization in the stock market. Market Cap = Current Price x Circulating Supply.
'
,
api
:
{
queryName
:
QueryKeys
.
chartsMarket
,
path
:
'
/node-api/stats/charts/market
'
,
path
:
'
/node-api/
home-
stats/charts/market
'
,
dataFn
:
(
response
)
=>
([
{
items
:
response
.
chart_data
.
map
((
item
)
=>
({
date
:
new
Date
(
item
.
date
),
value
:
Number
(
item
.
closing_price
)
*
Number
(
response
.
available_supply
)
}))
...
...
ui/pages/Blocks.pw.tsx
View file @
346d4948
...
...
@@ -9,7 +9,7 @@ import TestApp from 'playwright/TestApp';
import
Blocks
from
'
./Blocks
'
;
const
BLOCKS_API_URL
=
'
/node-api/blocks?type=block
'
;
const
STATS_API_URL
=
'
/node-api/stats
'
;
const
STATS_API_URL
=
'
/node-api/
home-
stats
'
;
const
hooksConfig
=
{
router
:
{
query
:
{
tab
:
'
blocks
'
},
...
...
ui/pages/Home.pw.tsx
View file @
346d4948
...
...
@@ -11,7 +11,7 @@ import TestApp from 'playwright/TestApp';
import
Home
from
'
./Home
'
;
test
(
'
default view -@default +@desktop-xl +@mobile +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
/node-api/
home-
stats
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
...
...
@@ -30,7 +30,7 @@ test('default view -@default +@desktop-xl +@mobile +@dark-mode', async({ mount,
txMock
.
withTokenTransfer
,
]),
}));
await
page
.
route
(
'
/node-api/stats/charts/transactions
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
/node-api/
home-
stats/charts/transactions
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
dailyTxsMock
.
base
),
}));
...
...
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