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
1fac844d
Commit
1fac844d
authored
Dec 27, 2022
by
Yuri Mikhin
Committed by
Yuri Mikhin
Dec 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stats widgets.
parent
d33d6ea6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
27 deletions
+55
-27
stats.ts
types/api/stats.ts
+9
-2
NumberWidgetsList.tsx
ui/stats/NumberWidgetsList.tsx
+3
-24
charts-scheme.ts
ui/stats/constants/charts-scheme.ts
+1
-1
number-widgets-scheme.ts
ui/stats/constants/number-widgets-scheme.ts
+42
-0
No files found.
types/api/stats.ts
View file @
1fac844d
...
@@ -21,11 +21,18 @@ export type GasPrices = {
...
@@ -21,11 +21,18 @@ export type GasPrices = {
export
type
Stats
=
{
export
type
Stats
=
{
counters
:
{
counters
:
{
totalBlocks
:
string
;
averageBlockTime
:
string
;
averageBlockTime
:
string
;
totalTransactions
:
string
;
completedTransactions
:
string
;
completedTransactions
:
string
;
totalAccounts
:
string
;
totalAccounts
:
string
;
totalBlocksAllTime
:
string
;
totalTransactions
:
string
;
totalTokens
:
string
;
totalNativeCoinHolders
:
string
;
totalNativeCoinTransfers
:
string
;
};
};
}
}
...
...
ui/stats/NumberWidgetsList.tsx
View file @
1fac844d
...
@@ -3,6 +3,7 @@ import React from 'react';
...
@@ -3,6 +3,7 @@ import React from 'react';
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
{
numberWidgetsScheme
}
from
'
./constants/number-widgets-scheme
'
;
import
NumberWidget
from
'
./NumberWidget
'
;
import
NumberWidget
from
'
./NumberWidget
'
;
import
NumberWidgetSkeleton
from
'
./NumberWidgetSkeleton
'
;
import
NumberWidgetSkeleton
from
'
./NumberWidgetSkeleton
'
;
...
@@ -18,30 +19,8 @@ const NumberWidgetsList = () => {
...
@@ -18,30 +19,8 @@ const NumberWidgetsList = () => {
>
>
{
isLoading
?
[
...
Array
(
skeletonsCount
)
]
{
isLoading
?
[
...
Array
(
skeletonsCount
)
]
.
map
((
e
,
i
)
=>
<
NumberWidgetSkeleton
key=
{
i
}
/>)
:
.
map
((
e
,
i
)
=>
<
NumberWidgetSkeleton
key=
{
i
}
/>)
:
(
numberWidgetsScheme
.
map
(({
id
,
title
})
=>
<>
data
?.
counters
[
id
]
?
<
NumberWidget
key=
{
id
}
label=
{
title
}
value=
{
Number
(
data
.
counters
[
id
]).
toLocaleString
()
}
/>
:
null
)
}
<
NumberWidget
label=
"Total blocks"
value=
{
Number
(
data
?.
counters
.
totalBlocksAllTime
).
toLocaleString
()
}
/>
<
NumberWidget
label=
"Average block time"
value=
{
Number
(
data
?.
counters
.
averageBlockTime
).
toLocaleString
()
}
/>
<
NumberWidget
label=
"Completed transactions"
value=
{
Number
(
data
?.
counters
.
completedTransactions
).
toLocaleString
()
}
/>
<
NumberWidget
label=
"Total transactions"
value=
{
Number
(
data
?.
counters
.
totalTransactions
).
toLocaleString
()
}
/>
<
NumberWidget
label=
"Total accounts"
value=
{
Number
(
data
?.
counters
.
totalAccounts
).
toLocaleString
()
}
/>
</>
)
}
</
Grid
>
</
Grid
>
);
);
};
};
...
...
ui/stats/constants/charts-scheme.ts
View file @
1fac844d
...
@@ -6,7 +6,7 @@ export const statsChartsScheme: Array<StatsSection> = [
...
@@ -6,7 +6,7 @@ export const statsChartsScheme: Array<StatsSection> = [
title
:
'
Blocks
'
,
title
:
'
Blocks
'
,
charts
:
[
charts
:
[
{
{
id
:
'
new
-blocks
'
,
id
:
'
new
BlocksPerDay
'
,
title
:
'
New blocks
'
,
title
:
'
New blocks
'
,
description
:
'
New blocks number per day
'
,
description
:
'
New blocks number per day
'
,
},
},
...
...
ui/stats/constants/number-widgets-scheme.ts
0 → 100644
View file @
1fac844d
import
type
{
Stats
}
from
'
types/api/stats
'
;
type
Key
=
keyof
Stats
[
'
counters
'
];
export
const
numberWidgetsScheme
:
Array
<
{
id
:
Key
;
title
:
string
}
>
=
[
{
id
:
'
totalBlocks
'
,
title
:
'
Total blocks
'
,
},
{
id
:
'
averageBlockTime
'
,
title
:
'
Average block time
'
,
},
{
id
:
'
totalTransactions
'
,
title
:
'
Total transactions
'
,
},
{
id
:
'
completedTransactions
'
,
title
:
'
Completed transactions
'
,
},
{
id
:
'
totalAccounts
'
,
title
:
'
Total accounts
'
,
},
{
id
:
'
totalTokens
'
,
title
:
'
Total tokens
'
,
},
{
id
:
'
totalNativeCoinHolders
'
,
title
:
'
Total native coin holders
'
,
},
{
id
:
'
totalNativeCoinTransfers
'
,
title
:
'
Total native coin transfers
'
,
},
{
id
:
'
totalAccounts
'
,
title
:
'
Total accounts
'
,
},
];
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