Skip to content

Commit

Permalink
fix(ui): if name is empty (#2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne authored May 29, 2024
1 parent c075541 commit 93e47f2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
11 changes: 6 additions & 5 deletions ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default function Activity() {
</SelectItem>
{members.map(member => (
<SelectItem value={member.id} key={member.id}>
{member.name}
{member.name || member.email}
</SelectItem>
))}
</SelectGroup>
Expand Down Expand Up @@ -338,6 +338,10 @@ function ActivityRow({
break
}
}

let displayUser = activity.userId
const user = members.find(user => user.id === activity.userId)
if (user) displayUser = user.name || user.email
return (
<>
<TableRow
Expand All @@ -359,10 +363,7 @@ function ActivityRow({
</TooltipContent>
</Tooltip>
</TableCell>
<TableCell>
{members.find(user => user.id === activity.userId)?.name ||
activity.userId}
</TableCell>
<TableCell>{displayUser}</TableCell>
<TableCell className="pr-4 md:pr-8">
<Tooltip>
<TooltipTrigger>
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-ui/app/(dashboard)/reports/components/report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export function Report() {
<SelectItem value={KEY_SELECT_ALL}>All members</SelectItem>
{members.map(member => (
<SelectItem value={member.id} key={member.id}>
{member.name}
{member.name || member.email}
</SelectItem>
))}
</SelectGroup>
Expand Down
12 changes: 8 additions & 4 deletions ee/tabby-ui/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,14 @@ function MainPanel() {

<div className="mt-2 flex w-full">
<div className="flex flex-col gap-y-1">
<div className="flex items-center gap-2">
<IconUser className="text-muted-foreground" />
<p className="max-w-[10rem] truncate text-sm">{data.me.name}</p>
</div>
{data.me.name && (
<div className="flex items-center gap-2">
<IconUser className="text-muted-foreground" />
<p className="max-w-[10rem] truncate text-sm">
{data.me.name}
</p>
</div>
)}
<div className="flex items-center gap-2">
<IconMail className="text-muted-foreground" />
<p className="max-w-[10rem] truncate text-sm">
Expand Down
15 changes: 11 additions & 4 deletions ee/tabby-ui/components/user-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ export default function UserPanel({
<DropdownMenu>
<DropdownMenuTrigger>{children}</DropdownMenuTrigger>
<DropdownMenuContent collisionPadding={{ right: 16 }}>
<DropdownMenuLabel className="pb-0.5">{user.name}</DropdownMenuLabel>
<DropdownMenuLabel className="pb-1 pt-0 text-sm font-normal text-muted-foreground">
{user.email}
</DropdownMenuLabel>
{user.name && (
<>
<DropdownMenuLabel className="pb-0.5">
{user.name}
</DropdownMenuLabel>
<DropdownMenuLabel className="pb-1 pt-0 text-sm font-normal text-muted-foreground">
{user.email}
</DropdownMenuLabel>
</>
)}
{!user.name && <DropdownMenuLabel>{user.email}</DropdownMenuLabel>}
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => window.open('/')}
Expand Down

0 comments on commit 93e47f2

Please sign in to comment.