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
9e92c0da
Commit
9e92c0da
authored
Jan 03, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make use of new component
parent
a5fc1a11
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
151 additions
and
394 deletions
+151
-394
AddressIntTxsListItem.tsx
ui/address/internals/AddressIntTxsListItem.tsx
+9
-29
AddressIntTxsTable.tsx
ui/address/internals/AddressIntTxsTable.tsx
+2
-4
AddressIntTxsTableItem.tsx
ui/address/internals/AddressIntTxsTableItem.tsx
+5
-30
LatestTxsItem.tsx
ui/home/LatestTxsItem.tsx
+8
-33
LatestTxsItemMobile.tsx
ui/home/LatestTxsItemMobile.tsx
+9
-27
InOutTag.tsx
ui/shared/InOutTag.tsx
+0
-34
AddressFromTo.tsx
ui/shared/address/AddressFromTo.tsx
+54
-25
TokenTransferListItem.tsx
ui/token/TokenTransfer/TokenTransferListItem.tsx
+9
-19
TokenTransferTable.tsx
ui/token/TokenTransfer/TokenTransferTable.tsx
+5
-7
TokenTransferTableItem.tsx
ui/token/TokenTransfer/TokenTransferTableItem.tsx
+6
-20
TxDetailsTokenTransfer.tsx
ui/tx/details/TxDetailsTokenTransfer.tsx
+8
-7
TxInternalsListItem.tsx
ui/tx/internals/TxInternalsListItem.tsx
+9
-18
TxInternalsTable.tsx
ui/tx/internals/TxInternalsTable.tsx
+1
-3
TxInternalsTableItem.tsx
ui/tx/internals/TxInternalsTableItem.tsx
+4
-15
TxsListItem.tsx
ui/txs/TxsListItem.tsx
+9
-40
TxsTable.tsx
ui/txs/TxsTable.tsx
+2
-9
TxsTableItem.tsx
ui/txs/TxsTableItem.tsx
+11
-74
No files found.
ui/address/internals/AddressIntTxsListItem.tsx
View file @
9e92c0da
import
{
Flex
,
Box
,
HStack
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
HStack
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
React
from
'
react
'
;
...
...
@@ -6,12 +6,10 @@ import type { InternalTransaction } from 'types/api/internalTransaction';
import
config
from
'
configs/app
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
InOutTag
from
'
ui/shared/InOutTag
'
;
import
ListItemMobile
from
'
ui/shared/ListItemMobile/ListItemMobile
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
...
...
@@ -35,9 +33,6 @@ const TxInternalsListItem = ({
const
typeTitle
=
TX_INTERNALS_ITEMS
.
find
(({
id
})
=>
id
===
type
)?.
title
;
const
toData
=
to
?
to
:
createdContract
;
const
isOut
=
Boolean
(
currentAddress
&&
currentAddress
===
from
.
hash
);
const
isIn
=
Boolean
(
currentAddress
&&
currentAddress
===
toData
?.
hash
);
return
(
<
ListItemMobile
rowGap=
{
3
}
>
<
Flex
columnGap=
{
2
}
>
...
...
@@ -65,28 +60,13 @@ const TxInternalsListItem = ({
lineHeight=
{
5
}
/>
</
HStack
>
<
Box
w=
"100%"
display=
"flex"
columnGap=
{
3
}
>
<
AddressEntity
address=
{
from
}
isLoading=
{
isLoading
}
noLink=
{
isOut
}
noCopy=
{
isOut
}
width=
"calc((100% - 48px) / 2)"
/>
{
(
isIn
||
isOut
)
?
<
InOutTag
isIn=
{
isIn
}
isOut=
{
isOut
}
isLoading=
{
isLoading
}
/>
:
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
/>
}
{
toData
&&
(
<
AddressEntity
address=
{
toData
}
isLoading=
{
isLoading
}
noLink=
{
isIn
}
noCopy=
{
isIn
}
width=
"calc((100% - 48px) / 2)"
/>
)
}
</
Box
>
<
AddressFromTo
from=
{
from
}
to=
{
toData
}
current=
{
currentAddress
}
isLoading=
{
isLoading
}
w=
"100%"
/>
<
HStack
spacing=
{
3
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
"sm"
fontWeight=
{
500
}
>
Value
{
config
.
chain
.
currency
.
symbol
}
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
"sm"
color=
"text_secondary"
minW=
{
6
}
>
...
...
ui/address/internals/AddressIntTxsTable.tsx
View file @
9e92c0da
...
...
@@ -24,11 +24,9 @@ const AddressIntTxsTable = ({ data, currentAddress, isLoading }: Props) => {
<
Th
width=
"15%"
>
Parent txn hash
</
Th
>
<
Th
width=
"15%"
>
Type
</
Th
>
<
Th
width=
"10%"
>
Block
</
Th
>
<
Th
width=
"20%"
>
From
</
Th
>
<
Th
width=
"48px"
px=
{
0
}
/>
<
Th
width=
"20%"
>
To
</
Th
>
<
Th
width=
"40%"
>
From/To
</
Th
>
<
Th
width=
"20%"
isNumeric
>
Value
{
config
.
chain
.
currency
.
symbol
}
Value
{
config
.
chain
.
currency
.
symbol
}
</
Th
>
</
Tr
>
</
Thead
>
...
...
ui/address/internals/AddressIntTxsTableItem.tsx
View file @
9e92c0da
...
...
@@ -6,12 +6,10 @@ import type { InternalTransaction } from 'types/api/internalTransaction';
import
config
from
'
configs/app
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
InOutTag
from
'
ui/shared/InOutTag
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
...
...
@@ -34,9 +32,6 @@ const AddressIntTxsTableItem = ({
const
typeTitle
=
TX_INTERNALS_ITEMS
.
find
(({
id
})
=>
id
===
type
)?.
title
;
const
toData
=
to
?
to
:
createdContract
;
const
isOut
=
Boolean
(
currentAddress
&&
currentAddress
===
from
.
hash
);
const
isIn
=
Boolean
(
currentAddress
&&
currentAddress
===
toData
?.
hash
);
const
timeAgo
=
useTimeAgoIncrement
(
timestamp
,
true
);
return
(
...
...
@@ -77,33 +72,13 @@ const AddressIntTxsTableItem = ({
/>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
AddressEntity
address=
{
from
}
<
AddressFromTo
from=
{
from
}
to=
{
toData
}
current=
{
currentAddress
}
isLoading=
{
isLoading
}
noLink=
{
isOut
}
noCopy=
{
isOut
}
w=
"min-content"
maxW=
"100%"
/>
</
Td
>
<
Td
px=
{
0
}
verticalAlign=
"middle"
>
{
(
isIn
||
isOut
)
?
<
InOutTag
isIn=
{
isIn
}
isOut=
{
isOut
}
isLoading=
{
isLoading
}
w=
"100%"
/>
:
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
/>
}
</
Td
>
<
Td
verticalAlign=
"middle"
>
{
toData
&&
(
<
AddressEntity
address=
{
toData
}
isLoading=
{
isLoading
}
noLink=
{
isIn
}
noCopy=
{
isIn
}
w=
"min-content"
maxW=
"100%"
/>
)
}
</
Td
>
<
Td
isNumeric
verticalAlign=
"middle"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
minW=
{
6
}
>
{
BigNumber
(
value
).
div
(
BigNumber
(
10
**
config
.
chain
.
currency
.
decimals
)).
toFormat
()
}
...
...
ui/home/LatestTxsItem.tsx
View file @
9e92c0da
...
...
@@ -13,9 +13,8 @@ import type { Transaction } from 'types/api/transaction';
import
config
from
'
configs/app
'
;
import
getValueWithUnit
from
'
lib/getValueWithUnit
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
Address
Entity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
Address
FromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
TxFeeStability
from
'
ui/shared/tx/TxFeeStability
'
;
import
TxWatchListTags
from
'
ui/shared/tx/TxWatchListTags
'
;
...
...
@@ -35,7 +34,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
return
(
<
Grid
gridTemplateColumns=
{
{
lg
:
columnNum
===
2
?
'
3fr minmax(auto, 1
60px)
'
:
'
3fr minmax(auto, 16
0px) 150px
'
,
lg
:
columnNum
===
2
?
'
3fr minmax(auto, 1
80px)
'
:
'
3fr minmax(auto, 18
0px) 150px
'
,
xl
:
columnNum
===
2
?
'
3fr minmax(auto, 250px)
'
:
'
3fr minmax(auto, 275px) 150px
'
,
}
}
gridGap=
{
8
}
...
...
@@ -80,36 +79,12 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
</
Flex
>
</
Box
>
</
Flex
>
<
Flex
alignItems=
"center"
alignSelf=
"flex-start"
>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
transform=
"rotate(90deg)"
isLoading=
{
isLoading
}
flexShrink=
{
0
}
/>
<
Flex
ml=
{
1
}
maxW=
"calc(100% - 24px)"
flexDir=
"column"
rowGap=
"1px"
>
<
AddressEntity
isLoading=
{
isLoading
}
address=
{
tx
.
from
}
fontSize=
"sm"
lineHeight=
{
5
}
my=
"5px"
fontWeight=
"500"
/>
{
dataTo
&&
(
<
AddressEntity
isLoading=
{
isLoading
}
address=
{
dataTo
}
fontSize=
"sm"
lineHeight=
{
5
}
my=
"5px"
fontWeight=
"500"
/>
)
}
</
Flex
>
</
Flex
>
<
AddressFromTo
from=
{
tx
.
from
}
to=
{
dataTo
}
isLoading=
{
isLoading
}
mode=
"compact"
/>
<
Flex
flexDir=
"column"
>
{
!
config
.
UI
.
views
.
tx
.
hiddenFields
?.
value
&&
(
<
Skeleton
isLoaded=
{
!
isLoading
}
my=
"3px"
>
...
...
ui/home/LatestTxsItemMobile.tsx
View file @
9e92c0da
...
...
@@ -12,9 +12,8 @@ import type { Transaction } from 'types/api/transaction';
import
config
from
'
configs/app
'
;
import
getValueWithUnit
from
'
lib/getValueWithUnit
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
Address
Entity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
Address
FromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
TxFeeStability
from
'
ui/shared/tx/TxFeeStability
'
;
import
TxWatchListTags
from
'
ui/shared/tx/TxWatchListTags
'
;
...
...
@@ -66,31 +65,14 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
</
Skeleton
>
)
}
</
Flex
>
<
Flex
alignItems=
"center"
mb=
{
3
}
>
<
AddressEntity
isLoading=
{
isLoading
}
address=
{
tx
.
from
}
truncation=
"constant"
fontSize=
"sm"
fontWeight=
"500"
mr=
{
2
}
/>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
/>
{
dataTo
&&
(
<
AddressEntity
isLoading=
{
isLoading
}
address=
{
dataTo
}
truncation=
"constant"
fontSize=
"sm"
fontWeight=
"500"
/>
)
}
</
Flex
>
<
AddressFromTo
from=
{
tx
.
from
}
to=
{
dataTo
}
isLoading=
{
isLoading
}
fontSize=
"sm"
fontWeight=
"500"
mb=
{
3
}
/>
{
!
config
.
UI
.
views
.
tx
.
hiddenFields
?.
value
&&
(
<
Skeleton
isLoaded=
{
!
isLoading
}
mb=
{
2
}
fontSize=
"sm"
w=
"fit-content"
>
<
Text
as=
"span"
>
Value
{
config
.
chain
.
currency
.
symbol
}
</
Text
>
...
...
ui/shared/InOutTag.tsx
deleted
100644 → 0
View file @
a5fc1a11
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
interface
Props
{
isIn
:
boolean
;
isOut
:
boolean
;
className
?:
string
;
isLoading
?:
boolean
;
}
// TODO @tom2drum remove this component
const
InOutTag
=
({
isIn
,
isOut
,
className
,
isLoading
}:
Props
)
=>
{
if
(
!
isIn
&&
!
isOut
)
{
return
null
;
}
const
colorScheme
=
isOut
?
'
orange
'
:
'
green
'
;
return
(
<
Tag
className=
{
className
}
colorScheme=
{
colorScheme
}
display=
"flex"
justifyContent=
"center"
isLoading=
{
isLoading
}
>
{
isOut
?
'
OUT
'
:
'
IN
'
}
</
Tag
>
);
};
export
default
React
.
memo
(
chakra
(
InOutTag
));
ui/shared/address/AddressFromTo.tsx
View file @
9e92c0da
...
...
@@ -4,27 +4,37 @@ import React from 'react';
import
type
{
AddressParam
}
from
'
types/api/addressParams
'
;
import
type
{
EntityProps
}
from
'
ui/shared/entities/address/AddressEntity
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
AddressEntityWithTokenFilter
from
'
ui/shared/entities/address/AddressEntityWithTokenFilter
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
type
Mode
=
'
compact
'
|
'
long
'
;
interface
Props
{
from
:
AddressParam
;
to
:
AddressParam
;
to
:
AddressParam
|
null
;
current
?:
string
;
mode
?:
Mode
|
Partial
<
Record
<
ThemeTypings
[
'
breakpoints
'
],
Mode
>>
;
className
?:
string
;
isLoading
?:
boolean
;
tokenHash
?:
string
;
truncation
?:
EntityProps
[
'
truncation
'
];
noIcon
?:
boolean
;
}
const
AddressFromTo
=
({
from
,
to
,
current
,
mode
:
modeProp
,
className
,
isLoading
}:
Props
)
=>
{
const
AddressFromTo
=
({
from
,
to
,
current
,
mode
:
modeProp
,
className
,
isLoading
,
tokenHash
=
''
,
truncation
,
noIcon
}:
Props
)
=>
{
const
iconColor
=
useColorModeValue
(
'
gray.500
'
,
'
gray.300
'
);
const
mode
=
useBreakpointValue
({
base
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
base
:
modeProp
),
lg
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
lg
:
modeProp
),
xl
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
xl
:
modeProp
),
})
??
'
long
'
;
const
mode
=
useBreakpointValue
(
{
base
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
base
:
modeProp
),
lg
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
lg
:
modeProp
),
xl
:
(
typeof
modeProp
===
'
object
'
?
modeProp
.
xl
:
modeProp
),
},
{
ssr
:
false
},
)
??
'
long
'
;
const
Entity
=
tokenHash
?
AddressEntityWithTokenFilter
:
AddressEntity
;
if
(
mode
===
'
compact
'
)
{
return
(
...
...
@@ -32,48 +42,67 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<
Flex
alignItems=
"center"
columnGap=
{
2
}
>
<
IconSvg
name=
"arrows/east"
isLoading=
{
isLoading
}
color=
{
iconColor
}
boxSize=
{
5
}
flexShrink=
{
0
}
transform=
"rotate(90deg)"
/>
<
Address
Entity
<
Entity
address=
{
from
}
isLoading=
{
isLoading
}
noLink=
{
current
===
from
.
hash
}
noCopy=
{
current
===
from
.
hash
}
noIcon=
{
noIcon
}
tokenHash=
{
tokenHash
}
truncation=
{
truncation
}
maxW=
"calc(100% - 28px)"
w=
"min-content"
/>
</
Flex
>
<
AddressEntity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
current
===
to
.
hash
}
noCopy=
{
current
===
to
.
hash
}
maxW=
"calc(100% - 28px)"
ml=
"28px"
/>
{
to
?
(
<
Entity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
current
===
to
.
hash
}
noCopy=
{
current
===
to
.
hash
}
noIcon=
{
noIcon
}
tokenHash=
{
tokenHash
}
truncation=
{
truncation
}
maxW=
"calc(100% - 28px)"
w=
"min-content"
ml=
"28px"
/>
)
:
<
span
>
-
</
span
>
}
</
Flex
>
);
}
return
(
<
Flex
className=
{
className
}
alignItems=
"center"
columnGap=
{
2
}
>
<
Address
Entity
<
Entity
address=
{
from
}
isLoading=
{
isLoading
}
noLink=
{
current
===
from
.
hash
}
noCopy=
{
current
===
from
.
hash
}
noIcon=
{
noIcon
}
tokenHash=
{
tokenHash
}
truncation=
{
truncation
}
maxW=
"calc(50% - 18px)"
/>
<
IconSvg
name=
"arrows/east"
color=
{
iconColor
}
boxSize=
{
5
}
flexShrink=
{
0
}
/>
<
AddressEntity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
current
===
to
.
hash
}
noCopy=
{
current
===
to
.
hash
}
maxW=
"calc(50% - 18px)"
/>
<
IconSvg
name=
"arrows/east"
color=
{
iconColor
}
boxSize=
{
5
}
flexShrink=
{
0
}
isLoading=
{
isLoading
}
/>
{
to
?
(
<
Entity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
current
===
to
.
hash
}
noCopy=
{
current
===
to
.
hash
}
noIcon=
{
noIcon
}
tokenHash=
{
tokenHash
}
truncation=
{
truncation
}
maxW=
"calc(50% - 18px)"
/>
)
:
<
span
>
-
</
span
>
}
</
Flex
>
);
};
...
...
ui/token/TokenTransfer/TokenTransferListItem.tsx
View file @
9e92c0da
...
...
@@ -5,11 +5,10 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntityWithTokenFilter
from
'
ui/shared/entities/address/AddressEntityWithTokenFilter
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
ListItemMobile
from
'
ui/shared/ListItemMobile/ListItemMobile
'
;
import
TruncatedValue
from
'
ui/shared/TruncatedValue
'
;
...
...
@@ -53,23 +52,14 @@ const TokenTransferListItem = ({
)
}
</
Flex
>
{
method
&&
<
Tag
isLoading=
{
isLoading
}
>
{
method
}
</
Tag
>
}
<
Flex
w=
"100%"
columnGap=
{
3
}
>
<
AddressEntityWithTokenFilter
address=
{
from
}
isLoading=
{
isLoading
}
tokenHash=
{
token
.
address
}
width=
"50%"
fontWeight=
"500"
/>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
flexShrink=
{
0
}
isLoading=
{
isLoading
}
/>
<
AddressEntityWithTokenFilter
address=
{
to
}
isLoading=
{
isLoading
}
tokenHash=
{
token
.
address
}
width=
"50%"
fontWeight=
"500"
/>
</
Flex
>
<
AddressFromTo
from=
{
from
}
to=
{
to
}
isLoading=
{
isLoading
}
tokenHash=
{
token
.
address
}
w=
"100%"
fontWeight=
"500"
/>
{
valueStr
&&
(
token
.
type
===
'
ERC-20
'
||
token
.
type
===
'
ERC-1155
'
)
&&
(
<
Grid
gap=
{
2
}
templateColumns=
{
`1fr auto auto${ usd ? ' auto' : '' }`
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
flexShrink=
{
0
}
fontWeight=
{
500
}
>
...
...
ui/token/TokenTransfer/TokenTransferTable.tsx
View file @
9e92c0da
...
...
@@ -26,17 +26,15 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket
return
(
<
AddressHighlightProvider
>
<
Table
variant=
"simple"
size=
"sm"
minW=
"950px"
>
<
Table
variant=
"simple"
size=
"sm"
>
<
Thead
top=
{
top
}
>
<
Tr
>
<
Th
width=
{
tokenType
===
'
ERC-1155
'
?
'
60%
'
:
'
80
%
'
}
>
Txn hash
</
Th
>
<
Th
width=
{
tokenType
===
'
ERC-1155
'
?
'
50%
'
:
'
75
%
'
}
>
Txn hash
</
Th
>
<
Th
width=
"164px"
>
Method
</
Th
>
<
Th
width=
"160px"
>
From
</
Th
>
<
Th
width=
"36px"
px=
{
0
}
/>
<
Th
width=
"218px"
>
To
</
Th
>
{
(
tokenType
===
'
ERC-721
'
||
tokenType
===
'
ERC-1155
'
)
&&
<
Th
width=
"20%"
isNumeric=
{
tokenType
===
'
ERC-721
'
}
>
Token ID
</
Th
>
}
<
Th
width=
{
{
lg
:
'
200px
'
,
xl
:
'
420px
'
}
}
>
From/To
</
Th
>
{
(
tokenType
===
'
ERC-721
'
||
tokenType
===
'
ERC-1155
'
)
&&
<
Th
width=
"25%"
isNumeric=
{
tokenType
===
'
ERC-721
'
}
>
Token ID
</
Th
>
}
{
(
tokenType
===
'
ERC-20
'
||
tokenType
===
'
ERC-1155
'
)
&&
(
<
Th
width=
"2
0
%"
isNumeric
>
<
Th
width=
"2
5
%"
isNumeric
>
<
TruncatedValue
value=
{
`Value ${ token?.symbol || '' }`
}
w=
"100%"
verticalAlign=
"middle"
/>
</
Th
>
)
}
...
...
ui/token/TokenTransfer/TokenTransferTableItem.tsx
View file @
9e92c0da
...
...
@@ -5,11 +5,10 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntityWithTokenFilter
from
'
ui/shared/entities/address/AddressEntityWithTokenFilter
'
;
import
NftEntity
from
'
ui/shared/entities/nft/NftEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
type
Props
=
TokenTransfer
&
{
tokenId
?:
string
;
isLoading
?:
boolean
}
...
...
@@ -60,26 +59,13 @@ const TokenTransferTableItem = ({
)
:
null
}
</
Td
>
<
Td
>
<
AddressEntityWithTokenFilter
address=
{
from
}
<
AddressFromTo
from=
{
from
}
to=
{
to
}
isLoading=
{
isLoading
}
truncation=
"constant"
mt=
"5px"
mode=
{
{
lg
:
'
compact
'
,
xl
:
'
long
'
}
}
tokenHash=
{
token
.
address
}
my=
"5px"
w=
"min-content"
/>
</
Td
>
<
Td
px=
{
0
}
>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
mt=
"3px"
isLoading=
{
isLoading
}
/>
</
Td
>
<
Td
>
<
AddressEntityWithTokenFilter
address=
{
to
}
isLoading=
{
isLoading
}
truncation=
"constant"
tokenHash=
{
token
.
address
}
my=
"5px"
w=
"min-content"
/>
</
Td
>
{
(
token
.
type
===
'
ERC-721
'
||
token
.
type
===
'
ERC-1155
'
)
&&
(
...
...
ui/tx/details/TxDetailsTokenTransfer.tsx
View file @
9e92c0da
...
...
@@ -4,9 +4,8 @@ import React from 'react';
import
type
{
TokenTransfer
as
TTokenTransfer
,
Erc20TotalPayload
,
Erc721TotalPayload
,
Erc1155TotalPayload
}
from
'
types/api/tokenTransfer
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
Address
Entity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
Address
FromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
TokenEntity
from
'
ui/shared/entities/token/TokenEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
NftTokenTransferSnippet
from
'
ui/tx/NftTokenTransferSnippet
'
;
interface
Props
{
...
...
@@ -75,11 +74,13 @@ const TxDetailsTokenTransfer = ({ data }: Props) => {
flexDir=
"row"
w=
"100%"
>
<
Flex
alignItems=
"center"
fontWeight=
"500"
>
<
AddressEntity
address=
{
data
.
from
}
truncation=
"constant"
noIcon
maxW=
"150px"
/>
<
IconSvg
name=
"arrows/east"
boxSize=
{
5
}
mx=
{
2
}
color=
"gray.500"
/>
<
AddressEntity
address=
{
data
.
to
}
truncation=
"constant"
noIcon
maxW=
"150px"
/>
</
Flex
>
<
AddressFromTo
from=
{
data
.
from
}
to=
{
data
.
to
}
truncation=
"constant"
noIcon
fontWeight=
"500"
/>
<
Flex
flexDir=
"column"
rowGap=
{
5
}
w=
"100%"
overflow=
"hidden"
fontWeight=
{
500
}
>
{
content
}
</
Flex
>
...
...
ui/tx/internals/TxInternalsListItem.tsx
View file @
9e92c0da
import
{
Flex
,
Box
,
HStack
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
HStack
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
React
from
'
react
'
;
import
type
{
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
import
config
from
'
configs/app
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
ListItemMobile
from
'
ui/shared/ListItemMobile/ListItemMobile
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
...
...
@@ -24,21 +23,13 @@ const TxInternalsListItem = ({ type, from, to, value, success, error, gas_limit:
{
typeTitle
&&
<
Tag
colorScheme=
"cyan"
isLoading=
{
isLoading
}
>
{
typeTitle
}
</
Tag
>
}
<
TxStatus
status=
{
success
?
'
ok
'
:
'
error
'
}
errorText=
{
error
}
isLoading=
{
isLoading
}
/>
</
Flex
>
<
Box
w=
"100%"
display=
"flex"
columnGap=
{
3
}
fontWeight=
"500"
>
<
AddressEntity
address=
{
from
}
isLoading=
{
isLoading
}
width=
"calc((100% - 48px) / 2)"
/>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
/>
{
toData
&&
(
<
AddressEntity
address=
{
toData
}
isLoading=
{
isLoading
}
width=
"calc((100% - 48px) / 2)"
/>
)
}
</
Box
>
<
AddressFromTo
from=
{
from
}
to=
{
toData
}
isLoading=
{
isLoading
}
w=
"100%"
fontWeight=
"500"
/>
<
HStack
spacing=
{
3
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
"sm"
fontWeight=
{
500
}
>
Value
{
config
.
chain
.
currency
.
symbol
}
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
"sm"
color=
"text_secondary"
>
...
...
ui/tx/internals/TxInternalsTable.tsx
View file @
9e92c0da
...
...
@@ -27,9 +27,7 @@ const TxInternalsTable = ({ data, sort, onSortToggle, top, isLoading }: Props) =
<
Thead
top=
{
top
}
>
<
Tr
>
<
Th
width=
"28%"
>
Type
</
Th
>
<
Th
width=
"20%"
>
From
</
Th
>
<
Th
width=
"24px"
px=
{
0
}
/>
<
Th
width=
"20%"
>
To
</
Th
>
<
Th
width=
"40%"
>
From/To
</
Th
>
<
Th
width=
"16%"
isNumeric
>
<
Link
display=
"flex"
alignItems=
"center"
justifyContent=
"flex-end"
onClick=
{
onSortToggle
(
'
value
'
)
}
columnGap=
{
1
}
>
{
sort
?.
includes
(
'
value
'
)
&&
<
IconSvg
name=
"arrows/east"
boxSize=
{
4
}
transform=
{
sortIconTransform
}
/>
}
...
...
ui/tx/internals/TxInternalsTableItem.tsx
View file @
9e92c0da
...
...
@@ -5,9 +5,8 @@ import React from 'react';
import
type
{
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
import
config
from
'
configs/app
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
...
...
@@ -32,22 +31,12 @@ const TxInternalTableItem = ({ type, from, to, value, success, error, gas_limit:
</
Flex
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
AddressEntity
address=
{
from
}
<
AddressFromTo
from=
{
from
}
to=
{
toData
}
isLoading=
{
isLoading
}
/>
</
Td
>
<
Td
px=
{
0
}
verticalAlign=
"middle"
>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
display=
"block"
/>
</
Td
>
<
Td
verticalAlign=
"middle"
>
{
toData
&&
(
<
AddressEntity
address=
{
toData
}
isLoading=
{
isLoading
}
/>
)
}
</
Td
>
<
Td
isNumeric
verticalAlign=
"middle"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
>
{
BigNumber
(
value
).
div
(
BigNumber
(
10
**
config
.
chain
.
currency
.
decimals
)).
toFormat
()
}
...
...
ui/txs/TxsListItem.tsx
View file @
9e92c0da
...
...
@@ -11,11 +11,9 @@ import config from 'configs/app';
import
getValueWithUnit
from
'
lib/getValueWithUnit
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
{
space
}
from
'
lib/html-entities
'
;
import
Address
Entity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
Address
FromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
InOutTag
from
'
ui/shared/InOutTag
'
;
import
ListItemMobile
from
'
ui/shared/ListItemMobile/ListItemMobile
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
TxFeeStability
from
'
ui/shared/tx/TxFeeStability
'
;
...
...
@@ -31,15 +29,9 @@ type Props = {
isLoading
?:
boolean
;
}
const
TAG_WIDTH
=
48
;
const
ARROW_WIDTH
=
24
;
const
TxsListItem
=
({
tx
,
isLoading
,
showBlockInfo
,
currentAddress
,
enableTimeIncrement
}:
Props
)
=>
{
const
dataTo
=
tx
.
to
?
tx
.
to
:
tx
.
created_contract
;
const
isOut
=
Boolean
(
currentAddress
&&
currentAddress
===
tx
.
from
.
hash
);
const
isIn
=
Boolean
(
currentAddress
&&
currentAddress
===
tx
.
to
?.
hash
);
const
timeAgo
=
useTimeAgoIncrement
(
tx
.
timestamp
,
enableTimeIncrement
);
return
(
...
...
@@ -89,37 +81,14 @@ const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeI
/>
</
Flex
>
)
}
<
Flex
alignItems=
"center"
height=
{
6
}
mt=
{
6
}
>
<
AddressEntity
address=
{
tx
.
from
}
isLoading=
{
isLoading
}
noLink=
{
isOut
}
noCopy=
{
isOut
}
w=
{
`calc((100% - ${ currentAddress ? TAG_WIDTH + 16 : ARROW_WIDTH + 8 }px)/2)`
}
fontWeight=
"500"
/>
{
(
isIn
||
isOut
)
?
<
InOutTag
isIn=
{
isIn
}
isOut=
{
isOut
}
width=
"48px"
mx=
{
2
}
isLoading=
{
isLoading
}
/>
:
(
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
mx=
{
2
}
flexShrink=
{
0
}
/>
)
}
{
dataTo
?
(
<
AddressEntity
address=
{
dataTo
}
isLoading=
{
isLoading
}
noLink=
{
isIn
}
noCopy=
{
isIn
}
w=
{
`calc((100% - ${ currentAddress ? TAG_WIDTH + 16 : ARROW_WIDTH + 8 }px)/2)`
}
fontWeight=
"500"
/>
)
:
'
-
'
}
</
Flex
>
<
AddressFromTo
from=
{
tx
.
from
}
to=
{
dataTo
}
current=
{
currentAddress
}
isLoading=
{
isLoading
}
mt=
{
6
}
fontWeight=
"500"
/>
{
!
config
.
UI
.
views
.
tx
.
hiddenFields
?.
value
&&
(
<
Flex
mt=
{
2
}
columnGap=
{
2
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
whiteSpace=
"pre"
>
Value
</
Skeleton
>
...
...
ui/txs/TxsTable.tsx
View file @
9e92c0da
import
{
Link
,
Table
,
Tbody
,
Tr
,
Th
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
{
Link
,
Table
,
Tbody
,
Tr
,
Th
}
from
'
@chakra-ui/react
'
;
import
{
AnimatePresence
}
from
'
framer-motion
'
;
import
React
from
'
react
'
;
...
...
@@ -49,14 +49,7 @@ const TxsTable = ({
<
Th
width=
"160px"
>
Type
</
Th
>
<
Th
width=
"20%"
>
Method
</
Th
>
{
showBlockInfo
&&
<
Th
width=
"18%"
>
Block
</
Th
>
}
<
Th
width=
{
{
xl
:
'
152px
'
,
base
:
'
86px
'
}
}
>
<
Show
above=
"xl"
ssr=
{
false
}
>
From
</
Show
>
<
Hide
above=
"xl"
ssr=
{
false
}
>
From / To
</
Hide
>
</
Th
>
<
Th
width=
{
{
xl
:
currentAddress
?
'
48px
'
:
'
36px
'
,
base
:
currentAddress
?
'
52px
'
:
'
28px
'
}
}
></
Th
>
<
Th
width=
{
{
xl
:
'
152px
'
,
base
:
'
86px
'
}
}
>
<
Show
above=
"xl"
ssr=
{
false
}
>
To
</
Show
>
</
Th
>
<
Th
width=
{
{
base
:
'
224px
'
,
xl
:
'
352px
'
}
}
>
From/To
</
Th
>
{
!
config
.
UI
.
views
.
tx
.
hiddenFields
?.
value
&&
(
<
Th
width=
"20%"
isNumeric
>
<
Link
onClick=
{
sort
(
'
value
'
)
}
display=
"flex"
justifyContent=
"end"
>
...
...
ui/txs/TxsTableItem.tsx
View file @
9e92c0da
...
...
@@ -2,11 +2,7 @@ import {
Tr
,
Td
,
VStack
,
Show
,
Hide
,
Flex
,
Skeleton
,
Box
,
}
from
'
@chakra-ui/react
'
;
import
{
motion
}
from
'
framer-motion
'
;
import
React
from
'
react
'
;
...
...
@@ -15,13 +11,11 @@ import type { Transaction } from 'types/api/transaction';
import
config
from
'
configs/app
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
CurrencyValue
from
'
ui/shared/CurrencyValue
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
BlockEntity
from
'
ui/shared/entities/block/BlockEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
InOutTag
from
'
ui/shared/InOutTag
'
;
import
TxStatus
from
'
ui/shared/statusTag/TxStatus
'
;
import
TxFeeStability
from
'
ui/shared/tx/TxFeeStability
'
;
import
TxWatchListTags
from
'
ui/shared/tx/TxWatchListTags
'
;
...
...
@@ -39,39 +33,8 @@ type Props = {
const
TxsTableItem
=
({
tx
,
showBlockInfo
,
currentAddress
,
enableTimeIncrement
,
isLoading
}:
Props
)
=>
{
const
dataTo
=
tx
.
to
?
tx
.
to
:
tx
.
created_contract
;
const
isOut
=
Boolean
(
currentAddress
&&
currentAddress
===
tx
.
from
.
hash
);
const
isIn
=
Boolean
(
currentAddress
&&
currentAddress
===
dataTo
?.
hash
);
const
timeAgo
=
useTimeAgoIncrement
(
tx
.
timestamp
,
enableTimeIncrement
);
const
addressFrom
=
(
<
AddressEntity
address=
{
tx
.
from
}
isLoading=
{
isLoading
}
noCopy=
{
isOut
}
noLink=
{
isOut
}
truncation=
"constant"
w=
"min-content"
maxW=
"100%"
my=
"2px"
lineHeight=
"20px"
/>
);
const
addressTo
=
dataTo
?
(
<
AddressEntity
address=
{
dataTo
}
isLoading=
{
isLoading
}
truncation=
"constant"
noCopy=
{
isIn
}
noLink=
{
isIn
}
w=
"min-content"
maxW=
"100%"
py=
"2px"
lineHeight=
"20px"
/>
)
:
'
-
'
;
return
(
<
Tr
as=
{
motion
.
tr
}
...
...
@@ -124,42 +87,16 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
)
}
</
Td
>
)
}
<
Show
above=
"xl"
ssr=
{
false
}
>
<
Td
>
{
addressFrom
}
</
Td
>
<
Td
px=
{
0
}
>
{
(
isIn
||
isOut
)
?
<
InOutTag
isIn=
{
isIn
}
isOut=
{
isOut
}
width=
"48px"
mr=
{
2
}
isLoading=
{
isLoading
}
/>
:
(
<
Box
mx=
"6px"
>
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
/>
</
Box
>
)
}
</
Td
>
<
Td
>
{
addressTo
}
</
Td
>
</
Show
>
<
Hide
above=
"xl"
ssr=
{
false
}
>
<
Td
colSpan=
{
3
}
>
<
Flex
alignItems=
"center"
>
{
(
isIn
||
isOut
)
?
<
InOutTag
isIn=
{
isIn
}
isOut=
{
isOut
}
width=
"48px"
isLoading=
{
isLoading
}
/>
:
(
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
transform=
"rotate(90deg)"
isLoading=
{
isLoading
}
/>
)
}
<
VStack
alignItems=
"start"
ml=
{
1
}
w=
"calc(100% - 48px)"
gap=
"11px"
>
{
addressFrom
}
{
addressTo
}
</
VStack
>
</
Flex
>
</
Td
>
</
Hide
>
<
Td
>
<
AddressFromTo
from=
{
tx
.
from
}
to=
{
dataTo
}
current=
{
currentAddress
}
isLoading=
{
isLoading
}
mt=
"2px"
mode=
{
{
lg
:
'
compact
'
,
xl
:
'
long
'
}
}
/>
</
Td
>
{
!
config
.
UI
.
views
.
tx
.
hiddenFields
?.
value
&&
(
<
Td
isNumeric
>
<
CurrencyValue
value=
{
tx
.
value
}
accuracy=
{
8
}
isLoading=
{
isLoading
}
/>
...
...
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