import { Fragment } from "react"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { useRouter } from "next/router"; import { useTheme } from "next-themes"; import { mutate } from "swr"; // components import { LogIn, LogOut, Settings, UserCog2 } from "lucide-react"; import { Menu, Transition } from "@headlessui/react"; // icons // hooks import { Avatar, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; import { useApplication, useUser } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // ui // Static Data const PROFILE_LINKS = [ { key: "settings", name: "Settings", icon: Settings, link: `/profile`, }, ]; export const InstanceSidebarDropdown = observer(() => { // router const router = useRouter(); // store hooks const { theme: { sidebarCollapsed }, router: { workspaceSlug }, } = useApplication(); const { signOut, currentUser, currentUserSettings } = useUser(); // hooks const { setTheme } = useTheme(); const { isMobile } = usePlatformOS(); // redirect url for normal mode const redirectWorkspaceSlug = workspaceSlug || currentUserSettings?.workspace?.last_workspace_slug || currentUserSettings?.workspace?.fallback_workspace_slug || ""; const handleSignOut = async () => { await signOut() .then(() => { mutate("CURRENT_USER_DETAILS", null); setTheme("system"); router.push("/"); }) .catch(() => setToast({ type: TOAST_TYPE.ERROR, title: "Error!", message: "Failed to sign out. Please try again.", }) ); }; return (
{!sidebarCollapsed && (

Instance admin

)}
{!sidebarCollapsed && (
{currentUser?.email} {PROFILE_LINKS.map((link) => ( {link.name} ))}
Sign out
Exit God Mode
)}
); });