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
82cc270e
Commit
82cc270e
authored
Dec 20, 2023
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new text for wallet button tooltip
parent
0f257b42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
WalletTooltip.tsx
ui/snippets/walletMenu/WalletTooltip.tsx
+17
-5
No files found.
ui/snippets/walletMenu/WalletTooltip.tsx
View file @
82cc270e
import
{
Tooltip
,
useBoolean
}
from
'
@chakra-ui/react
'
;
import
{
Tooltip
,
useBoolean
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
type
Props
=
{
type
Props
=
{
...
@@ -8,20 +9,31 @@ type Props = {
...
@@ -8,20 +9,31 @@ type Props = {
};
};
const
WalletTooltip
=
({
children
,
isDisabled
,
isMobile
}:
Props
)
=>
{
const
WalletTooltip
=
({
children
,
isDisabled
,
isMobile
}:
Props
)
=>
{
const
router
=
useRouter
();
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
const
[
isTooltipShown
,
setIsTooltipShown
]
=
useBoolean
(
false
);
const
{
defaultLabel
,
label
,
localStorageKey
}
=
React
.
useMemo
(()
=>
{
const
isAppPage
=
router
.
pathname
===
'
/apps/[id]
'
;
const
defaultLabel
=
<
span
>
Your wallet is used to interact with
<
br
/>
apps and contracts in the explorer
</
span
>;
const
label
=
isAppPage
?
<
span
>
Connect once to use your wallet with
<
br
/>
all apps in the DAppscout marketplace!
</
span
>
:
defaultLabel
;
const
localStorageKey
=
`
${
isAppPage
?
'
dapp-
'
:
''
}
wallet-connect-tooltip-shown-
${
isMobile
?
'
mobile
'
:
'
desktop
'
}
`
;
return
{
defaultLabel
,
label
,
localStorageKey
};
},
[
router
.
pathname
,
isMobile
]);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
key
=
`wallet-connect-tooltip-shown-
${
isMobile
?
'
mobile
'
:
'
desktop
'
}
`
;
const
wasShown
=
window
.
localStorage
.
getItem
(
localStorageKey
);
const
wasShown
=
window
.
localStorage
.
getItem
(
key
);
if
(
!
wasShown
)
{
if
(
!
wasShown
)
{
setIsTooltipShown
.
on
();
setIsTooltipShown
.
on
();
window
.
localStorage
.
setItem
(
key
,
'
true
'
);
window
.
localStorage
.
setItem
(
localStorageKey
,
'
true
'
);
setTimeout
(()
=>
setIsTooltipShown
.
off
(),
3000
);
}
}
},
[
setIsTooltipShown
,
isMobile
]);
},
[
setIsTooltipShown
,
localStorageKey
]);
return
(
return
(
<
Tooltip
<
Tooltip
label=
{
<
span
>
Your wallet is used to interact with
<
br
/>
apps and contracts in the explorer
</
span
>
}
label=
{
isTooltipShown
?
label
:
defaultLabel
}
textAlign=
"center"
textAlign=
"center"
padding=
{
2
}
padding=
{
2
}
isDisabled=
{
isDisabled
}
isDisabled=
{
isDisabled
}
...
...
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