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
553aad0e
Commit
553aad0e
authored
Oct 17, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scroll for token transfer
parent
17e2f303
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
10 deletions
+71
-10
NftTokenTransferSnippet.tsx
ui/tx/NftTokenTransferSnippet.tsx
+7
-5
TokenTransferList.tsx
ui/tx/TokenTransferList.tsx
+60
-0
TxDetails.tsx
ui/tx/TxDetails.tsx
+4
-5
No files found.
ui/tx/NftTokenTransferSnippet.tsx
View file @
553aad0e
import
{
Flex
,
Link
,
Text
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Link
,
Text
,
Icon
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
nftIcon
from
'
icons/nft_shield.svg
'
;
...
...
@@ -17,11 +17,13 @@ const NftTokenTransferSnippet = (props: Props) => {
const
url
=
link
(
'
token_instance_item
'
,
{
hash
:
props
.
hash
,
id
:
props
.
tokenId
});
return
(
<
Flex
alignItems=
"center"
>
<
Flex
alignItems=
"center"
columnGap=
{
3
}
rowGap=
{
2
}
flexWrap=
"wrap"
>
<
Text
fontWeight=
{
500
}
as=
"span"
>
For
{
num
}
token ID:
</
Text
>
<
Icon
as=
{
nftIcon
}
boxSize=
{
6
}
ml=
{
3
}
mr=
{
1
}
/>
<
Link
href=
{
url
}
fontWeight=
{
600
}
>
{
props
.
tokenId
}
</
Link
>
<
TokenSnippet
symbol=
{
props
.
symbol
}
hash=
{
props
.
hash
}
name=
"Foo"
ml=
{
3
}
/>
<
Box
display=
"inline-flex"
alignItems=
"center"
>
<
Icon
as=
{
nftIcon
}
boxSize=
{
6
}
mr=
{
1
}
/>
<
Link
href=
{
url
}
fontWeight=
{
600
}
>
{
props
.
tokenId
}
</
Link
>
</
Box
>
<
TokenSnippet
symbol=
{
props
.
symbol
}
hash=
{
props
.
hash
}
name=
"Foo"
/>
</
Flex
>
);
};
...
...
ui/tx/TokenTransferList.tsx
0 → 100644
View file @
553aad0e
import
{
Flex
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
TokenTransfer
as
TTokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
TokenTransfer
from
'
ui/tx/TokenTransfer
'
;
interface
Props
{
items
:
Array
<
TTokenTransfer
>
;
}
function
getItemsNum
(
items
:
Array
<
TTokenTransfer
>
)
{
const
nonErc1155items
=
items
.
filter
((
item
)
=>
item
.
token_type
!==
'
ERC-1155
'
).
length
;
const
erc1155items
=
items
.
filter
((
item
)
=>
item
.
token_type
===
'
ERC-1155
'
)
.
map
((
item
)
=>
{
if
(
Array
.
isArray
(
item
.
total
))
{
return
item
.
total
.
length
;
}
return
1
;
})
.
reduce
((
sum
,
item
)
=>
sum
+
item
,
0
);
return
nonErc1155items
+
erc1155items
;
}
const
TokenTransferList
=
({
items
}:
Props
)
=>
{
const
itemsNum
=
getItemsNum
(
items
);
const
hasScroll
=
itemsNum
>
5
;
const
gradientStartColor
=
useColorModeValue
(
'
whiteAlpha.600
'
,
'
blackAlpha.600
'
);
const
gradientEndColor
=
useColorModeValue
(
'
whiteAlpha.900
'
,
'
blackAlpha.900
'
);
return
(
<
Flex
flexDirection=
"column"
alignItems=
"flex-start"
rowGap=
{
5
}
w=
"100%"
_after=
{
hasScroll
?
{
position
:
'
absolute
'
,
content
:
'
""
'
,
bottom
:
0
,
left
:
0
,
right
:
'
20px
'
,
height
:
'
48px
'
,
bgGradient
:
`linear(to-b, ${ gradientStartColor } 37.5%, ${ gradientEndColor } 77.5%)`
,
}
:
undefined
}
maxH=
{
hasScroll
?
'
200px
'
:
'
auto
'
}
overflowY=
{
hasScroll
?
'
scroll
'
:
'
auto
'
}
pr=
{
hasScroll
?
5
:
0
}
pb=
{
hasScroll
?
10
:
0
}
>
{
items
.
map
((
item
,
index
)
=>
<
TokenTransfer
key=
{
index
}
{
...
item
}
/>)
}
</
Flex
>
);
};
export
default
React
.
memo
(
TokenTransferList
);
ui/tx/TxDetails.tsx
View file @
553aad0e
import
{
Grid
,
GridItem
,
Text
,
Box
,
Icon
,
Link
,
Flex
,
Spinner
}
from
'
@chakra-ui/react
'
;
import
{
Grid
,
GridItem
,
Text
,
Box
,
Icon
,
Link
,
Spinner
}
from
'
@chakra-ui/react
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
appConfig
from
'
configs/app/config
'
;
...
...
@@ -32,7 +32,7 @@ import TxStatus from 'ui/shared/TxStatus';
import
Utilization
from
'
ui/shared/Utilization
'
;
import
TxDetailsSkeleton
from
'
ui/tx/details/TxDetailsSkeleton
'
;
import
TxRevertReason
from
'
ui/tx/details/TxRevertReason
'
;
import
TokenTransfer
from
'
ui/tx/TokenTransfer
'
;
import
TokenTransfer
List
from
'
ui/tx/TokenTransferList
'
;
import
TxDecodedInputData
from
'
ui/tx/TxDecodedInputData
'
;
const
TOKEN_TRANSFERS
=
[
...
...
@@ -171,10 +171,9 @@ const TxDetails = () => {
key=
{
type
}
title=
{
title
}
hint=
{
hint
}
position=
"relative"
>
<
Flex
flexDirection=
"column"
alignItems=
"flex-start"
rowGap=
{
5
}
w=
"100%"
>
{
items
.
map
((
item
,
index
)
=>
<
TokenTransfer
key=
{
index
}
{
...
item
}
/>)
}
</
Flex
>
<
TokenTransferList
items=
{
items
}
/>
</
DetailsInfoItem
>
);
})
}
...
...
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