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
3dd86083
Commit
3dd86083
authored
May 03, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix user profile menu
parent
b970f662
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
24 deletions
+15
-24
NavLink.tsx
ui/snippets/navigation/NavLink.tsx
+3
-2
ProfileMenuContent.tsx
ui/snippets/profileMenu/ProfileMenuContent.tsx
+10
-20
ProfileMenuDesktop.tsx
ui/snippets/profileMenu/ProfileMenuDesktop.tsx
+1
-1
ProfileMenuMobile.tsx
ui/snippets/profileMenu/ProfileMenuMobile.tsx
+1
-1
No files found.
ui/snippets/navigation/NavLink.tsx
View file @
3dd86083
...
@@ -20,16 +20,17 @@ type Props = {
...
@@ -20,16 +20,17 @@ type Props = {
px
?:
string
|
number
;
px
?:
string
|
number
;
className
?:
string
;
className
?:
string
;
onClick
?:
()
=>
void
;
onClick
?:
()
=>
void
;
disableActiveState
?:
boolean
;
}
}
const
NavLink
=
({
item
,
isCollapsed
,
px
,
className
,
onClick
}:
Props
)
=>
{
const
NavLink
=
({
item
,
isCollapsed
,
px
,
className
,
onClick
,
disableActiveState
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
colors
=
useColors
();
const
colors
=
useColors
();
const
isExpanded
=
isCollapsed
===
false
;
const
isExpanded
=
isCollapsed
===
false
;
const
isInternalLink
=
isInternalItem
(
item
);
const
isInternalLink
=
isInternalItem
(
item
);
const
styleProps
=
useNavLinkStyleProps
({
isCollapsed
,
isExpanded
,
isActive
:
isInternalLink
&&
item
.
isActive
});
const
styleProps
=
useNavLinkStyleProps
({
isCollapsed
,
isExpanded
,
isActive
:
isInternalLink
&&
item
.
isActive
&&
!
disableActiveState
});
const
isXLScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
isXLScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
href
=
isInternalLink
?
route
(
item
.
nextRoute
)
:
item
.
url
;
const
href
=
isInternalLink
?
route
(
item
.
nextRoute
)
:
item
.
url
;
...
...
ui/snippets/profileMenu/ProfileMenuContent.tsx
View file @
3dd86083
import
{
Box
,
Button
,
Text
,
VStack
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Button
,
VStack
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
UserInfo
}
from
'
types/api/account
'
;
import
type
{
UserInfo
}
from
'
types/api/account
'
;
...
@@ -18,7 +18,6 @@ type Props = {
...
@@ -18,7 +18,6 @@ type Props = {
const
ProfileMenuContent
=
({
data
,
onNavLinkClick
}:
Props
)
=>
{
const
ProfileMenuContent
=
({
data
,
onNavLinkClick
}:
Props
)
=>
{
const
{
accountNavItems
,
profileItem
}
=
useNavItems
();
const
{
accountNavItems
,
profileItem
}
=
useNavItems
();
const
primaryTextColor
=
useColorModeValue
(
'
blackAlpha.800
'
,
'
whiteAlpha.800
'
);
const
handleSingOutClick
=
React
.
useCallback
(()
=>
{
const
handleSingOutClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
logEvent
(
...
@@ -32,37 +31,28 @@ const ProfileMenuContent = ({ data, onNavLinkClick }: Props) => {
...
@@ -32,37 +31,28 @@ const ProfileMenuContent = ({ data, onNavLinkClick }: Props) => {
return
null
;
return
null
;
}
}
const
userName
=
data
?.
email
||
data
?.
nickname
||
data
?.
name
;
return
(
return
(
<
Box
>
<
Box
>
{
(
data
?.
name
||
data
?.
nickname
)
&&
(
{
userName
&&
(
<
Text
<
Box
fontSize=
"sm"
fontSize=
"sm"
fontWeight=
{
500
}
fontWeight=
{
500
}
color=
{
primaryTextColor
}
{
...
getDefaultTransitionProps
()
}
>
Signed in as
{
data
.
name
||
data
.
nickname
}
</
Text
>
)
}
{
data
?.
email
&&
(
<
Text
fontSize=
"sm"
mb=
{
1
}
mb=
{
1
}
fontWeight=
{
500
}
color=
"gray.500"
{
...
getDefaultTransitionProps
()
}
>
>
{
data
.
email
}
<
span
>
Signed in as
</
span
>
</
Text
>
<
chakra
.
span
color=
"text_secondary"
>
{
userName
}
</
chakra
.
span
>
</
Box
>
)
}
)
}
<
NavLink
item=
{
profileItem
}
isActive=
{
undefined
}
px=
"0px"
isCollapsed=
{
false
}
onClick=
{
onNavLinkClick
}
/>
<
NavLink
item=
{
profileItem
}
disableActiveState=
{
true
}
px=
"0px"
isCollapsed=
{
false
}
onClick=
{
onNavLinkClick
}
/>
<
Box
as=
"nav"
mt=
{
2
}
pt=
{
2
}
borderTopColor=
"divider"
borderTopWidth=
"1px"
{
...
getDefaultTransitionProps
()
}
>
<
Box
as=
"nav"
mt=
{
2
}
pt=
{
2
}
borderTopColor=
"divider"
borderTopWidth=
"1px"
{
...
getDefaultTransitionProps
()
}
>
<
VStack
as=
"ul"
spacing=
"0"
alignItems=
"flex-start"
overflow=
"hidden"
>
<
VStack
as=
"ul"
spacing=
"0"
alignItems=
"flex-start"
overflow=
"hidden"
>
{
accountNavItems
.
map
((
item
)
=>
(
{
accountNavItems
.
map
((
item
)
=>
(
<
NavLink
<
NavLink
key=
{
item
.
text
}
key=
{
item
.
text
}
item=
{
item
}
item=
{
item
}
isActive=
{
undefined
}
disableActiveState=
{
true
}
isCollapsed=
{
false
}
isCollapsed=
{
false
}
px=
"0px"
px=
"0px"
onClick=
{
onNavLinkClick
}
onClick=
{
onNavLinkClick
}
...
...
ui/snippets/profileMenu/ProfileMenuDesktop.tsx
View file @
3dd86083
...
@@ -97,7 +97,7 @@ const ProfileMenuDesktop = ({ isHomePage, className, fallbackIconSize }: Props)
...
@@ -97,7 +97,7 @@ const ProfileMenuDesktop = ({ isHomePage, className, fallbackIconSize }: Props)
</
Box
>
</
Box
>
</
Tooltip
>
</
Tooltip
>
{
hasMenu
&&
(
{
hasMenu
&&
(
<
PopoverContent
w=
"212px
"
>
<
PopoverContent
maxW=
"400px"
minW=
"220px"
w=
"min-content
"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
PopoverBody
padding=
"24px 16px 16px 16px"
>
<
ProfileMenuContent
data=
{
data
}
/>
<
ProfileMenuContent
data=
{
data
}
/>
</
PopoverBody
>
</
PopoverBody
>
...
...
ui/snippets/profileMenu/ProfileMenuMobile.tsx
View file @
3dd86083
...
@@ -66,7 +66,7 @@ const ProfileMenuMobile = () => {
...
@@ -66,7 +66,7 @@ const ProfileMenuMobile = () => {
autoFocus=
{
false
}
autoFocus=
{
false
}
>
>
<
DrawerOverlay
/>
<
DrawerOverlay
/>
<
DrawerContent
maxWidth=
"
26
0px"
>
<
DrawerContent
maxWidth=
"
30
0px"
>
<
DrawerBody
p=
{
6
}
>
<
DrawerBody
p=
{
6
}
>
<
ProfileMenuContent
data=
{
data
}
onNavLinkClick=
{
onClose
}
/>
<
ProfileMenuContent
data=
{
data
}
onNavLinkClick=
{
onClose
}
/>
</
DrawerBody
>
</
DrawerBody
>
...
...
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