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
3955f6db
Unverified
Commit
3955f6db
authored
Oct 28, 2022
by
tom goriunov
Committed by
GitHub
Oct 28, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #269 from blockscout/new-block-transition
animate new block in the list
parents
def2832f
a90e5a56
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
14 deletions
+40
-14
BlocksContent.tsx
ui/blocks/BlocksContent.tsx
+1
-1
BlocksList.tsx
ui/blocks/BlocksList.tsx
+5
-2
BlocksListItem.tsx
ui/blocks/BlocksListItem.tsx
+11
-7
BlocksTable.tsx
ui/blocks/BlocksTable.tsx
+5
-2
BlocksTableItem.tsx
ui/blocks/BlocksTableItem.tsx
+9
-1
AccountListItemMobile.tsx
ui/shared/AccountListItemMobile.tsx
+9
-1
No files found.
ui/blocks/BlocksContent.tsx
View file @
3955f6db
...
@@ -49,7 +49,7 @@ const BlocksContent = ({ type }: Props) => {
...
@@ -49,7 +49,7 @@ const BlocksContent = ({ type }: Props) => {
return
(
return
(
<>
<>
<
Text
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
<
Text
as=
"span"
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
<
Show
below=
"lg"
key=
"content-mobile"
><
BlocksList
data=
{
data
.
items
}
/></
Show
>
<
Show
below=
"lg"
key=
"content-mobile"
><
BlocksList
data=
{
data
.
items
}
/></
Show
>
<
Show
above=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
/></
Show
>
<
Show
above=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
/></
Show
>
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
...
...
ui/blocks/BlocksList.tsx
View file @
3955f6db
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
{
AnimatePresence
}
from
'
framer-motion
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
...
@@ -12,8 +13,10 @@ interface Props {
...
@@ -12,8 +13,10 @@ interface Props {
const
BlocksList
=
({
data
}:
Props
)
=>
{
const
BlocksList
=
({
data
}:
Props
)
=>
{
return
(
return
(
<
Box
mt=
{
8
}
>
<
Box
mt=
{
8
}
>
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
<
AnimatePresence
initial=
{
false
}
>
{
data
.
map
((
item
)
=>
<
BlocksListItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
{
data
.
map
((
item
)
=>
<
BlocksListItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
</
AnimatePresence
>
</
Box
>
</
Box
>
);
);
};
};
...
...
ui/blocks/BlocksListItem.tsx
View file @
3955f6db
...
@@ -30,7 +30,7 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
...
@@ -30,7 +30,7 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
return
(
return
(
<
AccountListItemMobile
rowGap=
{
3
}
>
<
AccountListItemMobile
rowGap=
{
3
}
key=
{
String
(
data
.
height
)
}
>
<
Flex
justifyContent=
"space-between"
w=
"100%"
>
<
Flex
justifyContent=
"space-between"
w=
"100%"
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
>
{
isPending
&&
<
Spinner
size=
"sm"
/>
}
{
isPending
&&
<
Spinner
size=
"sm"
/>
}
...
@@ -57,7 +57,7 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
...
@@ -57,7 +57,7 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
</
Flex
>
</
Flex
>
<
Box
>
<
Box
>
<
Text
fontWeight=
{
500
}
>
Gas used
</
Text
>
<
Text
fontWeight=
{
500
}
>
Gas used
</
Text
>
<
Flex
columnGap=
{
4
}
>
<
Flex
columnGap=
{
4
}
mt=
{
2
}
>
<
Text
variant=
"secondary"
>
{
BigNumber
(
data
.
gas_used
||
0
).
toFormat
()
}
</
Text
>
<
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
()
}
/>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
||
0
).
div
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
GasUsedToTargetRatio
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
<
GasUsedToTargetRatio
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
...
@@ -67,12 +67,16 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
...
@@ -67,12 +67,16 @@ const BlocksListItem = ({ data, isPending, enableTimeIncrement }: Props) => {
<
Text
fontWeight=
{
500
}
>
Reward
{
appConfig
.
network
.
currency
.
symbol
}
</
Text
>
<
Text
fontWeight=
{
500
}
>
Reward
{
appConfig
.
network
.
currency
.
symbol
}
</
Text
>
<
Text
variant=
"secondary"
>
{
totalReward
.
div
(
WEI
).
toFixed
()
}
</
Text
>
<
Text
variant=
"secondary"
>
{
totalReward
.
div
(
WEI
).
toFixed
()
}
</
Text
>
</
Flex
>
</
Flex
>
<
Fle
x
>
<
Bo
x
>
<
Text
fontWeight=
{
500
}
>
Burnt fees
</
Text
>
<
Text
fontWeight=
{
500
}
>
Burnt fees
</
Text
>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
"gray.500"
ml=
{
2
}
/>
<
Flex
columnGap=
{
4
}
mt=
{
2
}
>
<
Text
variant=
"secondary"
ml=
{
1
}
>
{
burntFees
.
div
(
WEI
).
toFixed
()
}
</
Text
>
<
Flex
>
<
Utilization
ml=
{
4
}
value=
{
burntFees
.
div
(
txFees
).
toNumber
()
}
/>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
"gray.500"
/>
</
Flex
>
<
Text
variant=
"secondary"
ml=
{
1
}
>
{
burntFees
.
div
(
WEI
).
toFixed
()
}
</
Text
>
</
Flex
>
<
Utilization
ml=
{
4
}
value=
{
burntFees
.
div
(
txFees
).
toNumber
()
}
/>
</
Flex
>
</
Box
>
</
AccountListItemMobile
>
</
AccountListItemMobile
>
);
);
};
};
...
...
ui/blocks/BlocksTable.tsx
View file @
3955f6db
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
}
from
'
@chakra-ui/react
'
;
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
}
from
'
@chakra-ui/react
'
;
import
{
AnimatePresence
}
from
'
framer-motion
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -29,8 +30,10 @@ const BlocksTable = ({ data }: Props) => {
...
@@ -29,8 +30,10 @@ const BlocksTable = ({ data }: Props) => {
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
<
AnimatePresence
initial=
{
false
}
>
{
data
.
map
((
item
)
=>
<
BlocksTableItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
{
data
.
map
((
item
)
=>
<
BlocksTableItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
</
AnimatePresence
>
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
</
TableContainer
>
...
...
ui/blocks/BlocksTableItem.tsx
View file @
3955f6db
import
{
Tr
,
Td
,
Link
,
Flex
,
Box
,
Icon
,
Tooltip
,
Spinner
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Tr
,
Td
,
Link
,
Flex
,
Box
,
Icon
,
Tooltip
,
Spinner
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
{
motion
}
from
'
framer-motion
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
...
@@ -26,7 +27,14 @@ const BlocksTableItem = ({ data, isPending, enableTimeIncrement }: Props) => {
...
@@ -26,7 +27,14 @@ const BlocksTableItem = ({ data, isPending, enableTimeIncrement }: Props) => {
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
return
(
return
(
<
Tr
>
<
Tr
as=
{
motion
.
tr
}
initial=
{
{
opacity
:
0
,
scale
:
0.97
}
}
animate=
{
{
opacity
:
1
,
scale
:
1
}
}
transitionDuration=
"normal"
transitionTimingFunction=
"linear"
key=
{
data
.
height
}
>
<
Td
fontSize=
"sm"
>
<
Td
fontSize=
"sm"
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
mb=
{
2
}
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
mb=
{
2
}
>
{
isPending
&&
<
Spinner
size=
"sm"
flexShrink=
{
0
}
/>
}
{
isPending
&&
<
Spinner
size=
"sm"
flexShrink=
{
0
}
/>
}
...
...
ui/shared/AccountListItemMobile.tsx
View file @
3955f6db
import
{
Flex
,
useColorModeValue
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
useColorModeValue
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
motion
}
from
'
framer-motion
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
interface
Props
{
interface
Props
{
children
:
React
.
ReactNode
;
children
:
React
.
ReactNode
;
className
?:
string
;
className
?:
string
;
key
?:
string
;
}
}
const
AccountListItemMobile
=
({
children
,
className
}:
Props
)
=>
{
const
AccountListItemMobile
=
({
children
,
className
,
key
}:
Props
)
=>
{
return
(
return
(
<
Flex
<
Flex
as=
{
motion
.
div
}
initial=
{
{
opacity
:
0
,
scale
:
0.97
}
}
animate=
{
{
opacity
:
1
,
scale
:
1
}
}
transitionDuration=
"normal"
transitionTimingFunction=
"linear"
key=
{
key
}
rowGap=
{
6
}
rowGap=
{
6
}
alignItems=
"flex-start"
alignItems=
"flex-start"
flexDirection=
"column"
flexDirection=
"column"
...
...
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