// ui import { FC } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { useRouter } from "next/router"; import { ChevronDown, PanelRight } from "lucide-react"; import { Breadcrumbs, CustomMenu } from "@plane/ui"; import { BreadcrumbLink } from "@/components/common"; // components import { PROFILE_ADMINS_TAB, PROFILE_VIEWER_TAB } from "@/constants/profile"; import { cn } from "@/helpers/common.helper"; import { useAppTheme, useUser } from "@/hooks/store"; type TUserProfileHeader = { type?: string | undefined; }; export const UserProfileHeader: FC = observer((props) => { const { type = undefined } = props; // router const router = useRouter(); const { workspaceSlug, userId } = router.query; // store hooks const { toggleProfileSidebar, profileSidebarCollapsed } = useAppTheme(); const { membership: { currentWorkspaceRole }, } = useUser(); // derived values const AUTHORIZED_ROLES = [20, 15, 10]; if (!currentWorkspaceRole) return null; const isAuthorized = AUTHORIZED_ROLES.includes(currentWorkspaceRole); const tabsList = isAuthorized ? [...PROFILE_VIEWER_TAB, ...PROFILE_ADMINS_TAB] : PROFILE_VIEWER_TAB; return (
} />
{type}
} customButtonClassName="flex flex-grow justify-center text-custom-text-200 text-sm" closeOnSelect > <> {tabsList.map((tab) => ( {tab.label} ))}
); });