Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Rodolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
Rodolf
Merge requests
!25
feat: display an “account” button at the top right instead of the “logout” button
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat: display an “account” button at the top right instead of the “logout” button
topic/default/logout-menu
into
branch/default
Overview
0
Commits
3
Pipelines
3
Changes
1
Merged
Olivier Giorgis
requested to merge
topic/default/logout-menu
into
branch/default
1 year ago
Overview
0
Commits
3
Pipelines
3
Changes
1
Expand
0
0
Merge request reports
Compare
version 1
version 2
f3a2c0de
1 year ago
version 1
69f008d4
1 year ago
branch/default (base)
and
version 2
latest version
1cac0650
3 commits,
1 year ago
version 2
f3a2c0de
2 commits,
1 year ago
version 1
69f008d4
1 commit,
1 year ago
Show latest version
1 file
+
18
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
frontend/src/components/Header.tsx
+
18
−
3
Options
import
{
useState
}
from
"
react
"
;
import
{
useClient
}
from
"
@/context/ClientContext
"
;
import
{
AppBar
,
Box
,
@@ -9,7 +10,8 @@
Toolbar
,
Typography
,
}
from
"
@mui/material
"
;
import
AccountCircle
from
"
@mui/icons-material/AccountCircle
"
;
import
{
AccountCircle
,
Logout
}
from
"
@mui/icons-material
"
;
import
Link
from
"
next/link
"
;
import
Image
from
"
next/image
"
;
import
{
usePathname
}
from
"
next/navigation
"
;
@@ -20,4 +22,8 @@
const
loggedIn
=
pathname
!==
"
/login
"
;
const
logout
=
useApiLogout
();
const
[
anchorEl
,
setAnchorEl
]
=
useState
<
null
|
HTMLElement
>
(
null
);
const
client
=
useClient
();
const
[
currentUserName
,
setCurrentUserName
]
=
useState
<
string
|
undefined
>
(
undefined
,
);
@@ -23,3 +29,3 @@
const
handleMenu
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
const
handleMenu
=
async
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
setAnchorEl
(
event
.
currentTarget
);
@@ -25,4 +31,6 @@
setAnchorEl
(
event
.
currentTarget
);
const
currentUser
=
await
client
.
currentUser
();
setCurrentUserName
(
currentUser
.
login
);
};
const
handleClose
=
()
=>
{
@@ -82,7 +90,14 @@
open
=
{
Boolean
(
anchorEl
)
}
onClose
=
{
handleClose
}
>
<
MenuItem
onClick
=
{
logout
}
>
Déconnexion
</
MenuItem
>
<
Typography
style
=
{
{
textAlign
:
"
center
"
}
}
>
{
currentUserName
}
</
Typography
>
<
MenuItem
divider
/>
<
MenuItem
onClick
=
{
logout
}
>
<
Logout
fontSize
=
"small"
/>
Déconnexion
</
MenuItem
>
</
Menu
>
</>
)
:
null
}
Loading