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
ac044ac7
Commit
ac044ac7
authored
Oct 07, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoded values for logs
parent
caa38ffd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
18 deletions
+45
-18
TxLogItem.tsx
ui/tx/logs/TxLogItem.tsx
+10
-1
TxLogTopic.tsx
ui/tx/logs/TxLogTopic.tsx
+35
-17
No files found.
ui/tx/logs/TxLogItem.tsx
View file @
ac044ac7
...
@@ -22,6 +22,7 @@ const TxLogItem = ({ address, index, topics, data, decoded }: Props) => {
...
@@ -22,6 +22,7 @@ const TxLogItem = ({ address, index, topics, data, decoded }: Props) => {
const
borderColor
=
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
);
const
borderColor
=
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
);
const
dataBgColor
=
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
);
const
dataBgColor
=
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
);
const
decodedTopics
=
decoded
?.
parameters
.
filter
(({
indexed
})
=>
indexed
);
return
(
return
(
<
Grid
<
Grid
...
@@ -63,7 +64,15 @@ const TxLogItem = ({ address, index, topics, data, decoded }: Props) => {
...
@@ -63,7 +64,15 @@ const TxLogItem = ({ address, index, topics, data, decoded }: Props) => {
)
}
)
}
<
RowHeader
>
Topics
</
RowHeader
>
<
RowHeader
>
Topics
</
RowHeader
>
<
GridItem
>
<
GridItem
>
{
topics
.
filter
(
Boolean
).
map
((
item
,
index
)
=>
<
TxLogTopic
key=
{
index
}
hex=
{
item
}
index=
{
index
}
/>)
}
{
topics
.
filter
(
Boolean
).
map
((
item
,
index
)
=>
(
<
TxLogTopic
key=
{
index
}
hex=
{
item
}
decoded=
{
decodedTopics
?.[
index
-
1
]?.
value
}
type=
{
decodedTopics
?.[
index
-
1
]?.
type
}
index=
{
index
}
/>
))
}
</
GridItem
>
</
GridItem
>
<
RowHeader
>
Data
</
RowHeader
>
<
RowHeader
>
Data
</
RowHeader
>
<
GridItem
p=
{
4
}
fontSize=
"sm"
borderRadius=
"md"
bgColor=
{
dataBgColor
}
>
<
GridItem
p=
{
4
}
fontSize=
"sm"
borderRadius=
"md"
bgColor=
{
dataBgColor
}
>
...
...
ui/tx/logs/TxLogTopic.tsx
View file @
ac044ac7
import
{
Flex
,
Button
,
Select
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Button
,
Select
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
interface
Props
{
interface
Props
{
hex
:
string
;
hex
:
string
;
decoded
?:
string
;
type
?:
string
;
index
:
number
;
index
:
number
;
}
}
type
DataType
=
'
Hex
'
|
'
Dec
'
type
DataType
=
'
Hex
'
|
'
Dec
'
;
const
OPTIONS
:
Array
<
DataType
>
=
[
'
Hex
'
,
'
Dec
'
];
const
OPTIONS
:
Array
<
DataType
>
=
[
'
Hex
'
,
'
Dec
'
];
const
TxLogTopic
=
({
hex
,
index
}:
Props
)
=>
{
const
TxLogTopic
=
({
hex
,
index
,
decoded
,
type
}:
Props
)
=>
{
const
[
selectedDataType
,
setSelectedDataType
]
=
React
.
useState
<
DataType
>
(
'
Hex
'
);
const
[
selectedDataType
,
setSelectedDataType
]
=
React
.
useState
<
DataType
>
(
'
Hex
'
);
const
handleSelectChange
=
React
.
useCallback
((
event
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
{
const
handleSelectChange
=
React
.
useCallback
((
event
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
{
setSelectedDataType
(
event
.
target
.
value
as
DataType
);
setSelectedDataType
(
event
.
target
.
value
as
DataType
);
},
[]);
},
[]);
const
content
=
(()
=>
{
if
(
selectedDataType
===
'
Dec
'
&&
type
===
'
address
'
&&
decoded
)
{
return
(
<
AddressLink
hash=
{
decoded
}
/>
);
}
const
value
=
selectedDataType
===
'
Dec
'
&&
decoded
?
decoded
:
hex
;
return
(
<
Box
overflow=
"hidden"
whiteSpace=
"nowrap"
>
<
HashStringShortenDynamic
hash=
{
value
}
/>
</
Box
>
);
})();
return
(
return
(
<
Flex
alignItems=
"center"
px=
{
{
base
:
0
,
lg
:
3
}
}
_notFirst=
{
{
mt
:
3
}
}
overflow=
"hidden"
maxW=
"100%"
>
<
Flex
alignItems=
"center"
px=
{
{
base
:
0
,
lg
:
3
}
}
_notFirst=
{
{
mt
:
3
}
}
overflow=
"hidden"
maxW=
"100%"
>
<
Button
variant=
"outline"
colorScheme=
"gray"
isActive
size=
"xs"
fontWeight=
{
400
}
mr=
{
3
}
w=
{
6
}
>
<
Button
variant=
"outline"
colorScheme=
"gray"
isActive
size=
"xs"
fontWeight=
{
400
}
mr=
{
3
}
w=
{
6
}
>
{
index
}
{
index
}
</
Button
>
</
Button
>
<
Select
{
decoded
&&
(
size=
"sm"
<
Select
borderRadius=
"base
"
size=
"sm
"
value=
{
selectedDataType
}
borderRadius=
"base"
onChange=
{
handleSelectChang
e
}
value=
{
selectedDataTyp
e
}
focusBorderColor=
"none"
onChange=
{
handleSelectChange
}
w=
"75px
"
focusBorderColor=
"none
"
mr=
{
3
}
w=
"75px"
flexShrink=
{
0
}
mr=
{
3
}
>
flexShrink=
{
0
}
{
OPTIONS
.
map
((
option
)
=>
<
option
key=
{
option
}
value=
{
option
}
>
{
option
}
</
option
>)
}
>
</
Select
>
{
OPTIONS
.
map
((
option
)
=>
<
option
key=
{
option
}
value=
{
option
}
>
{
option
}
</
option
>)
}
<
Box
overflow=
"hidden"
whiteSpace=
"nowrap"
>
</
Select
>
<
HashStringShortenDynamic
hash=
{
hex
}
/>
)
}
</
Box
>
{
content
}
</
Flex
>
</
Flex
>
);
);
};
};
...
...
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