// components import { IssueBlocksList, ListQuickAddIssueForm } from "components/issues"; // hooks import { useLabel, useMember, useProject, useProjectState } from "hooks/store"; // types import { GroupByColumnTypes, TGroupedIssues, TIssue, IIssueDisplayProperties, TIssueMap, TUnGroupedIssues, } from "@plane/types"; import { EIssueActions } from "../types"; // constants import { HeaderGroupByCard } from "./headers/group-by-card"; import { getGroupByColumns } from "../utils"; import { TCreateModalStoreTypes } from "constants/issue"; export interface IGroupByList { issueIds: TGroupedIssues | TUnGroupedIssues | any; issuesMap: TIssueMap; group_by: string | null; is_list?: boolean; handleIssues: (issue: TIssue, action: EIssueActions) => Promise; quickActions: (issue: TIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties | undefined; enableIssueQuickAdd: boolean; showEmptyGroup?: boolean; canEditProperties: (projectId: string | undefined) => boolean; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; disableIssueCreation?: boolean; currentStore: TCreateModalStoreTypes; addIssuesToView?: (issueIds: string[]) => Promise; viewId?: string; } const GroupByList: React.FC = (props) => { const { issueIds, issuesMap, group_by, is_list = false, handleIssues, quickActions, displayProperties, enableIssueQuickAdd, showEmptyGroup, canEditProperties, quickAddCallback, viewId, disableIssueCreation, currentStore, addIssuesToView, } = props; // store hooks const member = useMember(); const project = useProject(); const projectLabel = useLabel(); const projectState = useProjectState(); const list = getGroupByColumns(group_by as GroupByColumnTypes, project, projectLabel, projectState, member, true); if (!list) return null; const prePopulateQuickAddData = (groupByKey: string | null, value: any) => { const defaultState = projectState.projectStates?.find((state) => state.default); if (groupByKey === null) return { state_id: defaultState?.id }; else { if (groupByKey === "state") return { state: groupByKey === "state" ? value : defaultState?.id }; else return { state_id: defaultState?.id, [groupByKey]: value }; } }; const validateEmptyIssueGroups = (issues: TIssue[]) => { const issuesCount = issues?.length || 0; if (!showEmptyGroup && issuesCount <= 0) return false; return true; }; return (
{list && list.length > 0 && list.map( (_list: any) => validateEmptyIssueGroups(is_list ? issueIds : issueIds?.[_list.id]) && (
{issueIds && ( )} {enableIssueQuickAdd && !disableIssueCreation && (
)}
) )}
); }; export interface IList { issueIds: TGroupedIssues | TUnGroupedIssues | any; issuesMap: TIssueMap; group_by: string | null; handleIssues: (issue: TIssue, action: EIssueActions) => Promise; quickActions: (issue: TIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties | undefined; showEmptyGroup: boolean; enableIssueQuickAdd: boolean; canEditProperties: (projectId: string | undefined) => boolean; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; viewId?: string; disableIssueCreation?: boolean; currentStore: TCreateModalStoreTypes; addIssuesToView?: (issueIds: string[]) => Promise; } export const List: React.FC = (props) => { const { issueIds, issuesMap, group_by, handleIssues, quickActions, quickAddCallback, viewId, displayProperties, showEmptyGroup, enableIssueQuickAdd, canEditProperties, disableIssueCreation, currentStore, addIssuesToView, } = props; return (
); };