import React from "react"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components import { KanBanGroupByHeaderRoot } from "./headers/group-by-root"; import { KanBanSubGroupByHeaderRoot } from "./headers/sub-group-by-root"; import { KanBan } from "./default"; // types import { IEstimatePoint, IIssue, IIssueLabels, IProject, IState, IUserLite } from "types"; // constants import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES, 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; states: IState[] | null; labels: IIssueLabels[] | null; members: IUserLite[] | null; projects: IProject[] | null; estimates: IEstimatePoint[] | null; } 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: IIssue, action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; display_properties: any; kanBanToggle: any; handleKanBanToggle: any; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabels[] | null; members: IUserLite[] | null; projects: IProject[] | null; estimates: IEstimatePoint[] | null; } const SubGroupSwimlane: React.FC = observer((props) => { const { issues, sub_group_by, group_by, list, listKey, handleIssues, quickActions, 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: IIssue, action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; display_properties: any; kanBanToggle: any; handleKanBanToggle: any; states: IState[] | null; stateGroups: any; priorities: any; labels: IIssueLabels[] | null; members: IUserLite[] | null; projects: IProject[] | null; estimates: IEstimatePoint[] | null; } export const KanBanSwimLanes: React.FC = observer((props) => { const { issues, sub_group_by, group_by, handleIssues, quickActions, display_properties, kanBanToggle, handleKanBanToggle, states, stateGroups, priorities, labels, members, projects, estimates, } = props; const { project: projectStore } = 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" && ( )}
); });