import React from "react"; import { observer } from "mobx-react-lite"; // components import { KanBanGroupByHeaderRoot } from "./headers/group-by-root"; import { KanBanSubGroupByHeaderRoot } from "./headers/sub-group-by-root"; import { KanBan } from "./default"; // types import { IIssue, IIssueDisplayProperties, IIssueLabel, IProject, IState, IUserLite } from "types"; import { IIssueResponse, IGroupedIssues, ISubGroupedIssues, TUnGroupedIssues } from "store/issues/types"; // constants import { getValueFromObject } from "constants/issue"; import { EIssueActions } from "../types"; interface ISubGroupSwimlaneHeader { issues: IIssueResponse; issueIds: any; sub_group_by: string | null; group_by: string | null; list: any; listKey: string; kanBanToggle: any; handleKanBanToggle: any; } const SubGroupSwimlaneHeader: React.FC = ({ issues, issueIds, sub_group_by, group_by, list, listKey, kanBanToggle, handleKanBanToggle, }) => { const calculateIssueCount = (column_id: string) => { let issueCount = 0; issueIds && Object.keys(issueIds)?.forEach((_issueKey: any) => { issueCount += issueIds?.[_issueKey]?.[column_id]?.length || 0; }); return issueCount; }; return (
{list && list.length > 0 && list.map((_list: any) => (
))}
); }; interface ISubGroupSwimlane extends ISubGroupSwimlaneHeader { issues: IIssueResponse; issueIds: any; order_by: string | null; showEmptyGroup: boolean; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabel[] | null; members: IUserLite[] | null; projects: IProject[] | null; handleIssues: (sub_group_by: string | null, group_by: string | null, issue: IIssue, action: EIssueActions) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties | null; kanBanToggle: any; handleKanBanToggle: any; isDragStarted?: boolean; } const SubGroupSwimlane: React.FC = observer((props) => { const { issues, issueIds, sub_group_by, group_by, order_by, list, listKey, handleIssues, quickActions, displayProperties, kanBanToggle, handleKanBanToggle, showEmptyGroup, states, stateGroups, priorities, labels, members, projects, isDragStarted, } = props; const calculateIssueCount = (column_id: string) => { let issueCount = 0; issueIds?.[column_id] && Object.keys(issueIds?.[column_id])?.forEach((_list: any) => { issueCount += issueIds?.[column_id]?.[_list]?.length || 0; }); return issueCount; }; return (
{list && list.length > 0 && list.map((_list: any) => (
{!kanBanToggle?.subgroupByIssuesVisibility.includes(getValueFromObject(_list, listKey) as string) && (
)}
))}
); }); export interface IKanBanSwimLanes { issues: IIssueResponse; issueIds: IGroupedIssues | ISubGroupedIssues | TUnGroupedIssues; sub_group_by: string | null; group_by: string | null; order_by: string | null; handleIssues: (sub_group_by: string | null, group_by: string | null, issue: IIssue, action: EIssueActions) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties | null; kanBanToggle: any; handleKanBanToggle: any; showEmptyGroup: boolean; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabel[] | null; members: IUserLite[] | null; projects: IProject[] | null; isDragStarted?: boolean; } export const KanBanSwimLanes: React.FC = observer((props) => { const { issues, issueIds, sub_group_by, group_by, order_by, handleIssues, quickActions, displayProperties, kanBanToggle, handleKanBanToggle, showEmptyGroup, states, stateGroups, priorities, labels, members, projects, isDragStarted, } = props; return (
{group_by && group_by === "project" && ( )} {group_by && group_by === "state" && ( )} {group_by && group_by === "state_detail.group" && ( )} {group_by && group_by === "priority" && ( )} {group_by && group_by === "labels" && ( )} {group_by && group_by === "assignees" && ( )} {group_by && group_by === "created_by" && ( )}
{sub_group_by && sub_group_by === "project" && ( )} {sub_group_by && sub_group_by === "state" && ( )} {sub_group_by && sub_group_by === "state" && ( )} {sub_group_by && sub_group_by === "state_detail.group" && ( )} {sub_group_by && sub_group_by === "priority" && ( )} {sub_group_by && sub_group_by === "labels" && ( )} {sub_group_by && sub_group_by === "assignees" && ( )} {sub_group_by && sub_group_by === "created_by" && ( )}
); });