"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, Sparkles } 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 && userData.name .split(" ") .slice(0, 2) .map((name) => name[0].toUpperCase())}
{userData.name}
{userData.email}
AI Usage: {userData.generations}/1000
{/* Edit Profile */} signOut(() => router.push("/"))} className="!text-destructive cursor-pointer" > Log Out ); }