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
532d6a17
Commit
532d6a17
authored
Oct 11, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zero gas blocks
parent
7f4e9dea
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
block.ts
types/api/block.ts
+1
-1
BlocksListItem.tsx
ui/blocks/BlocksListItem.tsx
+2
-2
BlocksTableItem.tsx
ui/blocks/BlocksTableItem.tsx
+2
-2
Utilization.tsx
ui/shared/Utilization.tsx
+2
-1
No files found.
types/api/block.ts
View file @
532d6a17
...
...
@@ -13,7 +13,7 @@ export interface Block {
parent_hash
:
string
;
difficulty
:
string
;
total_difficulty
:
string
;
gas_used
:
string
;
gas_used
:
string
|
null
;
gas_limit
:
string
;
nonce
:
number
;
base_fee_per_gas
:
number
|
null
;
...
...
ui/blocks/BlocksListItem.tsx
View file @
532d6a17
...
...
@@ -55,8 +55,8 @@ const BlocksListItem = ({ data, isPending }: Props) => {
<
Box
>
<
Text
fontWeight=
{
500
}
>
Gas used
</
Text
>
<
Flex
columnGap=
{
4
}
>
<
Text
variant=
"secondary"
>
{
BigNumber
(
data
.
gas_used
).
toFormat
()
}
</
Text
>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
).
div
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
Text
variant=
"secondary"
>
{
BigNumber
(
data
.
gas_used
||
0
).
toFormat
()
}
</
Text
>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
||
0
).
div
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
GasUsedToTargetRatio
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
</
Flex
>
</
Box
>
...
...
ui/blocks/BlocksTableItem.tsx
View file @
532d6a17
...
...
@@ -46,9 +46,9 @@ const BlocksTableItem = ({ data, isPending }: Props) => {
</
Td
>
<
Td
isNumeric
fontSize=
"sm"
>
{
data
.
tx_count
}
</
Td
>
<
Td
fontSize=
"sm"
>
<
Box
>
{
BigNumber
(
data
.
gas_used
).
toFormat
()
}
</
Box
>
<
Box
>
{
BigNumber
(
data
.
gas_used
||
0
).
toFormat
()
}
</
Box
>
<
Flex
mt=
{
2
}
>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
).
dividedBy
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
||
0
).
dividedBy
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
GasUsedToTargetRatio
ml=
{
2
}
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
</
Flex
>
</
Td
>
...
...
ui/shared/Utilization.tsx
View file @
532d6a17
import
{
Box
,
Flex
,
Text
,
chakra
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
clamp
from
'
lodash/clamp
'
;
import
React
from
'
react
'
;
interface
Props
{
...
...
@@ -10,7 +11,7 @@ interface Props {
const
WIDTH
=
50
;
const
Utilization
=
({
className
,
value
,
colorScheme
=
'
green
'
}:
Props
)
=>
{
const
valueString
=
(
value
*
100
).
toLocaleString
(
'
en
'
,
{
maximumFractionDigits
:
2
})
+
'
%
'
;
const
valueString
=
(
clamp
(
value
*
100
,
0
,
100
)
).
toLocaleString
(
'
en
'
,
{
maximumFractionDigits
:
2
})
+
'
%
'
;
const
colorGrayScheme
=
useColorModeValue
(
'
gray.500
'
,
'
gray.500
'
);
const
color
=
colorScheme
===
'
gray
'
?
colorGrayScheme
:
'
green.500
'
;
...
...
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