import { useEffect, useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import { useAuth } from "@/contexts/AuthContext"; import { Button } from "@/components/ui/button"; import { useToast } from "@/hooks/use-toast"; import { LogIn, LogOut, User } from "lucide-react"; import { useTranslation } from "@/hooks/useTranslation"; export const UserMenu = () => { const { user, signOut } = useAuth(); const navigate = useNavigate(); const { toast } = useToast(); const t = useTranslation(); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); if (!mounted) return null; const handleSignOut = async () => { await signOut(); toast({ title: t.auth.logoutSuccess.title, description: t.auth.logoutSuccess.description, }); navigate("/"); }; return (