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
580f41b0
Commit
580f41b0
authored
Aug 08, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display ens on wallet button and in menu
parent
cec56f19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
WalletMenuContent.tsx
ui/snippets/walletMenu/WalletMenuContent.tsx
+3
-2
WalletMenuDesktop.tsx
ui/snippets/walletMenu/WalletMenuDesktop.tsx
+12
-2
WalletMenuMobile.tsx
ui/snippets/walletMenu/WalletMenuMobile.tsx
+7
-1
No files found.
ui/snippets/walletMenu/WalletMenuContent.tsx
View file @
580f41b0
...
...
@@ -10,13 +10,14 @@ import useMenuButtonColors from '../useMenuButtonColors';
type
Props
=
{
address
?:
string
;
ensDomainName
?:
string
|
null
;
disconnect
?:
()
=>
void
;
isAutoConnectDisabled
?:
boolean
;
openWeb3Modal
:
()
=>
void
;
closeWalletMenu
:
()
=>
void
;
};
const
WalletMenuContent
=
({
address
,
disconnect
,
isAutoConnectDisabled
,
openWeb3Modal
,
closeWalletMenu
}:
Props
)
=>
{
const
WalletMenuContent
=
({
address
,
ensDomainName
,
disconnect
,
isAutoConnectDisabled
,
openWeb3Modal
,
closeWalletMenu
}:
Props
)
=>
{
const
{
themedBackgroundOrange
}
=
useMenuButtonColors
();
const
[
isModalOpening
,
setIsModalOpening
]
=
React
.
useState
(
false
);
...
...
@@ -71,7 +72,7 @@ const WalletMenuContent = ({ address, disconnect, isAutoConnectDisabled, openWeb
</
Text
>
<
Flex
alignItems=
"center"
mb=
{
6
}
>
<
AddressEntity
address=
{
{
hash
:
address
}
}
address=
{
{
hash
:
address
,
ens_domain_name
:
ensDomainName
}
}
noTooltip
truncation=
"dynamic"
fontSize=
"sm"
...
...
ui/snippets/walletMenu/WalletMenuDesktop.tsx
View file @
580f41b0
...
...
@@ -5,6 +5,7 @@ import React from 'react';
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
useAddressQuery
from
'
ui/address/utils/useAddressQuery
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
HashStringShorten
from
'
ui/shared/HashStringShorten
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
...
...
@@ -27,6 +28,7 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
const
[
isPopoverOpen
,
setIsPopoverOpen
]
=
useBoolean
(
false
);
const
isMobile
=
useIsMobile
();
const
{
isAutoConnectDisabled
}
=
useMarketplaceContext
();
const
addressQuery
=
useAddressQuery
({
hash
:
address
});
const
variant
=
React
.
useMemo
(()
=>
{
if
(
isWalletConnected
)
{
...
...
@@ -83,7 +85,10 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
variant=
{
variant
}
colorScheme=
"blue"
flexShrink=
{
0
}
isLoading=
{
(
isModalOpening
||
isModalOpen
)
&&
!
isWalletConnected
}
isLoading=
{
((
isModalOpening
||
isModalOpen
)
&&
!
isWalletConnected
)
||
(
addressQuery
.
isPlaceholderData
&&
isWalletConnected
)
}
loadingText=
"Connect wallet"
onClick=
{
isWalletConnected
?
openPopover
:
connect
}
fontSize=
"sm"
...
...
@@ -94,7 +99,11 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
{
isWalletConnected
?
(
<>
<
WalletIdenticon
address=
{
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
mr=
{
2
}
/>
<
HashStringShorten
hash=
{
address
}
isTooltipDisabled
/>
{
addressQuery
.
data
?.
ens_domain_name
?
(
<
chakra
.
span
>
{
addressQuery
.
data
.
ens_domain_name
}
</
chakra
.
span
>
)
:
(
<
HashStringShorten
hash=
{
address
}
isTooltipDisabled
/>
)
}
</>
)
:
(
<>
...
...
@@ -111,6 +120,7 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
WalletMenuContent
address=
{
address
}
ensDomainName=
{
addressQuery
.
data
?.
ens_domain_name
}
disconnect=
{
disconnect
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
openWeb3Modal=
{
openModal
}
...
...
ui/snippets/walletMenu/WalletMenuMobile.tsx
View file @
580f41b0
...
...
@@ -4,6 +4,7 @@ import React from 'react';
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
useAddressQuery
from
'
ui/address/utils/useAddressQuery
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
useWallet
from
'
ui/snippets/walletMenu/useWallet
'
;
import
WalletMenuContent
from
'
ui/snippets/walletMenu/WalletMenuContent
'
;
...
...
@@ -18,6 +19,7 @@ const WalletMenuMobile = () => {
const
{
themedBackground
,
themedBackgroundOrange
,
themedBorderColor
,
themedColor
}
=
useMenuButtonColors
();
const
isMobile
=
useIsMobile
();
const
{
isAutoConnectDisabled
}
=
useMarketplaceContext
();
const
addressQuery
=
useAddressQuery
({
hash
:
address
});
const
openPopover
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
WALLET_ACTION
,
{
Action
:
'
Open
'
});
...
...
@@ -48,7 +50,10 @@ const WalletMenuMobile = () => {
color=
{
themedColor
}
borderColor=
{
!
isWalletConnected
?
themedBorderColor
:
undefined
}
onClick=
{
isWalletConnected
?
openPopover
:
connect
}
isLoading=
{
(
isModalOpening
||
isModalOpen
)
&&
!
isWalletConnected
}
isLoading=
{
((
isModalOpening
||
isModalOpen
)
&&
!
isWalletConnected
)
||
(
addressQuery
.
isPlaceholderData
&&
isWalletConnected
)
}
/>
</
WalletTooltip
>
{
isWalletConnected
&&
(
...
...
@@ -63,6 +68,7 @@ const WalletMenuMobile = () => {
<
DrawerBody
p=
{
6
}
>
<
WalletMenuContent
address=
{
address
}
ensDomainName=
{
addressQuery
.
data
?.
ens_domain_name
}
disconnect=
{
disconnect
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
openWeb3Modal=
{
openModal
}
...
...
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