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
4e306451
Commit
4e306451
authored
Nov 09, 2023
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tooltip for profile menu button
parent
06a05bb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
Home.tsx
ui/pages/Home.tsx
+1
-1
ProfileMenuDesktop.tsx
ui/snippets/profileMenu/ProfileMenuDesktop.tsx
+26
-16
No files found.
ui/pages/Home.tsx
View file @
4e306451
...
@@ -33,7 +33,7 @@ const Home = () => {
...
@@ -33,7 +33,7 @@ const Home = () => {
>
>
Welcome to
{
config
.
chain
.
name
}
explorer
Welcome to
{
config
.
chain
.
name
}
explorer
</
Heading
>
</
Heading
>
<
Box
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
>
<
Box
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
{
config
.
features
.
account
.
isEnabled
&&
<
ProfileMenuDesktop
isHomePage
/>
}
{
config
.
features
.
account
.
isEnabled
&&
<
ProfileMenuDesktop
isHomePage
/>
}
<
WalletMenuDesktop
isHomePage
/>
<
WalletMenuDesktop
isHomePage
/>
</
Box
>
</
Box
>
...
...
ui/snippets/profileMenu/ProfileMenuDesktop.tsx
View file @
4e306451
import
type
{
IconButtonProps
}
from
'
@chakra-ui/react
'
;
import
type
{
IconButtonProps
}
from
'
@chakra-ui/react
'
;
import
{
Popover
,
PopoverContent
,
PopoverBody
,
PopoverTrigger
,
IconButton
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Popover
,
PopoverContent
,
PopoverBody
,
PopoverTrigger
,
IconButton
,
useColorModeValue
,
Tooltip
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useFetchProfileInfo
from
'
lib/hooks/useFetchProfileInfo
'
;
import
useFetchProfileInfo
from
'
lib/hooks/useFetchProfileInfo
'
;
...
@@ -44,17 +44,17 @@ const ProfileMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -44,17 +44,17 @@ const ProfileMenuDesktop = ({ isHomePage }: Props) => {
})();
})();
const
variant
=
React
.
useMemo
(()
=>
{
const
variant
=
React
.
useMemo
(()
=>
{
if
(
data
?.
avatar
)
{
if
(
hasMenu
)
{
return
'
subtle
'
;
return
'
subtle
'
;
}
}
return
isHomePage
?
'
solid
'
:
'
outline
'
;
return
isHomePage
?
'
solid
'
:
'
outline
'
;
},
[
data
?.
avatar
,
isHomePage
]);
},
[
hasMenu
,
isHomePage
]);
let
iconButtonStyles
:
Partial
<
IconButtonProps
>
=
{};
let
iconButtonStyles
:
Partial
<
IconButtonProps
>
=
{};
const
themedBackground
=
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
);
const
themedBackground
=
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
);
const
themedBorderColor
=
useColorModeValue
(
'
gray.300
'
,
'
gray.700
'
);
const
themedBorderColor
=
useColorModeValue
(
'
gray.300
'
,
'
gray.700
'
);
const
themedColor
=
useColorModeValue
(
'
blackAlpha.800
'
,
'
gray.400
'
);
const
themedColor
=
useColorModeValue
(
'
blackAlpha.800
'
,
'
gray.400
'
);
if
(
data
?.
avatar
)
{
if
(
hasMenu
)
{
iconButtonStyles
=
{
iconButtonStyles
=
{
bg
:
isHomePage
?
'
#EBF8FF
'
:
themedBackground
,
bg
:
isHomePage
?
'
#EBF8FF
'
:
themedBackground
,
};
};
...
@@ -71,18 +71,28 @@ const ProfileMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -71,18 +71,28 @@ const ProfileMenuDesktop = ({ isHomePage }: Props) => {
return
(
return
(
<
Popover
openDelay=
{
300
}
placement=
"bottom-end"
gutter=
{
10
}
isLazy
>
<
Popover
openDelay=
{
300
}
placement=
"bottom-end"
gutter=
{
10
}
isLazy
>
<
PopoverTrigger
>
<
Tooltip
<
IconButton
label=
{
<
span
>
Sign in to My Account to add tags,
<
br
/>
create watchlists, access API keys and more
</
span
>
}
aria
-
label=
"profile menu"
textAlign=
"center"
icon=
{
<
UserAvatar
size=
{
20
}
/>
}
padding=
{
2
}
variant=
{
variant
}
isDisabled=
{
hasMenu
}
colorScheme=
"blue"
openDelay=
{
300
}
boxSize=
"40px"
>
flexShrink=
{
0
}
<
Box
>
{
...
iconButtonProps
}
<
PopoverTrigger
>
{
...
iconButtonStyles
}
<
IconButton
/>
aria
-
label=
"profile menu"
</
PopoverTrigger
>
icon=
{
<
UserAvatar
size=
{
20
}
/>
}
variant=
{
variant
}
colorScheme=
"blue"
boxSize=
"40px"
flexShrink=
{
0
}
{
...
iconButtonProps
}
{
...
iconButtonStyles
}
/>
</
PopoverTrigger
>
</
Box
>
</
Tooltip
>
{
hasMenu
&&
(
{
hasMenu
&&
(
<
PopoverContent
w=
"212px"
>
<
PopoverContent
w=
"212px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
...
...
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