import { FC, useCallback } from "react"; import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; import { List, Plus } from "lucide-react"; // hooks // ui import { Breadcrumbs, Button, ContrastIcon, CustomMenu } from "@plane/ui"; // helpers // components import { BreadcrumbLink } from "components/common"; import { SidebarHamburgerToggle } from "components/core/sidebar/sidebar-menu-hamburger-toggle"; import { CYCLE_VIEW_LAYOUTS } from "constants/cycle"; import { EUserProjectRoles } from "constants/project"; import { useApplication, useEventTracker, useProject, useUser } from "hooks/store"; import useLocalStorage from "hooks/use-local-storage"; import { TCycleLayoutOptions } from "@plane/types"; import { ProjectLogo } from "components/project"; export const CyclesHeader: FC = observer(() => { // router const router = useRouter(); const { workspaceSlug } = router.query; // store hooks const { commandPalette: { toggleCreateCycleModal }, } = useApplication(); const { setTrackElement } = useEventTracker(); const { membership: { currentProjectRole }, } = useUser(); const { currentProjectDetails } = useProject(); const canUserCreateCycle = currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); const { setValue: setCycleLayout } = useLocalStorage("cycle_layout", "list"); const handleCurrentLayout = useCallback( (_layout: TCycleLayoutOptions) => { setCycleLayout(_layout); }, [setCycleLayout] ); return (
) } /> } /> } /> } />
{canUserCreateCycle && (
)}
Layout } customButtonClassName="flex flex-grow justify-center items-center text-custom-text-200 text-sm" closeOnSelect > {CYCLE_VIEW_LAYOUTS.map((layout) => ( { // handleLayoutChange(ISSUE_LAYOUTS[index].key); handleCurrentLayout(layout.key as TCycleLayoutOptions); }} className="flex items-center gap-2" >
{layout.title}
))}
); });