diff --git a/src/widgets/header/ui/MobileSideMenu.tsx b/src/widgets/header/ui/MobileSideMenu.tsx index 911654d4..0b5eddbf 100644 --- a/src/widgets/header/ui/MobileSideMenu.tsx +++ b/src/widgets/header/ui/MobileSideMenu.tsx @@ -1,8 +1,11 @@ "use client"; +import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; import Link from "next/link"; - import DeleteIcon from "@/shared/images/delete.svg"; +import { useAuthStore } from "@/features/auth/model/auth.store"; +import cn from "@/shared/lib/cn"; export default function MobileSideMenu({ onClose, @@ -15,61 +18,126 @@ export default function MobileSideMenu({ chatId?: number; }) => void; }) { + const router = useRouter(); + const { isLogined, logout } = useAuthStore(); + const [isVisible, setIsVisible] = useState(false); + + useEffect(() => { + const timer = requestAnimationFrame(() => setIsVisible(true)); + return () => cancelAnimationFrame(timer); + }, []); + + const handleClose = () => { + setIsVisible(false); + }; + + const handleTransitionEnd = (e: React.TransitionEvent) => { + if (e.propertyName !== "opacity") return; + if (!isVisible) onClose(); + }; + const handleOpenChat = () => { onOpenChat(); - onClose(); + handleClose(); }; return (
+