"use client" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { User } from "@/lib/types" import { useClerk } from "@clerk/nextjs" import { LogOut, Pencil } from "lucide-react" import { useRouter } from "next/navigation" export default function UserButton({ userData }: { userData: User }) { if (!userData) return null const { signOut } = useClerk() const router = useRouter() return (
{userData.name .split(" ") .slice(0, 2) .map((name) => name[0].toUpperCase())}
Edit Profile {/* open modal with name and email (disabled) */} signOut(() => router.push("/"))} className="!text-destructive cursor-pointer" > Log Out
) }