fix(ui): profile page directive + avatar dropdown links/fallbacks
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user