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
663171f3
Commit
663171f3
authored
Apr 16, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tooltip
parent
cb844b8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
WalletMenuDesktop.tsx
ui/snippets/walletMenu/WalletMenuDesktop.tsx
+10
-10
WalletTooltip.tsx
ui/snippets/walletMenu/WalletTooltip.tsx
+20
-18
No files found.
ui/snippets/walletMenu/WalletMenuDesktop.tsx
View file @
663171f3
...
@@ -70,13 +70,13 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
...
@@ -70,13 +70,13 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
isOpen=
{
isPopoverOpen
}
isOpen=
{
isPopoverOpen
}
onClose=
{
setIsPopoverOpen
.
off
}
onClose=
{
setIsPopoverOpen
.
off
}
>
>
<
WalletTooltip
<
Box
ml=
{
2
}
>
isDisabled=
{
isMobile
===
undefined
||
isMobile
}
<
PopoverTrigger
>
isWalletConnected=
{
isWalletConnected
}
<
WalletTooltip
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
isDisabled=
{
isMobile
===
undefined
||
isMobile
}
>
isWalletConnected=
{
isWalletConnected
}
<
Box
ml=
{
2
}
>
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
<
PopoverTrigger
>
>
<
Button
<
Button
className=
{
className
}
className=
{
className
}
variant=
{
variant
}
variant=
{
variant
}
...
@@ -96,9 +96,9 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
...
@@ -96,9 +96,9 @@ const WalletMenuDesktop = ({ isHomePage, className, size = 'md' }: Props) => {
</>
</>
)
:
'
Connect wallet
'
}
)
:
'
Connect wallet
'
}
</
Button
>
</
Button
>
</
PopoverTrigger
>
</
WalletTooltip
>
</
Box
>
</
PopoverTrigger
>
</
WalletTooltip
>
</
Box
>
{
isWalletConnected
&&
(
{
isWalletConnected
&&
(
<
PopoverContent
w=
"235px"
>
<
PopoverContent
w=
"235px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
...
...
ui/snippets/walletMenu/WalletTooltip.tsx
View file @
663171f3
import
{
Tooltip
,
useBoolean
,
useOutsideClick
}
from
'
@chakra-ui/react
'
;
import
{
Tooltip
,
useBoolean
,
useOutsideClick
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -15,11 +15,11 @@ type Props = {
...
@@ -15,11 +15,11 @@ type Props = {
const
LOCAL_STORAGE_KEY
=
'
wallet-connect-tooltip-shown
'
;
const
LOCAL_STORAGE_KEY
=
'
wallet-connect-tooltip-shown
'
;
const
WalletTooltip
=
({
children
,
isDisabled
,
isMobile
,
isWalletConnected
,
isAutoConnectDisabled
}:
Props
)
=>
{
const
WalletTooltip
=
({
children
,
isDisabled
,
isMobile
,
isWalletConnected
,
isAutoConnectDisabled
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLDivElement
>
)
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
const
r
ef
=
React
.
useRef
(
null
);
const
innerR
ef
=
React
.
useRef
(
null
);
useOutsideClick
({
ref
,
handler
:
setIsTooltipShown
.
off
});
useOutsideClick
({
ref
:
innerRef
,
handler
:
setIsTooltipShown
.
off
});
const
label
=
React
.
useMemo
(()
=>
{
const
label
=
React
.
useMemo
(()
=>
{
if
(
isWalletConnected
)
{
if
(
isWalletConnected
)
{
...
@@ -62,20 +62,22 @@ const WalletTooltip = ({ children, isDisabled, isMobile, isWalletConnected, isAu
...
@@ -62,20 +62,22 @@ const WalletTooltip = ({ children, isDisabled, isMobile, isWalletConnected, isAu
},
[
setIsTooltipShown
,
isDisabled
,
router
,
isAppPage
]);
},
[
setIsTooltipShown
,
isDisabled
,
router
,
isAppPage
]);
return
(
return
(
<
Tooltip
<
Box
ref=
{
ref
}
>
label=
{
label
}
<
Tooltip
textAlign=
"center"
label=
{
label
}
padding=
{
2
}
textAlign=
"center"
isDisabled=
{
isDisabled
||
(
isWalletConnected
&&
!
isAppPage
)
}
padding=
{
2
}
openDelay=
{
500
}
isDisabled=
{
isDisabled
||
(
isWalletConnected
&&
!
isAppPage
)
}
isOpen=
{
isTooltipShown
||
(
isMobile
?
false
:
undefined
)
}
openDelay=
{
500
}
onClose=
{
setIsTooltipShown
.
off
}
isOpen=
{
isTooltipShown
||
(
isMobile
?
false
:
undefined
)
}
display=
{
isMobile
?
{
base
:
'
flex
'
,
lg
:
'
none
'
}
:
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
onClose=
{
setIsTooltipShown
.
off
}
ref=
{
ref
}
display=
{
isMobile
?
{
base
:
'
flex
'
,
lg
:
'
none
'
}
:
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
ref=
{
innerRef
}
{
children
}
>
</
Tooltip
>
{
children
}
</
Tooltip
>
</
Box
>
);
);
};
};
export
default
WalletTooltip
;
export
default
React
.
forwardRef
(
WalletTooltip
)
;
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