import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; // icons import { GanttChartSquare, LayoutGrid, List, Plus } from "lucide-react"; // ui import { Breadcrumbs, Button, Tooltip, DiceIcon, CustomMenu } from "@plane/ui"; // components import { BreadcrumbLink } from "components/common"; import { SidebarHamburgerToggle } from "components/core/sidebar/sidebar-menu-hamburger-toggle"; // constants import { MODULE_VIEW_LAYOUTS } from "constants/module"; import { EUserProjectRoles } from "constants/project"; // helper import { renderEmoji } from "helpers/emoji.helper"; // hooks import { useApplication, useEventTracker, useProject, useUser } from "hooks/store"; import useLocalStorage from "hooks/use-local-storage"; export const ModulesListHeader: React.FC = observer(() => { // router const router = useRouter(); const { workspaceSlug } = router.query; // store hooks const { commandPalette: commandPaletteStore } = useApplication(); const { setTrackElement } = useEventTracker(); const { membership: { currentProjectRole }, } = useUser(); const { currentProjectDetails } = useProject(); const { storedValue: modulesView, setValue: setModulesView } = useLocalStorage("modules_view", "grid"); const canUserCreateModule = currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); return (
{currentProjectDetails?.name.charAt(0)} ) } /> } /> } />} />
{MODULE_VIEW_LAYOUTS.map((layout) => ( ))}
{canUserCreateModule && ( )}
{modulesView === "gantt_chart" ? ( ) : modulesView === "grid" ? ( ) : ( )} Layout } customButtonClassName="flex flex-grow justify-center items-center text-custom-text-200 text-sm" closeOnSelect > {MODULE_VIEW_LAYOUTS.map((layout) => ( setModulesView(layout.key)} className="flex items-center gap-2" >
{layout.title}
))}
); });