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, IIssueLabels, IProject, IState, IUserLite } from "types"; // constants import { getValueFromObject } from "constants/issue"; interface ISubGroupSwimlaneHeader { issues: any; sub_group_by: string | null; group_by: string | null; list: any; listKey: string; kanBanToggle: any; handleKanBanToggle: any; } const SubGroupSwimlaneHeader: React.FC = ({ issues, sub_group_by, group_by, list, listKey, kanBanToggle, handleKanBanToggle, }) => { const calculateIssueCount = (column_id: string) => { let issueCount = 0; issues && Object.keys(issues)?.forEach((_issueKey: any) => { issueCount += issues?.[_issueKey]?.[column_id]?.length || 0; }); return issueCount; }; return (
{list && list.length > 0 && list.map((_list: any) => (
))}
); }; interface ISubGroupSwimlane extends ISubGroupSwimlaneHeader { showEmptyGroup: boolean; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabels[] | null; members: IUserLite[] | null; projects: IProject[] | null; issues: any; handleIssues: ( sub_group_by: string | null, group_by: string | null, issue: IIssue, action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; } const SubGroupSwimlane: React.FC = observer((props) => { const { issues, sub_group_by, group_by, list, listKey, handleIssues, quickActions, displayProperties, kanBanToggle, handleKanBanToggle, showEmptyGroup, states, stateGroups, priorities, labels, members, projects, } = props; const calculateIssueCount = (column_id: string) => { let issueCount = 0; issues?.[column_id] && Object.keys(issues?.[column_id])?.forEach((_list: any) => { issueCount += issues?.[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: any; sub_group_by: string | null; group_by: string | null; handleIssues: ( sub_group_by: string | null, group_by: string | null, issue: IIssue, action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; showEmptyGroup: boolean; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabels[] | null; members: IUserLite[] | null; projects: IProject[] | null; } export const KanBanSwimLanes: React.FC = observer((props) => { const { issues, sub_group_by, group_by, handleIssues, quickActions, displayProperties, kanBanToggle, handleKanBanToggle, showEmptyGroup, states, stateGroups, priorities, labels, members, projects, } = 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 === "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" && ( )}
); });