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
669f6281
Commit
669f6281
authored
Dec 13, 2023
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tooltip
parent
e0e02202
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
37 deletions
+61
-37
WalletMenuDesktop.tsx
ui/snippets/walletMenu/WalletMenuDesktop.tsx
+4
-21
WalletMenuMobile.tsx
ui/snippets/walletMenu/WalletMenuMobile.tsx
+19
-16
WalletTooltip.tsx
ui/snippets/walletMenu/WalletTooltip.tsx
+38
-0
No files found.
ui/snippets/walletMenu/WalletMenuDesktop.tsx
View file @
669f6281
import
type
{
ButtonProps
}
from
'
@chakra-ui/react
'
;
import
type
{
ButtonProps
}
from
'
@chakra-ui/react
'
;
import
{
Popover
,
PopoverContent
,
PopoverBody
,
PopoverTrigger
,
Button
,
Box
,
useBoolean
,
Tooltip
}
from
'
@chakra-ui/react
'
;
import
{
Popover
,
PopoverContent
,
PopoverBody
,
PopoverTrigger
,
Button
,
Box
,
useBoolean
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
...
@@ -8,6 +8,7 @@ import useWallet from 'ui/snippets/walletMenu/useWallet';
...
@@ -8,6 +8,7 @@ import useWallet from 'ui/snippets/walletMenu/useWallet';
import
WalletMenuContent
from
'
ui/snippets/walletMenu/WalletMenuContent
'
;
import
WalletMenuContent
from
'
ui/snippets/walletMenu/WalletMenuContent
'
;
import
useMenuButtonColors
from
'
../useMenuButtonColors
'
;
import
useMenuButtonColors
from
'
../useMenuButtonColors
'
;
import
WalletTooltip
from
'
./WalletTooltip
'
;
type
Props
=
{
type
Props
=
{
isHomePage
?:
boolean
;
isHomePage
?:
boolean
;
...
@@ -17,15 +18,6 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -17,15 +18,6 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
const
{
isWalletConnected
,
address
,
connect
,
disconnect
,
isModalOpening
,
isModalOpen
}
=
useWallet
();
const
{
isWalletConnected
,
address
,
connect
,
disconnect
,
isModalOpening
,
isModalOpen
}
=
useWallet
();
const
{
themedBackground
,
themedBorderColor
,
themedColor
}
=
useMenuButtonColors
();
const
{
themedBackground
,
themedBorderColor
,
themedColor
}
=
useMenuButtonColors
();
const
[
isPopoverOpen
,
setIsPopoverOpen
]
=
useBoolean
(
false
);
const
[
isPopoverOpen
,
setIsPopoverOpen
]
=
useBoolean
(
false
);
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
React
.
useEffect
(()
=>
{
const
wasShown
=
window
.
localStorage
.
getItem
(
'
wallet-connect-tooltip-shown
'
);
if
(
!
wasShown
)
{
setIsTooltipShown
.
on
();
window
.
localStorage
.
setItem
(
'
wallet-connect-tooltip-shown
'
,
'
true
'
);
}
},
[
setIsTooltipShown
]);
const
variant
=
React
.
useMemo
(()
=>
{
const
variant
=
React
.
useMemo
(()
=>
{
if
(
isWalletConnected
)
{
if
(
isWalletConnected
)
{
...
@@ -63,16 +55,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -63,16 +55,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
isOpen=
{
isPopoverOpen
}
isOpen=
{
isPopoverOpen
}
onClose=
{
setIsPopoverOpen
.
off
}
onClose=
{
setIsPopoverOpen
.
off
}
>
>
<
Tooltip
<
WalletTooltip
isDisabled=
{
isWalletConnected
}
>
label=
{
<
span
>
Your wallet is used to interact with
<
br
/>
apps and contracts in the explorer
</
span
>
}
textAlign=
"center"
padding=
{
2
}
isDisabled=
{
isWalletConnected
}
openDelay=
{
300
}
isOpen=
{
isTooltipShown
||
undefined
}
onClose=
{
setIsTooltipShown
.
off
}
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
<
Box
ml=
{
2
}
>
<
Box
ml=
{
2
}
>
<
PopoverTrigger
>
<
PopoverTrigger
>
<
Button
<
Button
...
@@ -96,7 +79,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -96,7 +79,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
</
Button
>
</
Button
>
</
PopoverTrigger
>
</
PopoverTrigger
>
</
Box
>
</
Box
>
</
Tooltip
>
</
Wallet
Tooltip
>
{
isWalletConnected
&&
(
{
isWalletConnected
&&
(
<
PopoverContent
w=
"235px"
>
<
PopoverContent
w=
"235px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
...
...
ui/snippets/walletMenu/WalletMenuMobile.tsx
View file @
669f6281
...
@@ -7,6 +7,7 @@ import useWallet from 'ui/snippets/walletMenu/useWallet';
...
@@ -7,6 +7,7 @@ import useWallet from 'ui/snippets/walletMenu/useWallet';
import
WalletMenuContent
from
'
ui/snippets/walletMenu/WalletMenuContent
'
;
import
WalletMenuContent
from
'
ui/snippets/walletMenu/WalletMenuContent
'
;
import
useMenuButtonColors
from
'
../useMenuButtonColors
'
;
import
useMenuButtonColors
from
'
../useMenuButtonColors
'
;
import
WalletTooltip
from
'
./WalletTooltip
'
;
const
WalletMenuMobile
=
()
=>
{
const
WalletMenuMobile
=
()
=>
{
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
...
@@ -15,6 +16,7 @@ const WalletMenuMobile = () => {
...
@@ -15,6 +16,7 @@ const WalletMenuMobile = () => {
return
(
return
(
<>
<>
<
WalletTooltip
isDisabled=
{
isWalletConnected
}
isMobile
>
<
IconButton
<
IconButton
aria
-
label=
"wallet menu"
aria
-
label=
"wallet menu"
icon=
{
isWalletConnected
?
icon=
{
isWalletConnected
?
...
@@ -31,6 +33,7 @@ const WalletMenuMobile = () => {
...
@@ -31,6 +33,7 @@ const WalletMenuMobile = () => {
onClick=
{
isWalletConnected
?
onOpen
:
connect
}
onClick=
{
isWalletConnected
?
onOpen
:
connect
}
isLoading=
{
isModalOpening
||
isModalOpen
}
isLoading=
{
isModalOpening
||
isModalOpen
}
/>
/>
</
WalletTooltip
>
{
isWalletConnected
&&
(
{
isWalletConnected
&&
(
<
Drawer
<
Drawer
isOpen=
{
isOpen
}
isOpen=
{
isOpen
}
...
...
ui/snippets/walletMenu/WalletTooltip.tsx
0 → 100644
View file @
669f6281
import
{
Tooltip
,
useBoolean
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
type
Props
=
{
children
:
React
.
ReactNode
;
isDisabled
?:
boolean
;
isMobile
?:
boolean
;
};
const
WalletTooltip
=
({
children
,
isDisabled
,
isMobile
}:
Props
)
=>
{
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
React
.
useEffect
(()
=>
{
const
key
=
`wallet-connect-tooltip-shown-
${
isMobile
?
'
mobile
'
:
'
desktop
'
}
`
;
const
wasShown
=
window
.
localStorage
.
getItem
(
key
);
if
(
!
wasShown
)
{
setIsTooltipShown
.
on
();
window
.
localStorage
.
setItem
(
key
,
'
true
'
);
}
},
[
setIsTooltipShown
,
isMobile
]);
return
(
<
Tooltip
label=
{
<
span
>
Your wallet is used to interact with
<
br
/>
apps and contracts in the explorer
</
span
>
}
textAlign=
"center"
padding=
{
2
}
isDisabled=
{
isDisabled
}
openDelay=
{
300
}
isOpen=
{
isTooltipShown
||
(
isMobile
?
false
:
undefined
)
}
onClose=
{
setIsTooltipShown
.
off
}
display=
{
isMobile
?
{
base
:
'
flex
'
,
lg
:
'
none
'
}
:
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
{
children
}
</
Tooltip
>
);
};
export
default
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