import { observer } from "mobx-react-lite"; // hooks import { useApplication, useProject, useUser } from "hooks/store"; // components import { ProjectCard } from "components/project"; import { Loader } from "@plane/ui"; // images import emptyProject from "public/empty-state/empty_project.webp"; // icons import { NewEmptyState } from "components/common/new-empty-state"; // constants import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectCardList = observer(() => { // store hooks const { commandPalette: commandPaletteStore, eventTracker: { setTrackElement }, } = useApplication(); const { membership: { currentWorkspaceRole }, } = useUser(); const { workspaceProjectIds, searchedProjects, getProjectById } = useProject(); const isEditingAllowed = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; if (!workspaceProjectIds) return ( ); return ( <> {workspaceProjectIds.length > 0 ? (
{searchedProjects.length == 0 ? (
No matching projects
) : (
{searchedProjects.map((projectId) => { const projectDetails = getProjectById(projectId); if (!projectDetails) return; return ; })}
)}
) : ( { setTrackElement("PROJECTS_EMPTY_STATE"); commandPaletteStore.toggleCreateProjectModal(true); }, }} disabled={!isEditingAllowed} /> )} ); });