import { observer } from "mobx-react"; import Link from "next/link"; import { useParams, usePathname } from "next/navigation"; import { cn } from "@plane/utils"; import { useProject } from "@/hooks/store/use-project"; const TABS = { account: { key: "account", label: "Account", href: `/settings/account/`, }, workspace: { key: "workspace", label: "Workspace", href: `/settings/`, }, projects: { key: "projects", label: "Projects", href: `/settings/projects/`, }, }; const SettingsTabs = observer(() => { // router const pathname = usePathname(); const { workspaceSlug } = useParams(); // store hooks const { joinedProjectIds } = useProject(); const currentTab = pathname.includes(TABS.projects.href) ? TABS.projects : pathname.includes(TABS.account.href) ? TABS.account : TABS.workspace; return (
{Object.values(TABS).map((tab) => { const isActive = currentTab?.key === tab.key; const href = tab.key === TABS.projects.key ? `${tab.href}${joinedProjectIds[0] || ""}` : tab.href; return (
{tab.label}
); })}
); }); export default SettingsTabs;