import { FC, useState } from "react"; import { observer } from "mobx-react"; import { ChevronDown } from "lucide-react"; import { Menu, Transition } from "@headlessui/react"; // ui import { Avatar } from "@plane/ui"; // helpers import { cn } from "@/helpers/common.helper"; // hooks import { useUser } from "@/hooks/store"; // components import { SwitchAccountModal } from "./switch-account-modal"; type TSwitchAccountDropdownProps = { fullName?: string; }; export const SwitchAccountDropdown: FC = observer((props) => { const { fullName } = props; // states const [showSwitchAccountModal, setShowSwitchAccountModal] = useState(false); // store hooks const { data: user } = useUser(); const displayName = user?.first_name ? `${user?.first_name} ${user?.last_name ?? ""}` : fullName && fullName.trim().length > 0 ? fullName : user?.email; return (
setShowSwitchAccountModal(false)} />
{user?.avatar && ( )} {displayName} cn("text-red-500 px-1 py-1.5 whitespace-nowrap text-left rounded w-full", { "bg-custom-background-80": active, }) } onClick={() => setShowSwitchAccountModal(true)} > Wrong e-mail address?
); });