36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
'use client'
|
|
|
|
import { useCurrentUser } from '@/hooks/useCurrentUser'
|
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
|
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
import { FaUser } from 'react-icons/fa6'
|
|
import { IoExitOutline } from 'react-icons/io5'
|
|
import LogoutButton from '@/components/auth/logout-button'
|
|
|
|
const UserButton = () => {
|
|
const user = useCurrentUser()
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger>
|
|
<Avatar>
|
|
<AvatarImage src={user?.image || ''} alt="User Avatar"/>
|
|
<AvatarFallback className="bg-sky-400">
|
|
<FaUser className="text-muted"/>
|
|
</AvatarFallback>
|
|
</Avatar>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent className="w-40" align="end">
|
|
<LogoutButton>
|
|
<DropdownMenuItem className="cursor-pointer">
|
|
<IoExitOutline className="w-4 h-4 mr-2"/>
|
|
Logout
|
|
</DropdownMenuItem>
|
|
</LogoutButton>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|
|
|
|
export default UserButton
|