Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
a4c54ff9
Unverified
Commit
a4c54ff9
authored
Dec 07, 2022
by
lynn
Committed by
GitHub
Dec 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: show ens in wallet dropdown too if available (#5564)
* done * handle no ENS case
parent
d4cb32c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
AuthenticatedHeader.tsx
src/components/WalletDropdown/AuthenticatedHeader.tsx
+35
-5
No files found.
src/components/WalletDropdown/AuthenticatedHeader.tsx
View file @
a4c54ff9
...
@@ -17,7 +17,8 @@ import { Text } from 'rebass'
...
@@ -17,7 +17,8 @@ import { Text } from 'rebass'
import
{
useCurrencyBalanceString
}
from
'
state/connection/hooks
'
import
{
useCurrencyBalanceString
}
from
'
state/connection/hooks
'
import
{
useAppDispatch
}
from
'
state/hooks
'
import
{
useAppDispatch
}
from
'
state/hooks
'
import
{
updateSelectedWallet
}
from
'
state/user/reducer
'
import
{
updateSelectedWallet
}
from
'
state/user/reducer
'
import
styled
from
'
styled-components/macro
'
import
styled
,
{
css
}
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
{
shortenAddress
}
from
'
../../nft/utils/address
'
import
{
shortenAddress
}
from
'
../../nft/utils/address
'
import
{
useCloseModal
,
useToggleModal
}
from
'
../../state/application/hooks
'
import
{
useCloseModal
,
useToggleModal
}
from
'
../../state/application/hooks
'
...
@@ -82,6 +83,30 @@ const FlexContainer = styled.div`
...
@@ -82,6 +83,30 @@ const FlexContainer = styled.div`
const
StatusWrapper
=
styled
.
div
`
const
StatusWrapper
=
styled
.
div
`
display: inline-block;
display: inline-block;
margin-top: 4px;
margin-top: 4px;
width: 70%;
`
const
TruncatedTextStyle
=
css
`
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
`
const
AccountNamesWrapper
=
styled
.
div
`
${
TruncatedTextStyle
}
margin-right: 8px;
`
const
ENSNameContainer
=
styled
(
ThemedText
.
SubHeader
)
`
${
TruncatedTextStyle
}
color:
${({
theme
})
=>
theme
.
textPrimary
}
;
margin-top: 2.5px;
`
const
AccountContainer
=
styled
(
ThemedText
.
BodySmall
)
`
${
TruncatedTextStyle
}
color:
${({
theme
})
=>
theme
.
textSecondary
}
;
margin-top: 2.5px;
`
`
const
BalanceWrapper
=
styled
.
div
`
const
BalanceWrapper
=
styled
.
div
`
...
@@ -99,7 +124,7 @@ const AuthenticatedHeaderWrapper = styled.div`
...
@@ -99,7 +124,7 @@ const AuthenticatedHeaderWrapper = styled.div`
`
`
const
AuthenticatedHeader
=
()
=>
{
const
AuthenticatedHeader
=
()
=>
{
const
{
account
,
chainId
,
connector
}
=
useWeb3React
()
const
{
account
,
chainId
,
connector
,
ENSName
}
=
useWeb3React
()
const
[
isCopied
,
setCopied
]
=
useCopyClipboard
()
const
[
isCopied
,
setCopied
]
=
useCopyClipboard
()
const
copy
=
useCallback
(()
=>
{
const
copy
=
useCallback
(()
=>
{
setCopied
(
account
||
''
)
setCopied
(
account
||
''
)
...
@@ -153,9 +178,14 @@ const AuthenticatedHeader = () => {
...
@@ -153,9 +178,14 @@ const AuthenticatedHeader = () => {
<
StatusWrapper
>
<
StatusWrapper
>
<
FlexContainer
>
<
FlexContainer
>
<
StatusIcon
connectionType=
{
connectionType
}
size=
{
24
}
/>
<
StatusIcon
connectionType=
{
connectionType
}
size=
{
24
}
/>
<
Text
fontSize=
{
16
}
fontWeight=
{
600
}
marginTop=
"2.5px"
>
{
ENSName
?
(
{
account
&&
shortenAddress
(
account
,
2
,
4
)
}
<
AccountNamesWrapper
>
</
Text
>
<
ENSNameContainer
>
{
ENSName
}
</
ENSNameContainer
>
<
AccountContainer
>
{
account
&&
shortenAddress
(
account
,
2
,
4
)
}
</
AccountContainer
>
</
AccountNamesWrapper
>
)
:
(
<
ThemedText
.
SubHeader
marginTop=
"2.5px"
>
{
account
&&
shortenAddress
(
account
,
2
,
4
)
}
</
ThemedText
.
SubHeader
>
)
}
</
FlexContainer
>
</
FlexContainer
>
</
StatusWrapper
>
</
StatusWrapper
>
<
IconContainer
>
<
IconContainer
>
...
...
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