import { Fragment } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { Menu, Transition } from "@headlessui/react"; import { LogOut, Settings, Shield, UserCircle2 } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // hooks import useToast from "hooks/use-toast"; // services import { AuthService } from "services/auth.service"; // ui import { Avatar } from "@plane/ui"; // Static Data const profileLinks = (workspaceSlug: string, userId: string) => [ { name: "View profile", icon: UserCircle2, link: `/${workspaceSlug}/profile/${userId}`, }, { name: "Settings", icon: Settings, link: `/${workspaceSlug}/me/profile`, }, ]; const authService = new AuthService(); export const InstanceSidebarDropdown = observer(() => { const router = useRouter(); // store const { theme: { sidebarCollapsed }, workspace: { workspaceSlug }, user: { currentUser, currentUserSettings }, } = useMobxStore(); // hooks const { setToastAlert } = useToast(); // redirect url for normal mode const redirectWorkspaceSlug = workspaceSlug || currentUserSettings?.workspace?.last_workspace_slug || currentUserSettings?.workspace?.fallback_workspace_slug || ""; const handleSignOut = async () => { await authService .signOut() .then(() => { router.push("/"); }) .catch(() => setToastAlert({ type: "error", title: "Error!", message: "Failed to sign out. Please try again.", }) ); }; return (
{!sidebarCollapsed && (

Instance Admin Settings

)}
{!sidebarCollapsed && (
{currentUser?.email} {profileLinks(workspaceSlug?.toString() ?? "", currentUser?.id ?? "").map((link, index) => ( {link.name} ))}
Sign out
Normal Mode
)}
); });