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
6c5fcf9f
Unverified
Commit
6c5fcf9f
authored
Feb 12, 2024
by
Igor Stuev
Committed by
GitHub
Feb 12, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1604 from blockscout/fe-1590
Interpretation UI update
parents
7bf581b0
ae0debf5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
4 deletions
+25
-4
TxSubHeading.pw.tsx
ui/tx/TxSubHeading.pw.tsx
+15
-0
TxSubHeading.tsx
ui/tx/TxSubHeading.tsx
+6
-2
TxSubHeading.pw.tsx_default_with-interpretation-and-view-all-link-mobile-1.png
...efault_with-interpretation-and-view-all-link-mobile-1.png
+0
-0
TxSubHeading.pw.tsx_mobile_with-interpretation-and-view-all-link-mobile-1.png
...mobile_with-interpretation-and-view-all-link-mobile-1.png
+0
-0
TxInterpretation.tsx
ui/tx/interpretation/TxInterpretation.tsx
+4
-2
No files found.
ui/tx/TxSubHeading.pw.tsx
View file @
6c5fcf9f
...
@@ -43,6 +43,21 @@ bsInterpretationTest('with interpretation +@mobile +@dark-mode', async({ mount,
...
@@ -43,6 +43,21 @@ bsInterpretationTest('with interpretation +@mobile +@dark-mode', async({ mount,
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
bsInterpretationTest
(
'
with interpretation and view all link +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
TX_INTERPRETATION_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
({
data
:
{
summaries
:
[
...
txInterpretation
.
data
.
summaries
,
...
txInterpretation
.
data
.
summaries
]
}
}),
}));
const
component
=
await
mount
(
<
TestApp
>
<
TxSubHeading
hash=
{
hash
}
hasTag=
{
false
}
/>
</
TestApp
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
bsInterpretationTest
(
'
no interpretation
'
,
async
({
mount
,
page
})
=>
{
bsInterpretationTest
(
'
no interpretation
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
TX_INTERPRETATION_API_URL
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
TX_INTERPRETATION_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
status
:
200
,
...
...
ui/tx/TxSubHeading.tsx
View file @
6c5fcf9f
...
@@ -29,6 +29,9 @@ const TxSubHeading = ({ hash, hasTag }: Props) => {
...
@@ -29,6 +29,9 @@ const TxSubHeading = ({ hash, hasTag }: Props) => {
const
hasInterpretation
=
hasInterpretationFeature
&&
const
hasInterpretation
=
hasInterpretationFeature
&&
(
txInterpretationQuery
.
isPlaceholderData
||
Boolean
(
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
));
(
txInterpretationQuery
.
isPlaceholderData
||
Boolean
(
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
));
const
hasViewAllInterpretationsLink
=
!
txInterpretationQuery
.
isPlaceholderData
&&
txInterpretationQuery
.
data
?.
data
.
summaries
&&
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
>
1
;
return
(
return
(
<
Box
display=
{
{
base
:
'
block
'
,
lg
:
'
flex
'
}
}
alignItems=
"center"
w=
"100%"
>
<
Box
display=
{
{
base
:
'
block
'
,
lg
:
'
flex
'
}
}
alignItems=
"center"
w=
"100%"
>
{
hasInterpretation
&&
(
{
hasInterpretation
&&
(
...
@@ -37,9 +40,10 @@ const TxSubHeading = ({ hash, hasTag }: Props) => {
...
@@ -37,9 +40,10 @@ const TxSubHeading = ({ hash, hasTag }: Props) => {
summary=
{
txInterpretationQuery
.
data
?.
data
.
summaries
[
0
]
}
summary=
{
txInterpretationQuery
.
data
?.
data
.
summaries
[
0
]
}
isLoading=
{
txInterpretationQuery
.
isPlaceholderData
}
isLoading=
{
txInterpretationQuery
.
isPlaceholderData
}
fontSize=
"lg"
fontSize=
"lg"
mr=
{
hasViewAllInterpretationsLink
?
3
:
0
}
/>
/>
{
!
txInterpretationQuery
.
isPlaceholderData
&&
txInterpretationQuery
.
data
?.
data
.
summaries
&&
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
>
1
&&
{
hasViewAllInterpretationsLink
&&
<
Link
ml=
{
3
}
href=
{
`#${ TX_ACTIONS_BLOCK_ID }`
}
>
all actions
</
Link
>
}
<
Link
href=
{
`#${ TX_ACTIONS_BLOCK_ID }`
}
>
View all
</
Link
>
}
</
Flex
>
</
Flex
>
)
}
)
}
{
!
hasInterpretation
&&
<
TxEntity
hash=
{
hash
}
noLink
noCopy=
{
false
}
fontWeight=
{
500
}
mr=
{
{
base
:
0
,
lg
:
2
}
}
fontFamily=
"heading"
/>
}
{
!
hasInterpretation
&&
<
TxEntity
hash=
{
hash
}
noLink
noCopy=
{
false
}
fontWeight=
{
500
}
mr=
{
{
base
:
0
,
lg
:
2
}
}
fontFamily=
"heading"
/>
}
...
...
ui/tx/__screenshots__/TxSubHeading.pw.tsx_default_with-interpretation-and-view-all-link-mobile-1.png
0 → 100644
View file @
6c5fcf9f
11.1 KB
ui/tx/__screenshots__/TxSubHeading.pw.tsx_mobile_with-interpretation-and-view-all-link-mobile-1.png
0 → 100644
View file @
6c5fcf9f
10.7 KB
ui/tx/interpretation/TxInterpretation.tsx
View file @
6c5fcf9f
import
{
Skeleton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Skeleton
,
Tooltip
,
chakra
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -127,7 +127,9 @@ const TxInterpretation = ({ summary, isLoading, className }: Props) => {
...
@@ -127,7 +127,9 @@ const TxInterpretation = ({ summary, isLoading, className }: Props) => {
return
(
return
(
<
Skeleton
isLoaded=
{
!
isLoading
}
className=
{
className
}
fontWeight=
{
500
}
whiteSpace=
"pre-wrap"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
className=
{
className
}
fontWeight=
{
500
}
whiteSpace=
"pre-wrap"
>
<
IconSvg
name=
"lightning"
boxSize=
{
5
}
color=
"text_secondary"
mr=
{
2
}
verticalAlign=
"text-top"
/>
<
Tooltip
label=
"Transaction summary"
>
<
IconSvg
name=
"lightning"
boxSize=
{
5
}
color=
"text_secondary"
mr=
{
2
}
verticalAlign=
"text-top"
/>
</
Tooltip
>
{
chunks
.
map
((
chunk
,
index
)
=>
{
{
chunks
.
map
((
chunk
,
index
)
=>
{
return
(
return
(
<
chakra
.
span
key=
{
chunk
+
index
}
>
<
chakra
.
span
key=
{
chunk
+
index
}
>
...
...
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