"use client" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { MAX_FREE_GENERATION } from "@/lib/constant" import { User } from "@/lib/types" import { useClerk } from "@clerk/nextjs" import { LayoutDashboard, LogOut, Sparkles, User as UserIcon, } from "lucide-react" import Link from "next/link" import { useRouter } from "next/navigation" import Avatar from "./avatar" export default function UserButton({ userData }: { userData: User }) { if (!userData) return null const { signOut } = useClerk() const router = useRouter() return (
{userData.name}
{userData.email}
{`AI Usage: ${userData.generations}/${MAX_FREE_GENERATION}`}
Dashboard Profile {/* Edit Profile */} signOut(() => router.push("/"))} className="!text-destructive cursor-pointer" > Log Out ) }