import React from "react"; // components import { KanBanGroupByHeaderRoot } from "./headers/group-by-root"; import { KanBanSubGroupByHeaderRoot } from "./headers/sub-group-by-root"; import { KanBan } from "./default"; // constants import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES, getValueFromObject } from "constants/issue"; // mobx import { observer } from "mobx-react-lite"; // mobx import { useMobxStore } from "lib/mobx/store-provider"; import { RootStore } from "store/root"; 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 { issues: any; handleIssues?: (sub_group_by: string | null, group_by: string | null, issue: any) => void; display_properties: any; kanBanToggle: any; handleKanBanToggle: any; states: any; stateGroups: any; priorities: any; labels: any; members: any; projects: any; estimates: any; } const SubGroupSwimlane: React.FC = observer((props) => { const { issues, sub_group_by, group_by, list, listKey, handleIssues, display_properties, kanBanToggle, handleKanBanToggle, states, stateGroups, priorities, labels, members, projects, estimates, } = 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: any) => void; display_properties: any; kanBanToggle: any; handleKanBanToggle: any; states: any; stateGroups: any; priorities: any; labels: any; members: any; projects: any; estimates: any; } export const KanBanSwimLanes: React.FC = observer((props) => { const { issues, sub_group_by, group_by, handleIssues, display_properties, kanBanToggle, handleKanBanToggle, states, stateGroups, priorities, labels, members, projects, estimates, } = props; const { project: projectStore }: RootStore = useMobxStore(); return (
{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_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" && ( )}
); });