import { observer } from "mobx-react-lite"; import Image from "next/image"; // components import { EmptyState } from "@/components/empty-state"; import { ProjectCard } from "@/components/project"; import { ProjectsLoader } from "@/components/ui"; // constants import { EmptyStateType } from "@/constants/empty-state"; // hooks import { useCommandPalette, useEventTracker, useProject, useProjectFilter } from "@/hooks/store"; // assets import AllFiltersImage from "public/empty-state/project/all-filters.svg"; import NameFilterImage from "public/empty-state/project/name-filter.svg"; export const ProjectCardList = observer(() => { // store hooks const { toggleCreateProjectModal } = useCommandPalette(); const { setTrackElement } = useEventTracker(); const { workspaceProjectIds, filteredProjectIds, getProjectById } = useProject(); const { searchQuery, currentWorkspaceDisplayFilters } = useProjectFilter(); if (workspaceProjectIds?.length === 0 && !currentWorkspaceDisplayFilters?.archived_projects) return ( { setTrackElement("Project empty state"); toggleCreateProjectModal(true); }} /> ); if (!filteredProjectIds) return ; if (filteredProjectIds.length === 0) return (
No matching projects
No matching projects

{searchQuery.trim() === "" ? "Remove the filters to see all projects" : "No projects detected with the matching\ncriteria. Create a new project instead"}

); return (
{filteredProjectIds.map((projectId) => { const projectDetails = getProjectById(projectId); if (!projectDetails) return; return ; })}
); });