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
a5fc1a11
Commit
a5fc1a11
authored
Jan 03, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base implementation of AddressFromTo component
parent
742760d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
70 deletions
+100
-70
InOutTag.tsx
ui/shared/InOutTag.tsx
+1
-0
TokenTransferListItem.tsx
ui/shared/TokenTransfer/TokenTransferListItem.tsx
+8
-34
TokenTransferTable.tsx
ui/shared/TokenTransfer/TokenTransferTable.tsx
+3
-5
TokenTransferTableItem.tsx
ui/shared/TokenTransfer/TokenTransferTableItem.tsx
+7
-31
AddressFromTo.tsx
ui/shared/address/AddressFromTo.tsx
+81
-0
No files found.
ui/shared/InOutTag.tsx
View file @
a5fc1a11
...
@@ -10,6 +10,7 @@ interface Props {
...
@@ -10,6 +10,7 @@ interface Props {
isLoading
?:
boolean
;
isLoading
?:
boolean
;
}
}
// TODO @tom2drum remove this component
const
InOutTag
=
({
isIn
,
isOut
,
className
,
isLoading
}:
Props
)
=>
{
const
InOutTag
=
({
isIn
,
isOut
,
className
,
isLoading
}:
Props
)
=>
{
if
(
!
isIn
&&
!
isOut
)
{
if
(
!
isIn
&&
!
isOut
)
{
return
null
;
return
null
;
...
...
ui/shared/TokenTransfer/TokenTransferListItem.tsx
View file @
a5fc1a11
...
@@ -5,13 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
...
@@ -5,13 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
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
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
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
ListItemMobile
from
'
ui/shared/ListItemMobile/ListItemMobile
'
;
import
{
getTokenTransferTypeText
}
from
'
ui/shared/TokenTransfer/helpers
'
;
import
{
getTokenTransferTypeText
}
from
'
ui/shared/TokenTransfer/helpers
'
;
import
TxAdditionalInfo
from
'
ui/txs/TxAdditionalInfo
'
;
import
TxAdditionalInfo
from
'
ui/txs/TxAdditionalInfo
'
;
...
@@ -45,7 +43,6 @@ const TokenTransferListItem = ({
...
@@ -45,7 +43,6 @@ const TokenTransferListItem = ({
decimals
:
total
.
decimals
||
'
0
'
,
decimals
:
total
.
decimals
||
'
0
'
,
})
:
{
usd
:
null
,
valueStr
:
null
};
})
:
{
usd
:
null
,
valueStr
:
null
};
const
addressWidth
=
`calc((100% -
${
baseAddress
?
'
50px - 24px
'
:
'
24px - 24px
'
}
) / 2)`
;
return
(
return
(
<
ListItemMobile
rowGap=
{
3
}
isAnimated
>
<
ListItemMobile
rowGap=
{
3
}
isAnimated
>
<
Flex
w=
"100%"
justifyContent=
"space-between"
>
<
Flex
w=
"100%"
justifyContent=
"space-between"
>
...
@@ -80,36 +77,13 @@ const TokenTransferListItem = ({
...
@@ -80,36 +77,13 @@ const TokenTransferListItem = ({
)
}
)
}
</
Flex
>
</
Flex
>
)
}
)
}
<
Flex
w=
"100%"
columnGap=
{
3
}
>
<
AddressFromTo
<
AddressEntity
from=
{
from
}
address=
{
from
}
to=
{
to
}
isLoading=
{
isLoading
}
current=
{
baseAddress
}
noLink=
{
baseAddress
===
from
.
hash
}
isLoading=
{
isLoading
}
noCopy=
{
baseAddress
===
from
.
hash
}
w=
"100%"
flexShrink=
{
0
}
/>
width=
{
addressWidth
}
/>
{
baseAddress
?
(
<
InOutTag
isIn=
{
baseAddress
===
to
.
hash
}
isOut=
{
baseAddress
===
from
.
hash
}
w=
"50px"
textAlign=
"center"
isLoading=
{
isLoading
}
flexShrink=
{
0
}
/>
)
:
<
IconSvg
name=
"arrows/east"
boxSize=
{
6
}
color=
"gray.500"
isLoading=
{
isLoading
}
flexShrink=
{
0
}
/>
}
<
AddressEntity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
baseAddress
===
to
.
hash
}
noCopy=
{
baseAddress
===
to
.
hash
}
flexShrink=
{
0
}
width=
{
addressWidth
}
/>
</
Flex
>
{
valueStr
&&
(
{
valueStr
&&
(
<
Flex
columnGap=
{
2
}
w=
"100%"
>
<
Flex
columnGap=
{
2
}
w=
"100%"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontWeight=
{
500
}
flexShrink=
{
0
}
>
Value
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontWeight=
{
500
}
flexShrink=
{
0
}
>
Value
</
Skeleton
>
...
...
ui/shared/TokenTransfer/TokenTransferTable.tsx
View file @
a5fc1a11
...
@@ -40,11 +40,9 @@ const TokenTransferTable = ({
...
@@ -40,11 +40,9 @@ const TokenTransferTable = ({
{
showTxInfo
&&
<
Th
width=
"44px"
></
Th
>
}
{
showTxInfo
&&
<
Th
width=
"44px"
></
Th
>
}
<
Th
width=
"185px"
>
Token
</
Th
>
<
Th
width=
"185px"
>
Token
</
Th
>
<
Th
width=
"160px"
>
Token ID
</
Th
>
<
Th
width=
"160px"
>
Token ID
</
Th
>
{
showTxInfo
&&
<
Th
width=
"25%"
>
Txn hash
</
Th
>
}
{
showTxInfo
&&
<
Th
width=
"30%"
>
Txn hash
</
Th
>
}
<
Th
width=
"25%"
>
From
</
Th
>
<
Th
width=
"40%"
>
From/To
</
Th
>
{
baseAddress
&&
<
Th
width=
"50px"
px=
{
0
}
/>
}
<
Th
width=
"30%"
isNumeric
>
Value
</
Th
>
<
Th
width=
"25%"
>
To
</
Th
>
<
Th
width=
"25%"
isNumeric
>
Value
</
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
...
...
ui/shared/TokenTransfer/TokenTransferTableItem.tsx
View file @
a5fc1a11
...
@@ -5,12 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
...
@@ -5,12 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
import
AddressFromTo
from
'
ui/shared/address/AddressFromTo
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
Tag
from
'
ui/shared/chakra/Tag
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
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
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
TxEntity
from
'
ui/shared/entities/tx/TxEntity
'
;
import
InOutTag
from
'
ui/shared/InOutTag
'
;
import
{
getTokenTransferTypeText
}
from
'
ui/shared/TokenTransfer/helpers
'
;
import
{
getTokenTransferTypeText
}
from
'
ui/shared/TokenTransfer/helpers
'
;
import
TxAdditionalInfo
from
'
ui/txs/TxAdditionalInfo
'
;
import
TxAdditionalInfo
from
'
ui/txs/TxAdditionalInfo
'
;
...
@@ -85,36 +84,13 @@ const TokenTransferTableItem = ({
...
@@ -85,36 +84,13 @@ const TokenTransferTableItem = ({
</
Td
>
</
Td
>
)
}
)
}
<
Td
>
<
Td
>
<
AddressEntity
<
AddressFromTo
address=
{
from
}
from=
{
from
}
to=
{
to
}
current=
{
baseAddress
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
my=
"5px"
mt=
{
1
}
noLink=
{
baseAddress
===
from
.
hash
}
mode=
{
{
lg
:
'
compact
'
,
xl
:
'
long
'
}
}
noCopy=
{
baseAddress
===
from
.
hash
}
flexGrow=
{
1
}
/>
</
Td
>
{
baseAddress
&&
(
<
Td
px=
{
0
}
>
<
Box
mt=
"3px"
>
<
InOutTag
isIn=
{
baseAddress
===
to
.
hash
}
isOut=
{
baseAddress
===
from
.
hash
}
w=
"50px"
textAlign=
"center"
isLoading=
{
isLoading
}
/>
</
Box
>
</
Td
>
)
}
<
Td
>
<
AddressEntity
address=
{
to
}
isLoading=
{
isLoading
}
my=
"5px"
noLink=
{
baseAddress
===
to
.
hash
}
noCopy=
{
baseAddress
===
to
.
hash
}
flexGrow=
{
1
}
/>
/>
</
Td
>
</
Td
>
<
Td
isNumeric
verticalAlign=
"top"
>
<
Td
isNumeric
verticalAlign=
"top"
>
...
...
ui/shared/address/AddressFromTo.tsx
0 → 100644
View file @
a5fc1a11
import
type
{
ThemeTypings
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
chakra
,
useBreakpointValue
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
AddressParam
}
from
'
types/api/addressParams
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
type
Mode
=
'
compact
'
|
'
long
'
;
interface
Props
{
from
:
AddressParam
;
to
:
AddressParam
;
current
?:
string
;
mode
?:
Mode
|
Partial
<
Record
<
ThemeTypings
[
'
breakpoints
'
],
Mode
>>
;
className
?:
string
;
isLoading
?:
boolean
;
}
const
AddressFromTo
=
({
from
,
to
,
current
,
mode
:
modeProp
,
className
,
isLoading
}:
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
'
;
if
(
mode
===
'
compact
'
)
{
return
(
<
Flex
className=
{
className
}
flexDir=
"column"
rowGap=
"14px"
>
<
Flex
alignItems=
"center"
columnGap=
{
2
}
>
<
IconSvg
name=
"arrows/east"
color=
{
iconColor
}
boxSize=
{
5
}
flexShrink=
{
0
}
transform=
"rotate(90deg)"
/>
<
AddressEntity
address=
{
from
}
isLoading=
{
isLoading
}
noLink=
{
current
===
from
.
hash
}
noCopy=
{
current
===
from
.
hash
}
maxW=
"calc(100% - 28px)"
/>
</
Flex
>
<
AddressEntity
address=
{
to
}
isLoading=
{
isLoading
}
noLink=
{
current
===
to
.
hash
}
noCopy=
{
current
===
to
.
hash
}
maxW=
"calc(100% - 28px)"
ml=
"28px"
/>
</
Flex
>
);
}
return
(
<
Flex
className=
{
className
}
alignItems=
"center"
columnGap=
{
2
}
>
<
AddressEntity
address=
{
from
}
isLoading=
{
isLoading
}
noLink=
{
current
===
from
.
hash
}
noCopy=
{
current
===
from
.
hash
}
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)"
/>
</
Flex
>
);
};
export
default
chakra
(
AddressFromTo
);
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