import { observer } from "mobx-react-lite"; import { useTheme } from "next-themes"; // hooks import { useApplication, useProject, useUser } from "hooks/store"; // components import { ProjectCard } from "components/project"; import { Loader } from "@plane/ui"; import { EmptyState, getEmptyStateImagePath } from "components/empty-state"; // constants import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectCardList = observer(() => { // theme const { resolvedTheme } = useTheme(); // store hooks const { commandPalette: commandPaletteStore, eventTracker: { setTrackElement }, } = useApplication(); const { membership: { currentWorkspaceRole }, currentUser, } = useUser(); const { workspaceProjectIds, searchedProjects, getProjectById } = useProject(); const isLightMode = resolvedTheme ? resolvedTheme === "light" : currentUser?.theme.theme === "light"; const emptyStateImage = getEmptyStateImagePath("onboarding", "projects", isLightMode); 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); }, }} comicBox={{ title: "Everything starts with a project in Plane", description: "A project could be a product’s roadmap, a marketing campaign, or launching a new car.", }} size="lg" disabled={!isEditingAllowed} /> )} ); });