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
50ea2ef5
Commit
50ea2ef5
authored
Nov 15, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix watchlist table item layout
parent
094530b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
account.ts
types/api/account.ts
+2
-3
WatchListAddressItem.tsx
ui/watchlist/WatchlistTable/WatchListAddressItem.tsx
+23
-13
No files found.
types/api/account.ts
View file @
50ea2ef5
...
@@ -58,9 +58,8 @@ export interface UserInfo {
...
@@ -58,9 +58,8 @@ export interface UserInfo {
export
interface
WatchlistAddress
{
export
interface
WatchlistAddress
{
address_hash
:
string
;
address_hash
:
string
;
name
:
string
;
name
:
string
;
address_balance
:
number
;
address_balance
:
string
;
coin_name
:
string
;
exchange_rate
:
string
;
exchange_rate
:
number
;
notification_settings
:
NotificationSettings
;
notification_settings
:
NotificationSettings
;
notification_methods
:
NotificationMethods
;
notification_methods
:
NotificationMethods
;
id
:
string
;
id
:
string
;
...
...
ui/watchlist/WatchlistTable/WatchListAddressItem.tsx
View file @
50ea2ef5
import
{
HStack
,
VStack
,
Text
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
VStack
,
Text
,
Icon
,
useColorModeValue
,
Flex
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TWatchlistItem
}
from
'
types/client/account
'
;
import
type
{
TWatchlistItem
}
from
'
types/client/account
'
;
...
@@ -8,26 +8,36 @@ import TokensIcon from 'icons/tokens.svg';
...
@@ -8,26 +8,36 @@ import TokensIcon from 'icons/tokens.svg';
// import WalletIcon from 'icons/wallet.svg';
// import WalletIcon from 'icons/wallet.svg';
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
AddressSnippet
from
'
ui/shared/AddressSnippet
'
;
import
AddressSnippet
from
'
ui/shared/AddressSnippet
'
;
import
CurrencyValue
from
'
ui/shared/CurrencyValue
'
;
import
TokenLogo
from
'
ui/shared/TokenLogo
'
;
import
TokenLogo
from
'
ui/shared/TokenLogo
'
;
const
DECIMALS
=
18
;
const
WatchListAddressItem
=
({
item
}:
{
item
:
TWatchlistItem
})
=>
{
const
WatchListAddressItem
=
({
item
}:
{
item
:
TWatchlistItem
})
=>
{
const
mainTextColor
=
useColorModeValue
(
'
gray.700
'
,
'
gray.50
'
);
const
mainTextColor
=
useColorModeValue
(
'
gray.700
'
,
'
gray.50
'
);
const
nativeBalance
=
((
item
.
address_balance
||
0
)
/
10
**
DECIMALS
).
toFixed
(
1
);
const
infoItemsPaddingLeft
=
{
base
:
0
,
lg
:
8
};
const
nativeBalanceUSD
=
item
.
exchange_rate
?
`$
${
Number
(
nativeBalance
)
*
item
.
exchange_rate
}
USD`
:
'
N/A
'
;
const
infoItemsPaddingLeft
=
{
base
:
0
,
lg
:
10
};
return
(
return
(
<
VStack
spacing=
{
2
}
align=
"stretch"
overflow=
"hidden"
fontWeight=
{
500
}
color=
"gray.700"
>
<
VStack
spacing=
{
2
}
align=
"stretch"
fontWeight=
{
500
}
color=
"gray.700"
>
<
AddressSnippet
address=
{
item
.
address_hash
}
/>
<
AddressSnippet
address=
{
item
.
address_hash
}
/>
<
HStack
spacing=
{
0
}
fontSize=
"sm"
h=
{
6
}
pl=
{
infoItemsPaddingLeft
}
>
<
Flex
fontSize=
"sm"
h=
{
6
}
pl=
{
infoItemsPaddingLeft
}
flexWrap=
"wrap"
alignItems=
"center"
rowGap=
{
1
}
>
{
appConfig
.
network
.
nativeTokenAddress
&&
{
appConfig
.
network
.
nativeTokenAddress
&&
(
<
TokenLogo
hash=
{
appConfig
.
network
.
nativeTokenAddress
}
name=
{
appConfig
.
network
.
name
}
boxSize=
{
4
}
mr=
"10px"
/>
}
<
TokenLogo
<
Text
color=
{
mainTextColor
}
>
{
`${ appConfig.network.currency.symbol } balance:${ nbsp }`
+
nativeBalance
}
</
Text
>
hash=
{
appConfig
.
network
.
nativeTokenAddress
}
<
Text
variant=
"secondary"
>
{
`${ nbsp }(${ nativeBalanceUSD })`
}
</
Text
>
name=
{
appConfig
.
network
.
name
}
</
HStack
>
boxSize=
{
4
}
borderRadius=
"sm"
mr=
{
2
}
/>
)
}
<
Text
as=
"span"
whiteSpace=
"pre"
>
{
appConfig
.
network
.
currency
.
symbol
}
balance:
</
Text
>
<
CurrencyValue
value=
{
item
.
address_balance
}
exchangeRate=
{
item
.
exchange_rate
}
decimals=
{
String
(
appConfig
.
network
.
currency
.
decimals
)
}
accuracy=
{
2
}
accuracyUsd=
{
2
}
/>
</
Flex
>
{
item
.
tokens_count
&&
(
{
item
.
tokens_count
&&
(
<
HStack
spacing=
{
0
}
fontSize=
"sm"
h=
{
6
}
pl=
{
infoItemsPaddingLeft
}
>
<
HStack
spacing=
{
0
}
fontSize=
"sm"
h=
{
6
}
pl=
{
infoItemsPaddingLeft
}
>
<
Icon
as=
{
TokensIcon
}
marginRight=
"10px"
w=
"17px"
h=
"16px"
/>
<
Icon
as=
{
TokensIcon
}
marginRight=
"10px"
w=
"17px"
h=
"16px"
/>
...
...
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