import { Droppable } from "@hello-pangea/dnd"; //types import { TGroupedIssues, TIssue, IIssueDisplayProperties, IIssueMap, TSubGroupedIssues, TUnGroupedIssues, } from "@plane/types"; import { EIssueActions } from "../types"; // hooks import { useProjectState } from "hooks/store"; //components import { KanBanQuickAddIssueForm, KanbanIssueBlocksList } from "."; interface IKanbanGroup { groupId: string; issuesMap: IIssueMap; issueIds: TGroupedIssues | TSubGroupedIssues | TUnGroupedIssues; displayProperties: IIssueDisplayProperties | undefined; sub_group_by: string | null; group_by: string | null; sub_group_id: string; isDragDisabled: boolean; handleIssues: (issue: TIssue, action: EIssueActions) => void; quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode; enableQuickIssueCreate?: boolean; quickAddCallback?: ( workspaceSlug: string, projectId: string, data: TIssue, viewId?: string ) => Promise; viewId?: string; disableIssueCreation?: boolean; canEditProperties: (projectId: string | undefined) => boolean; verticalPosition: any; } export const KanbanGroup = (props: IKanbanGroup) => { const { groupId, sub_group_id, group_by, sub_group_by, issuesMap, displayProperties, verticalPosition, issueIds, isDragDisabled, handleIssues, quickActions, canEditProperties, enableQuickIssueCreate, disableIssueCreation, quickAddCallback, viewId, } = props; const projectState = useProjectState(); const prePopulateQuickAddData = (groupByKey: string | null, value: string) => { const defaultState = projectState.projectStates?.find((state) => state.default); let preloadedData: object = { state_id: defaultState?.id }; if (groupByKey) { if (groupByKey === "state") { preloadedData = { ...preloadedData, state_id: value }; } else if (groupByKey === "priority") { preloadedData = { ...preloadedData, priority: value }; } else if (groupByKey === "labels" && value != "None") { preloadedData = { ...preloadedData, label_ids: [value] }; } else if (groupByKey === "assignees" && value != "None") { preloadedData = { ...preloadedData, assignee_ids: [value] }; } else if (groupByKey === "created_by") { preloadedData = { ...preloadedData }; } else { preloadedData = { ...preloadedData, [groupByKey]: value }; } } return preloadedData; }; const isGroupByCreatedBy = group_by === "created_by"; return (
{(provided: any, snapshot: any) => (
{!verticalPosition ? ( ) : null} {provided.placeholder}
)}
{enableQuickIssueCreate && !disableIssueCreation && !isGroupByCreatedBy && ( )}
); };