import { Fragment } from "react"; import { useRouter } from "next/navigation"; import { useTheme } from "next-themes"; import { observer } from "mobx-react-lite"; import { mutate } from "swr"; // components import { Menu, Transition } from "@headlessui/react"; // icons import { LogOut, UserCog2, Palette } from "lucide-react"; // hooks import { useAppTheme } from "hooks/use-theme"; import useToast from "hooks/use-toast"; import useUser from "hooks/use-user"; // ui import { Avatar } from "@plane/ui"; export const SidebarDropdown = observer(() => { // router const router = useRouter(); // store hooks const { sidebarCollapsed } = useAppTheme(); const { signOut, currentUser } = useUser(); // hooks const { setToastAlert } = useToast(); const { resolvedTheme, setTheme } = useTheme(); const handleSignOut = async () => { await signOut() .then(() => { mutate("CURRENT_USER_DETAILS", null); setTheme("system"); router.push("/"); }) .catch(() => setToastAlert({ type: "error", title: "Error!", message: "Failed to sign out. Please try again.", }) ); }; const handleThemeSwitch = () => { const newTheme = resolvedTheme === "dark" ? "light" : "dark"; setTheme(newTheme); }; return (