2025-05-17 19:12:01 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
BellIcon,
|
|
|
|
|
CreditCardIcon,
|
|
|
|
|
LogOutIcon,
|
|
|
|
|
MoreVerticalIcon,
|
|
|
|
|
UserCircleIcon,
|
|
|
|
|
} from "lucide-react";
|
|
|
|
|
|
|
|
|
|
import { Avatar, AvatarFallback, AvatarImage } from "@repo/shadcn-ui/components/avatar";
|
|
|
|
|
import {
|
|
|
|
|
DropdownMenu,
|
|
|
|
|
DropdownMenuContent,
|
|
|
|
|
DropdownMenuGroup,
|
|
|
|
|
DropdownMenuItem,
|
|
|
|
|
DropdownMenuLabel,
|
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
|
} from "@repo/shadcn-ui/components/dropdown-menu";
|
|
|
|
|
import {
|
|
|
|
|
SidebarMenu,
|
|
|
|
|
SidebarMenuButton,
|
|
|
|
|
SidebarMenuItem,
|
|
|
|
|
useSidebar,
|
|
|
|
|
} from "@repo/shadcn-ui/components/sidebar";
|
|
|
|
|
|
|
|
|
|
export function NavUser({
|
|
|
|
|
user,
|
|
|
|
|
}: {
|
|
|
|
|
user: {
|
|
|
|
|
name: string;
|
|
|
|
|
email: string;
|
|
|
|
|
avatar: string;
|
|
|
|
|
};
|
|
|
|
|
}) {
|
|
|
|
|
const { isMobile } = useSidebar();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SidebarMenu>
|
|
|
|
|
<SidebarMenuItem>
|
|
|
|
|
<DropdownMenu>
|
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
|
<SidebarMenuButton
|
|
|
|
|
size='lg'
|
|
|
|
|
className='data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground'
|
|
|
|
|
>
|
2025-10-12 18:36:33 +00:00
|
|
|
<Avatar className='size-8 rounded-lg grayscale'>
|
2025-05-17 19:12:01 +00:00
|
|
|
<AvatarImage src={user.avatar} alt={user.name} />
|
|
|
|
|
<AvatarFallback className='rounded-lg'>CN</AvatarFallback>
|
|
|
|
|
</Avatar>
|
|
|
|
|
<div className='grid flex-1 text-left text-sm leading-tight'>
|
|
|
|
|
<span className='truncate font-medium'>{user.name}</span>
|
|
|
|
|
<span className='truncate text-xs text-muted-foreground'>{user.email}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<MoreVerticalIcon className='ml-auto size-4' />
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
|
<DropdownMenuContent
|
|
|
|
|
className='w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg'
|
|
|
|
|
side={isMobile ? "bottom" : "right"}
|
|
|
|
|
align='end'
|
|
|
|
|
sideOffset={4}
|
|
|
|
|
>
|
|
|
|
|
<DropdownMenuLabel className='p-0 font-normal'>
|
|
|
|
|
<div className='flex items-center gap-2 px-1 py-1.5 text-left text-sm'>
|
2025-10-12 18:36:33 +00:00
|
|
|
<Avatar className='size-8 rounded-lg'>
|
2025-05-17 19:12:01 +00:00
|
|
|
<AvatarImage src={user.avatar} alt={user.name} />
|
|
|
|
|
<AvatarFallback className='rounded-lg'>CN</AvatarFallback>
|
|
|
|
|
</Avatar>
|
|
|
|
|
<div className='grid flex-1 text-left text-sm leading-tight'>
|
|
|
|
|
<span className='truncate font-medium'>{user.name}</span>
|
|
|
|
|
<span className='truncate text-xs text-muted-foreground'>{user.email}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</DropdownMenuLabel>
|
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
|
<DropdownMenuGroup>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<UserCircleIcon />
|
|
|
|
|
Account
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<CreditCardIcon />
|
|
|
|
|
Billing
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<BellIcon />
|
|
|
|
|
Notifications
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</DropdownMenuGroup>
|
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<LogOutIcon />
|
|
|
|
|
Log out
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</DropdownMenuContent>
|
|
|
|
|
</DropdownMenu>
|
|
|
|
|
</SidebarMenuItem>
|
|
|
|
|
</SidebarMenu>
|
|
|
|
|
);
|
|
|
|
|
}
|