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
14983e6f
Commit
14983e6f
authored
Sep 22, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state tab
parent
1814a000
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
164 additions
and
39 deletions
+164
-39
TxState.tsx
ui/tx/TxState.tsx
+9
-33
TxStateList.tsx
ui/tx/state/TxStateList.tsx
+15
-0
TxStateListItem.tsx
ui/tx/state/TxStateListItem.tsx
+91
-0
TxStateStorageItem.tsx
ui/tx/state/TxStateStorageItem.tsx
+11
-6
TxStateTable.tsx
ui/tx/state/TxStateTable.tsx
+38
-0
No files found.
ui/tx/TxState.tsx
View file @
14983e6f
import
{
Accordion
,
Text
,
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
import
{
Accordion
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
data
}
from
'
data/txState
'
;
import
TxStateTableItem
from
'
./state/TxStateTableItem
'
;
const
CURRENCY
=
'
ETH
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
TxStateList
from
'
ui/tx/state/TxStateList
'
;
import
TxStateTable
from
'
ui/tx/state/TxStateTable
'
;
const
TxState
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
list
=
isMobile
?
<
TxStateList
/>
:
<
TxStateTable
/>;
return
(
<>
<
Text
>
A set of information that represents the current state is updated when a transaction takes place on the network. The below is a summary of those changes
</
Text
>
<
Accordion
allowToggle
allowMultiple
>
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
<
Thead
>
<
Tr
>
<
Th
width=
"92px"
>
Storage
</
Th
>
<
Th
width=
"146px"
>
Address
</
Th
>
<
Th
width=
"120px"
>
Miner
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`After ${ CURRENCY }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`Before ${ CURRENCY }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`State difference ${ CURRENCY }`
}
</
Th
>
</
Tr
>
</
Thead
>
<
Tbody
>
{
data
.
map
((
item
,
index
)
=>
<
TxStateTableItem
txStateItem=
{
item
}
key=
{
index
}
/>)
}
</
Tbody
>
</
Table
>
</
TableContainer
>
<
Accordion
allowMultiple
defaultIndex=
{
[]
}
>
{
list
}
</
Accordion
>
</>
);
...
...
ui/tx/state/TxStateList.tsx
0 → 100644
View file @
14983e6f
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
data
}
from
'
data/txState
'
;
import
TxStateListItem
from
'
ui/tx/state/TxStateListItem
'
;
const
TxStateList
=
()
=>
{
return
(
<
Box
mt=
{
6
}
>
{
data
.
map
((
item
,
index
)
=>
<
TxStateListItem
key=
{
index
}
{
...
item
}
/>)
}
</
Box
>
);
};
export
default
TxStateList
;
ui/tx/state/TxStateListItem.tsx
0 → 100644
View file @
14983e6f
import
{
AccordionItem
,
AccordionButton
,
AccordionIcon
,
Button
,
Flex
,
Text
,
Link
,
StatArrow
,
Stat
,
AccordionPanel
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
ArrayElement
from
'
types/utils/ArrayElement
'
;
import
type
{
data
}
from
'
data/txState
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
AccountListItemMobile
from
'
ui/shared/AccountListItemMobile
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
TxStateStorageItem
from
'
./TxStateStorageItem
'
;
type
Props
=
ArrayElement
<
typeof
data
>
;
const
TxStateListItem
=
({
storage
,
address
,
miner
,
after
,
before
,
diff
}:
Props
)
=>
{
const
hasStorageData
=
Boolean
(
storage
?.
length
);
return
(
<
AccountListItemMobile
>
<
AccordionItem
isDisabled=
{
!
hasStorageData
}
border=
{
0
}
w=
"100%"
display=
"flex"
flexDirection=
"column"
rowGap=
{
3
}
>
{
({
isExpanded
})
=>
(
<>
<
Flex
>
<
Address
flexGrow=
{
1
}
>
<
AddressIcon
hash=
{
address
}
/>
<
AddressLink
hash=
{
address
}
fontWeight=
"500"
ml=
{
2
}
/>
</
Address
>
<
AccordionButton
_hover=
{
{
background
:
'
unset
'
}
}
padding=
"0"
ml=
{
4
}
w=
"auto"
>
<
Button
variant=
"outline"
borderWidth=
"1px"
// button can't be inside button (AccordionButton)
as=
"div"
isActive=
{
isExpanded
}
size=
"sm"
fontWeight=
{
400
}
isDisabled=
{
!
hasStorageData
}
colorScheme=
"gray"
// AccordionButton has its own opacity rule when disabled
_disabled=
{
{
opacity
:
1
}
}
>
{
storage
?.
length
||
'
0
'
}
</
Button
>
<
AccordionIcon
color=
"blue.600"
width=
"30px"
/>
</
AccordionButton
>
</
Flex
>
<
Flex
rowGap=
{
2
}
flexDir=
"column"
fontSize=
"sm"
>
<
Text
fontWeight=
{
600
}
>
Miner
</
Text
>
<
Link
>
{
miner
}
</
Link
>
</
Flex
>
<
Flex
rowGap=
{
2
}
flexDir=
"column"
fontSize=
"sm"
>
<
Text
fontWeight=
{
600
}
>
Before
</
Text
>
<
Flex
>
<
Text
>
{
before
.
balance
}
ETH
</
Text
>
<
TextSeparator
/>
{
typeof
before
.
nonce
!==
'
undefined
'
&&
<
Text
>
Nonce:
{
nbsp
}{
before
.
nonce
}
</
Text
>
}
</
Flex
>
</
Flex
>
<
Flex
rowGap=
{
2
}
flexDir=
"column"
fontSize=
"sm"
>
<
Text
fontWeight=
{
600
}
>
After
</
Text
>
<
Text
>
{
after
.
balance
}
ETH
</
Text
>
{
typeof
after
.
nonce
!==
'
undefined
'
&&
<
Text
>
Nonce:
{
nbsp
}{
after
.
nonce
}
</
Text
>
}
</
Flex
>
<
Flex
rowGap=
{
2
}
flexDir=
"column"
fontSize=
"sm"
>
<
Text
fontWeight=
{
600
}
>
State difference
</
Text
>
<
Stat
>
{
diff
}
ETH
<
StatArrow
ml=
{
2
}
type=
{
Number
(
diff
)
>
0
?
'
increase
'
:
'
decrease
'
}
/>
</
Stat
>
</
Flex
>
{
hasStorageData
&&
(
<
AccordionPanel
fontWeight=
{
500
}
p=
{
0
}
>
{
storage
?.
map
((
storageItem
,
index
)
=>
<
TxStateStorageItem
key=
{
index
}
storageItem=
{
storageItem
}
/>)
}
</
AccordionPanel
>
)
}
</>
)
}
</
AccordionItem
>
</
AccountListItemMobile
>
);
};
export
default
TxStateListItem
;
ui/tx/state/TxStateStorageItem.tsx
View file @
14983e6f
...
...
@@ -2,11 +2,13 @@ import {
Grid
,
GridItem
,
Select
,
Box
,
useColorModeValue
,
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
TTxStateItemStorage
}
from
'
data/txState
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
const
TxStateStorageItem
=
({
storageItem
}:
{
storageItem
:
TTxStateItemStorage
})
=>
{
const
gridData
=
[
...
...
@@ -20,7 +22,7 @@ const TxStateStorageItem = ({ storageItem }: {storageItem: TTxStateItemStorage})
const
OPTIONS
=
[
'
Hex
'
,
'
Number
'
,
'
Text
'
,
'
Address
'
];
return
(
<
Grid
gridTemplateColumns=
"auto 1fr"
gridTemplateColumns=
{
{
base
:
'
70px minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
columnGap=
{
3
}
rowGap=
{
4
}
px=
{
6
}
...
...
@@ -28,11 +30,12 @@ const TxStateStorageItem = ({ storageItem }: {storageItem: TTxStateItemStorage})
background=
"blackAlpha.50"
borderRadius=
"12px"
mb=
{
4
}
fontSize=
{
{
base
:
'
sm
'
,
lg
:
'
md
'
}
}
>
{
gridData
.
map
((
item
)
=>
(
<>
<
GridItem
alignSelf=
"center"
fontWeight=
{
600
}
textAlign=
"end"
>
{
item
.
name
}
</
GridItem
>
<
GridItem
>
<
React
.
Fragment
key=
{
item
.
name
}
>
<
GridItem
alignSelf=
{
{
base
:
'
start
'
,
lg
:
'
center
'
}
}
fontWeight=
{
{
base
:
500
,
lg
:
600
}
}
textAlign=
"end"
>
{
item
.
name
}
</
GridItem
>
<
GridItem
display=
"flex"
flexDir=
"column"
rowGap=
{
2
}
alignItems=
"flex-start"
>
{
item
.
select
&&
(
<
Select
size=
"sm"
...
...
@@ -46,9 +49,11 @@ const TxStateStorageItem = ({ storageItem }: {storageItem: TTxStateItemStorage})
{
OPTIONS
.
map
((
option
)
=>
<
option
key=
{
option
}
value=
{
option
}
>
{
option
}
</
option
>)
}
</
Select
>
)
}
{
item
.
value
}
<
Box
fontWeight=
{
{
base
:
400
,
lg
:
500
}
}
overflow=
"hidden"
whiteSpace=
"nowrap"
maxW=
"100%"
>
<
HashStringShortenDynamic
hash=
{
item
.
value
}
/>
</
Box
>
</
GridItem
>
</>
</
React
.
Fragment
>
))
}
</
Grid
>
);
...
...
ui/tx/state/TxStateTable.tsx
0 → 100644
View file @
14983e6f
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
data
}
from
'
data/txState
'
;
import
TxStateTableItem
from
'
ui/tx/state/TxStateTableItem
'
;
const
CURRENCY
=
'
ETH
'
;
const
TxStateTable
=
()
=>
{
return
(
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
>
<
Thead
>
<
Tr
>
<
Th
width=
"92px"
>
Storage
</
Th
>
<
Th
width=
"146px"
>
Address
</
Th
>
<
Th
width=
"120px"
>
Miner
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`After ${ CURRENCY }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`Before ${ CURRENCY }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`State difference ${ CURRENCY }`
}
</
Th
>
</
Tr
>
</
Thead
>
<
Tbody
>
{
data
.
map
((
item
,
index
)
=>
<
TxStateTableItem
txStateItem=
{
item
}
key=
{
index
}
/>)
}
</
Tbody
>
</
Table
>
</
TableContainer
>
);
};
export
default
TxStateTable
;
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