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
359ce166
Commit
359ce166
authored
Feb 19, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token transfers page
parent
695a0322
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
53 deletions
+55
-53
token-transfers.tsx
pages/token-transfers.tsx
+2
-2
TokenTransfers.tsx
ui/pages/TokenTransfers.tsx
+10
-8
AddressEntity.tsx
ui/shared/entities/address/AddressEntity.tsx
+1
-1
NftEntity.tsx
ui/shared/entities/nft/NftEntity.tsx
+3
-3
TokenTransfersListItem.tsx
ui/tokenTransfers/TokenTransfersListItem.tsx
+4
-4
TokenTransfersTable.tsx
ui/tokenTransfers/TokenTransfersTable.tsx
+15
-16
TokenTransfersTableItem.tsx
ui/tokenTransfers/TokenTransfersTableItem.tsx
+20
-19
No files found.
pages/token-transfers.tsx
View file @
359ce166
...
@@ -4,12 +4,12 @@ import React from 'react';
...
@@ -4,12 +4,12 @@ import React from 'react';
import
PageNextJs
from
'
nextjs/PageNextJs
'
;
import
PageNextJs
from
'
nextjs/PageNextJs
'
;
//
const TokenTransfers = dynamic(() => import('ui/pages/TokenTransfers'), { ssr: false });
const
TokenTransfers
=
dynamic
(()
=>
import
(
'
ui/pages/TokenTransfers
'
),
{
ssr
:
false
});
const
Page
:
NextPage
=
()
=>
{
const
Page
:
NextPage
=
()
=>
{
return
(
return
(
<
PageNextJs
pathname=
"/token-transfers"
>
<
PageNextJs
pathname=
"/token-transfers"
>
{
/* <TokenTransfers/> */
}
<
TokenTransfers
/>
</
PageNextJs
>
</
PageNextJs
>
);
);
};
};
...
...
ui/pages/TokenTransfers.tsx
View file @
359ce166
import
{
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -15,6 +15,7 @@ import useQueryWithPages from 'ui/shared/pagination/useQueryWithPages';
...
@@ -15,6 +15,7 @@ import useQueryWithPages from 'ui/shared/pagination/useQueryWithPages';
import
{
getTokenFilterValue
}
from
'
ui/tokens/utils
'
;
import
{
getTokenFilterValue
}
from
'
ui/tokens/utils
'
;
import
TokenTransfersListItem
from
'
ui/tokenTransfers/TokenTransfersListItem
'
;
import
TokenTransfersListItem
from
'
ui/tokenTransfers/TokenTransfersListItem
'
;
import
TokenTransfersTable
from
'
ui/tokenTransfers/TokenTransfersTable
'
;
import
TokenTransfersTable
from
'
ui/tokenTransfers/TokenTransfersTable
'
;
const
TokenTransfers
=
()
=>
{
const
TokenTransfers
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
[
typeFilter
,
setTypeFilter
]
=
React
.
useState
<
Array
<
TokenType
>>
(
getTokenFilterValue
(
router
.
query
.
type
)
||
[]);
const
[
typeFilter
,
setTypeFilter
]
=
React
.
useState
<
Array
<
TokenType
>>
(
getTokenFilterValue
(
router
.
query
.
type
)
||
[]);
...
@@ -34,7 +35,7 @@ const TokenTransfers = () => {
...
@@ -34,7 +35,7 @@ const TokenTransfers = () => {
const
content
=
(
const
content
=
(
<>
<>
<
Show
below=
"lg"
ssr=
{
false
}
>
<
Box
hideFrom=
"lg"
>
{
tokenTransfersQuery
.
data
?.
items
.
map
((
item
,
index
)
=>
(
{
tokenTransfersQuery
.
data
?.
items
.
map
((
item
,
index
)
=>
(
<
TokenTransfersListItem
<
TokenTransfersListItem
key=
{
item
.
transaction_hash
+
item
.
log_index
+
(
tokenTransfersQuery
.
isPlaceholderData
?
index
:
''
)
}
key=
{
item
.
transaction_hash
+
item
.
log_index
+
(
tokenTransfersQuery
.
isPlaceholderData
?
index
:
''
)
}
...
@@ -42,14 +43,14 @@ const TokenTransfers = () => {
...
@@ -42,14 +43,14 @@ const TokenTransfers = () => {
item=
{
item
}
item=
{
item
}
/>
/>
))
}
))
}
</
Show
>
</
Box
>
<
Hide
below=
"lg"
ssr=
{
false
}
>
<
Box
hideBelow=
"lg"
>
<
TokenTransfersTable
<
TokenTransfersTable
items=
{
tokenTransfersQuery
.
data
?.
items
}
items=
{
tokenTransfersQuery
.
data
?.
items
}
top=
{
tokenTransfersQuery
.
pagination
.
isVisible
?
ACTION_BAR_HEIGHT_DESKTOP
:
0
}
top=
{
tokenTransfersQuery
.
pagination
.
isVisible
?
ACTION_BAR_HEIGHT_DESKTOP
:
0
}
isLoading=
{
tokenTransfersQuery
.
isPlaceholderData
}
isLoading=
{
tokenTransfersQuery
.
isPlaceholderData
}
/>
/>
</
Hide
>
</
Box
>
</>
</>
);
);
...
@@ -74,11 +75,12 @@ const TokenTransfers = () => {
...
@@ -74,11 +75,12 @@ const TokenTransfers = () => {
/>
/>
<
DataListDisplay
<
DataListDisplay
isError=
{
tokenTransfersQuery
.
isError
}
isError=
{
tokenTransfersQuery
.
isError
}
items
=
{
tokenTransfersQuery
.
data
?.
items
}
items
Num=
{
tokenTransfersQuery
.
data
?.
items
.
length
}
emptyText=
"There are no token transfers."
emptyText=
"There are no token transfers."
content=
{
content
}
actionBar=
{
actionBar
}
actionBar=
{
actionBar
}
/>
>
{
content
}
</
DataListDisplay
>
</>
</>
);
);
};
};
...
...
ui/shared/entities/address/AddressEntity.tsx
View file @
359ce166
...
@@ -90,7 +90,7 @@ const Icon = (props: IconProps) => {
...
@@ -90,7 +90,7 @@ const Icon = (props: IconProps) => {
})();
})();
return
(
return
(
<
Tooltip
label
=
{
label
}
>
<
Tooltip
content
=
{
label
}
>
<
Flex
marginRight=
{
styles
.
marginRight
}
position=
"relative"
>
<
Flex
marginRight=
{
styles
.
marginRight
}
position=
"relative"
>
<
AddressIdenticon
<
AddressIdenticon
size=
{
props
.
size
===
'
lg
'
?
30
:
20
}
size=
{
props
.
size
===
'
lg
'
?
30
:
20
}
...
...
ui/shared/entities/nft/NftEntity.tsx
View file @
359ce166
...
@@ -58,12 +58,12 @@ export interface EntityProps extends EntityBase.EntityBaseProps {
...
@@ -58,12 +58,12 @@ export interface EntityProps extends EntityBase.EntityBaseProps {
const
NftEntity
=
(
props
:
EntityProps
)
=>
{
const
NftEntity
=
(
props
:
EntityProps
)
=>
{
const
partsProps
=
distributeEntityProps
(
props
);
const
partsProps
=
distributeEntityProps
(
props
);
const
content
=
<
Content
{
...
partsProps
.
content
}
/>;
return
(
return
(
<
Container
w=
"100%"
{
...
partsProps
.
container
}
>
<
Container
w=
"100%"
{
...
partsProps
.
container
}
>
<
Icon
{
...
partsProps
.
icon
}
/>
<
Icon
{
...
partsProps
.
icon
}
/>
<
Link
{
...
partsProps
.
link
}
>
{
props
.
noLink
?
content
:
<
Link
{
...
partsProps
.
link
}
>
{
content
}
</
Link
>
}
<
Content
{
...
partsProps
.
content
}
/>
</
Link
>
</
Container
>
</
Container
>
);
);
};
};
...
...
ui/tokenTransfers/TokenTransfersListItem.tsx
View file @
359ce166
...
@@ -5,8 +5,8 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
...
@@ -5,8 +5,8 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
{
NFT_TOKEN_TYPE_IDS
}
from
'
lib/token/tokenTypes
'
;
import
{
NFT_TOKEN_TYPE_IDS
}
from
'
lib/token/tokenTypes
'
;
import
Skeleton
from
'
ui/shared/chakra/Skeleton
'
;
import
{
Badge
}
from
'
toolkit/chakra/badge
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
{
Skeleton
}
from
'
toolkit/chakra/skeleton
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
...
@@ -49,7 +49,7 @@ const TokenTransfersListItem = ({ item, isLoading }: Props) => {
...
@@ -49,7 +49,7 @@ const TokenTransfersListItem = ({ item, isLoading }: Props) => {
{
item
.
method
&&
(
{
item
.
method
&&
(
<>
<>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Method
</
ListItemMobileGrid
.
Label
><
ListItemMobileGrid
.
Value
>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Method
</
ListItemMobileGrid
.
Label
><
ListItemMobileGrid
.
Value
>
<
Tag
isLoading=
{
isLoading
}
>
{
item
.
method
}
</
Tag
>
<
Badge
loading=
{
isLoading
}
>
{
item
.
method
}
</
Badge
>
</
ListItemMobileGrid
.
Value
>
</
ListItemMobileGrid
.
Value
>
</>
</>
)
}
)
}
...
@@ -88,7 +88,7 @@ const TokenTransfersListItem = ({ item, isLoading }: Props) => {
...
@@ -88,7 +88,7 @@ const TokenTransfersListItem = ({ item, isLoading }: Props) => {
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Amount
</
ListItemMobileGrid
.
Label
>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Amount
</
ListItemMobileGrid
.
Label
>
<
ListItemMobileGrid
.
Value
>
<
ListItemMobileGrid
.
Value
>
<
Flex
gap=
{
2
}
overflow=
"hidden"
>
<
Flex
gap=
{
2
}
overflow=
"hidden"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
wordBreak=
"break-all"
>
<
Skeleton
loading=
{
isLoading
}
wordBreak=
"break-all"
>
{
valueStr
}
{
valueStr
}
</
Skeleton
>
</
Skeleton
>
<
TokenEntity
<
TokenEntity
...
...
ui/tokenTransfers/TokenTransfersTable.tsx
View file @
359ce166
import
{
Table
,
Tbody
,
Tr
,
Th
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
type
{
TokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
{
AddressHighlightProvider
}
from
'
lib/contexts/addressHighlight
'
;
import
{
AddressHighlightProvider
}
from
'
lib/contexts/addressHighlight
'
;
import
{
default
as
Thead
}
from
'
ui/shared/TheadSticky
'
;
import
{
TableBody
,
TableColumnHeader
,
TableHeaderSticky
,
TableRoot
,
TableRow
}
from
'
toolkit/chakra/table
'
;
import
TokenTransferTableItem
from
'
ui/tokenTransfers/TokenTransfersTableItem
'
;
import
TokenTransferTableItem
from
'
ui/tokenTransfers/TokenTransfersTableItem
'
;
interface
Props
{
interface
Props
{
...
@@ -16,18 +15,18 @@ interface Props {
...
@@ -16,18 +15,18 @@ interface Props {
const
TokenTransferTable
=
({
items
,
top
,
isLoading
}:
Props
)
=>
{
const
TokenTransferTable
=
({
items
,
top
,
isLoading
}:
Props
)
=>
{
return
(
return
(
<
AddressHighlightProvider
>
<
AddressHighlightProvider
>
<
Table
variant=
"simple"
size=
"sm"
minW=
"950px"
style=
{
{
tableLayout
:
'
auto
'
}
}
>
<
Table
Root
minW=
"950px"
tableLayout=
"auto"
>
<
T
head
top=
{
top
}
>
<
T
ableHeaderSticky
top=
{
top
}
>
<
T
r
>
<
T
ableRow
>
<
T
h
>
Txn hash
</
Th
>
<
T
ableColumnHeader
>
Txn hash
</
TableColumnHeader
>
<
T
h
>
Method
</
Th
>
<
T
ableColumnHeader
>
Method
</
TableColumnHeader
>
<
T
h
>
Block
</
Th
>
<
T
ableColumnHeader
>
Block
</
TableColumnHeader
>
<
T
h
>
From/To
</
Th
>
<
T
ableColumnHeader
>
From/To
</
TableColumnHeader
>
<
T
h
>
Token ID
</
Th
>
<
T
ableColumnHeader
>
Token ID
</
TableColumnHeader
>
<
T
h
isNumeric
>
Amount
</
Th
>
<
T
ableColumnHeader
isNumeric
>
Amount
</
TableColumnHeader
>
</
T
r
>
</
T
ableRow
>
</
T
head
>
</
T
ableHeaderSticky
>
<
T
b
ody
>
<
T
ableB
ody
>
{
items
?.
map
((
item
,
index
)
=>
(
{
items
?.
map
((
item
,
index
)
=>
(
<
TokenTransferTableItem
<
TokenTransferTableItem
key=
{
item
.
transaction_hash
+
item
.
log_index
+
(
isLoading
?
index
:
''
)
}
key=
{
item
.
transaction_hash
+
item
.
log_index
+
(
isLoading
?
index
:
''
)
}
...
@@ -35,8 +34,8 @@ const TokenTransferTable = ({ items, top, isLoading }: Props) => {
...
@@ -35,8 +34,8 @@ const TokenTransferTable = ({ items, top, isLoading }: Props) => {
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
))
}
))
}
</
T
b
ody
>
</
T
ableB
ody
>
</
Table
>
</
Table
Root
>
</
AddressHighlightProvider
>
</
AddressHighlightProvider
>
);
);
};
};
...
...
ui/tokenTransfers/TokenTransfersTableItem.tsx
View file @
359ce166
import
{
Tr
,
Td
,
Flex
}
from
'
@chakra-ui/react
'
;
import
{
Flex
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
type
{
TokenTransfer
}
from
'
types/api/tokenTransfer
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
{
NFT_TOKEN_TYPE_IDS
}
from
'
lib/token/tokenTypes
'
;
import
{
NFT_TOKEN_TYPE_IDS
}
from
'
lib/token/tokenTypes
'
;
import
{
Badge
}
from
'
toolkit/chakra/badge
'
;
import
{
Skeleton
}
from
'
toolkit/chakra/skeleton
'
;
import
{
TableCell
,
TableRow
}
from
'
toolkit/chakra/table
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Skeleton
from
'
ui/shared/chakra/Skeleton
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
import
TokenEntity
from
'
ui/shared/entities/token/TokenEntity
'
;
import
TokenEntity
from
'
ui/shared/entities/token/TokenEntity
'
;
...
@@ -29,8 +30,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
...
@@ -29,8 +30,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
})
:
{
valueStr
:
null
};
})
:
{
valueStr
:
null
};
return
(
return
(
<
T
r
>
<
T
ableRow
>
<
T
d
>
<
T
ableCell
>
<
TxEntity
<
TxEntity
hash=
{
item
.
transaction_hash
}
hash=
{
item
.
transaction_hash
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
...
@@ -46,14 +47,14 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
...
@@ -46,14 +47,14 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
fontWeight=
"400"
fontWeight=
"400"
display=
"inline-block"
display=
"inline-block"
/>
/>
</
T
d
>
</
T
ableCell
>
<
T
d
maxW=
"120px"
>
<
T
ableCell
maxW=
"120px"
>
{
item
.
method
&&
<
Tag
isLoading=
{
isLoading
}
>
{
item
.
method
}
</
Tag
>
}
{
item
.
method
&&
<
Badge
loading=
{
isLoading
}
>
{
item
.
method
}
</
Badge
>
}
</
T
d
>
</
T
ableCell
>
<
T
d
>
<
T
ableCell
>
<
BlockEntity
number=
{
item
.
block_number
}
isLoading=
{
isLoading
}
noIcon
/>
<
BlockEntity
number=
{
item
.
block_number
}
isLoading=
{
isLoading
}
noIcon
/>
</
T
d
>
</
T
ableCell
>
<
T
d
>
<
T
ableCell
>
<
AddressFromTo
<
AddressFromTo
maxW=
{
{
lg
:
'
220px
'
,
xl
:
'
320px
'
}
}
maxW=
{
{
lg
:
'
220px
'
,
xl
:
'
320px
'
}
}
from=
{
item
.
from
}
from=
{
item
.
from
}
...
@@ -61,8 +62,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
...
@@ -61,8 +62,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
mode=
{
{
lg
:
'
compact
'
,
xl
:
'
long
'
}
}
mode=
{
{
lg
:
'
compact
'
,
xl
:
'
long
'
}
}
/>
/>
</
T
d
>
</
T
ableCell
>
<
T
d
>
<
T
ableCell
>
{
item
.
total
&&
'
token_id
'
in
item
.
total
&&
item
.
token
&&
(
NFT_TOKEN_TYPE_IDS
.
includes
(
item
.
token
.
type
))
&&
item
.
total
.
token_id
!==
null
?
(
{
item
.
total
&&
'
token_id
'
in
item
.
total
&&
item
.
token
&&
(
NFT_TOKEN_TYPE_IDS
.
includes
(
item
.
token
.
type
))
&&
item
.
total
.
token_id
!==
null
?
(
<
NftEntity
<
NftEntity
hash=
{
item
.
token
.
address
}
hash=
{
item
.
token
.
address
}
...
@@ -71,11 +72,11 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
...
@@ -71,11 +72,11 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
maxW=
"140px"
maxW=
"140px"
/>
/>
)
:
'
-
'
}
)
:
'
-
'
}
</
T
d
>
</
T
ableCell
>
<
T
d
isNumeric
verticalAlign=
"top"
>
<
T
ableCell
isNumeric
verticalAlign=
"top"
>
{
(
item
.
token
&&
valueStr
)
?
(
{
(
item
.
token
&&
valueStr
)
?
(
<
Flex
gap=
{
2
}
overflow=
"hidden"
justifyContent=
"flex-end"
>
<
Flex
gap=
{
2
}
overflow=
"hidden"
justifyContent=
"flex-end"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
wordBreak=
"break-all"
>
<
Skeleton
loading=
{
isLoading
}
wordBreak=
"break-all"
>
{
valueStr
}
{
valueStr
}
</
Skeleton
>
</
Skeleton
>
<
TokenEntity
<
TokenEntity
...
@@ -90,8 +91,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
...
@@ -90,8 +91,8 @@ const TokenTransferTableItem = ({ item, isLoading }: Props) => {
</
Flex
>
</
Flex
>
)
:
'
-
'
)
:
'
-
'
}
}
</
T
d
>
</
T
ableCell
>
</
T
r
>
</
T
ableRow
>
);
);
};
};
...
...
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