fix(ui): profile page directive + avatar dropdown links/fallbacks

This commit is contained in:
Gabriel Brown
2026-07-11 17:32:49 -04:00
parent d873c8eaf7
commit cc241c8bbf
3 changed files with 107 additions and 5 deletions
@@ -1,5 +1,3 @@
'use server';
import {
AvatarUpload,
ProfileHeader,
@@ -29,6 +29,10 @@ export const AvatarDropdown = () => {
user?.image && !remoteImageUrl ? { storageId: user.image } : 'skip',
);
const avatarUrl = remoteImageUrl ?? currentImageUrl;
// Empty/whitespace names must fall through to the email, so intentionally
// treat a blank string as "no name" (nullish coalescing would keep it).
const trimmedName = user?.name?.trim();
const displayName = trimmedName?.length ? trimmedName : user?.email?.trim();
if (isLoading) {
return (
@@ -61,16 +65,16 @@ export const AvatarDropdown = () => {
/>
</DropdownMenuTrigger>
<DropdownMenuContent align='end'>
{(user?.name ?? user?.email) && (
{displayName && (
<>
<DropdownMenuLabel className='text-center font-bold'>
{user.name?.trim() ?? user.email?.trim()}
{displayName}
</DropdownMenuLabel>
<DropdownMenuSeparator />
</>
)}
<DropdownMenuItem asChild>
<Link href='/profile' className='w-full cursor-pointer'>
<Link href='/settings/profile' className='w-full cursor-pointer'>
Edit Profile
</Link>
</DropdownMenuItem>