import { FC } from "react"; import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; // hooks import { usePlatformOS } from "hooks/use-platform-os"; // constants // ui import { Breadcrumbs, LayersIcon, Tooltip } from "@plane/ui"; // components import { BreadcrumbLink } from "components/common"; import { DisplayFiltersSelection, FilterSelection, FiltersDropdown } from "components/issues"; import { EIssueFilterType, EIssuesStoreType, ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "constants/issue"; // helpers import { useIssues, useLabel, useMember, useProject, useProjectState } from "hooks/store"; // types import type { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions } from "@plane/types"; import { ProjectLogo } from "components/project"; export const ProjectArchivedIssuesHeader: FC = observer(() => { // router const router = useRouter(); const { workspaceSlug, projectId } = router.query; // store hooks const { issuesFilter: { issueFilters, updateFilters }, } = useIssues(EIssuesStoreType.ARCHIVED); const { currentProjectDetails } = useProject(); const { projectStates } = useProjectState(); const { projectLabels } = useLabel(); const { project: { projectMemberIds }, } = useMember(); // for archived issues list layout is the only option const activeLayout = "list"; // hooks const { isMobile } = usePlatformOS(); const handleFiltersUpdate = (key: keyof IIssueFilterOptions, value: string | string[]) => { if (!workspaceSlug || !projectId) return; const newValues = issueFilters?.filters?.[key] ?? []; if (Array.isArray(value)) { value.forEach((val) => { if (!newValues.includes(val)) newValues.push(val); }); } else { if (issueFilters?.filters?.[key]?.includes(value)) newValues.splice(newValues.indexOf(value), 1); else newValues.push(value); } updateFilters(workspaceSlug.toString(), projectId.toString(), EIssueFilterType.FILTERS, { [key]: newValues, }); }; const handleDisplayFiltersUpdate = (updatedDisplayFilter: Partial) => { if (!workspaceSlug || !projectId) return; updateFilters(workspaceSlug.toString(), projectId.toString(), EIssueFilterType.DISPLAY_FILTERS, { ...issueFilters?.displayFilters, ...updatedDisplayFilter, }); }; const handleDisplayPropertiesUpdate = (property: Partial) => { if (!workspaceSlug || !projectId) return; updateFilters(workspaceSlug.toString(), projectId.toString(), EIssueFilterType.DISPLAY_PROPERTIES, property); }; const issueCount = currentProjectDetails ? issueFilters?.displayFilters?.sub_issue ? currentProjectDetails.archived_issues + currentProjectDetails.archived_sub_issues : currentProjectDetails.archived_issues : undefined; return (
) } /> } /> } /> } /> {issueCount && issueCount > 0 ? ( 1 ? "issues" : "issue"} in project's archived`} position="bottom" > {issueCount} ) : null}
{/* filter options */}
); });