Files
plane/web/ee/components/projects/header/root.tsx
Anmol Singh Bhatia 544fe270b1 [WEB-4050] feat: breadcrumbs revamp (#3371)
* chore: project feature enum added

* feat: revamp breadcrumb and add navigation dropdown component

* chore: custom search select component refactoring

* chore: breadcrumb stories added

* chore: switch label and breadcrumb link component refactor

* chore: project navigation helper function added

* chore: common breadcrumb component added

* chore: breadcrumb refactoring

* chore: project constant updated

* chore: ce changes

* chore: ce changes

* chore: breadcrumb revamp ee changes

* fix: route and header layout

* chore: code refactor

* chore: code refactor

* chore: workspace view breadcrumb improvements

* chore: code refactor

* chore: code refactor

* chore: code refactor

* chore: code refactor

* fix: build error
2025-06-19 17:20:18 +05:30

84 lines
3.2 KiB
TypeScript

"use client";
import { observer } from "mobx-react";
import { useParams, usePathname } from "next/navigation";
import { Briefcase } from "lucide-react";
import { Breadcrumbs } from "@plane/ui";
// components
import { BreadcrumbLink } from "@/components/common";
// hooks
import { ProjectsBaseHeader } from "@/components/project/header";
import { useWorkspace } from "@/hooks/store";
// plane web components
import {
ProjectAttributesDropdown,
ProjectCreateButton,
ProjectDisplayFiltersDropdown,
ProjectLayoutSelection,
ProjectScopeDropdown,
ProjectSearch,
} from "@/plane-web/components/projects/";
import { useFlag, useWorkspaceFeatures } from "@/plane-web/hooks/store";
import { EWorkspaceFeatures } from "@/plane-web/types/workspace-feature";
export const ProjectsListHeader = observer(() => {
const { workspaceSlug } = useParams();
// hooks
const { currentWorkspace } = useWorkspace();
const { isWorkspaceFeatureEnabled } = useWorkspaceFeatures();
const pathname = usePathname();
// derived values
const workspaceId = currentWorkspace?.id || undefined;
const isProjectGroupingFlagEnabled = useFlag(workspaceSlug.toString(), "PROJECT_GROUPING");
const isProjectGroupingEnabled =
isWorkspaceFeatureEnabled(EWorkspaceFeatures.IS_PROJECT_GROUPING_ENABLED) && isProjectGroupingFlagEnabled;
const isArchived = pathname.includes("/archives");
if (!workspaceSlug || !workspaceId) return <></>;
return isProjectGroupingEnabled ? (
<div className="flex-shrink-0 relative z-10 flex h-[3.75rem] w-full">
{/* flex-row items-center justify-between gap-x-2 gap-y-4 */}
<div className="w-full h-full relative flex justify-between items-center gap-x-2 gap-y-4">
<div className="flex items-center gap-4 flex-grow">
{/* bread crumps */}
<Breadcrumbs>
<Breadcrumbs.Item
component={
<BreadcrumbLink label="Projects" icon={<Briefcase className="h-4 w-4 text-custom-text-300" />} />
}
/>
{isArchived && <Breadcrumbs.Item component={<BreadcrumbLink label="Archived" />} />}
</Breadcrumbs>
{/* scope dropdown */}
{!isArchived && (
<div className="hidden md:flex gap-4">
<ProjectScopeDropdown workspaceSlug={workspaceSlug.toString()} />
</div>
)}
</div>
<div className="flex items-center gap-4">
{/* search */}
<ProjectSearch />
<div className="hidden md:flex gap-4">
{/* layout selection */}
{!isArchived && <ProjectLayoutSelection workspaceSlug={workspaceSlug.toString()} />}{" "}
{/* attributes dropdown */}
<ProjectAttributesDropdown
workspaceSlug={workspaceSlug.toString()}
workspaceId={workspaceId}
isArchived={isArchived}
/>
{/* display filters dropdown */}
<ProjectDisplayFiltersDropdown workspaceSlug={workspaceSlug.toString()} isArchived={isArchived} />
</div>
{/* create project button */}
{!isArchived && <ProjectCreateButton />}
</div>
</div>
</div>
) : (
<ProjectsBaseHeader />
);
});