Skip to content

Commit 6e189d5

Browse files
authored
chore: tidying ui (#737)
1 parent 6a670f5 commit 6e189d5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

client/webui/frontend/src/lib/components/navigation/NavigationList.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export const NavigationList: React.FC<NavigationListProps> = ({ items, bottomIte
2121
// When authorization is enabled, show menu with user info and settings/logout
2222
const { configUseAuthorization, configFeatureEnablement } = useConfigContext();
2323
const logoutEnabled = configUseAuthorization && configFeatureEnablement?.logout ? true : false;
24+
2425
const { userInfo, logout } = useAuthContext();
26+
const userName = typeof userInfo?.username === "string" ? userInfo.username : "Guest";
2527

2628
const handleSettingsClick = () => {
2729
setMenuOpen(false);
2830
setSettingsDialogOpen(true);
2931
};
30-
const handleLogoutClick = () => {
32+
const handleLogoutClick = async () => {
3133
setMenuOpen(false);
32-
logout();
34+
await logout();
3335
};
3436

3537
return (
@@ -76,8 +78,10 @@ export const NavigationList: React.FC<NavigationListProps> = ({ items, bottomIte
7678
</Tooltip>
7779
<PopoverContent side="right" align="end" className="w-60 p-0">
7880
<div className="flex items-center gap-2 border-b px-3 py-4">
79-
<User className="size-4" />
80-
<span className="text-sm font-medium">{typeof userInfo?.username === "string" ? userInfo.username : "Guest"}</span>
81+
<User className="size-4 shrink-0" />
82+
<div className="min-w-0 truncate text-sm font-medium" title={userName}>
83+
{userName}
84+
</div>
8185
</div>
8286
<Menu
8387
actions={[

client/webui/frontend/src/stories/SettingsDialog.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const meta = {
4747
},
4848
},
4949
authContext: {
50-
userInfo: { username: "Story Username" },
50+
userInfo: { username: "Story Username With a Very Long Name" },
5151
},
5252
},
5353
decorators: [
@@ -191,7 +191,7 @@ export const Logout = {
191191
await within(document.body).findByRole("menuitem", { name: "Settings" });
192192

193193
// Verify user name and logout menu item
194-
await within(document.body).findByText("Story Username");
194+
await within(document.body).findByText(/Story Username/i);
195195
const logoutButton = await within(document.body).findByRole("menuitem", { name: "Log Out" });
196196
await expect(logoutButton).toBeInTheDocument();
197197
},

0 commit comments

Comments
 (0)