mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
4611ec0b83
* fix: handled undefined issue_id in list layout * dev: issue detail store and optimization * dev: issue filter and list operations * fix: typo on labels update * dev: Handled all issues in the list layout in project issues * dev: handled kanban and auick add issue in swimlanes * chore: fixed peekoverview in kanban * chore: fixed peekoverview in calendar * chore: fixed peekoverview in gantt * chore: updated quick add in the gantt chart * chore: handled issue detail properties and resolved build issues --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
92 lines
2.9 KiB
TypeScript
92 lines
2.9 KiB
TypeScript
import { useMemo } from "react";
|
|
// components
|
|
import { SubIssues } from "./issue";
|
|
// types
|
|
import { IUser, TIssue } from "@plane/types";
|
|
// import { ISubIssuesRootLoaders, ISubIssuesRootLoadersHandler } from "./root";
|
|
|
|
// fetch keys
|
|
import { useIssueDetail } from "hooks/store";
|
|
|
|
export interface ISubIssuesRootList {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
parentIssue: TIssue;
|
|
spacingLeft?: number;
|
|
user: IUser | undefined;
|
|
editable: boolean;
|
|
removeIssueFromSubIssues: (parentIssueId: string, issue: TIssue) => void;
|
|
issuesLoader: any; // FIXME: replace ISubIssuesRootLoaders with any
|
|
handleIssuesLoader: ({ key, issueId }: any) => void; // FIXME: replace ISubIssuesRootLoadersHandler with any
|
|
copyText: (text: string) => void;
|
|
handleIssueCrudOperation: (
|
|
key: "create" | "existing" | "edit" | "delete",
|
|
issueId: string,
|
|
issue?: TIssue | null
|
|
) => void;
|
|
handleUpdateIssue: (issue: TIssue, data: Partial<TIssue>) => void;
|
|
}
|
|
|
|
export const SubIssuesRootList: React.FC<ISubIssuesRootList> = ({
|
|
workspaceSlug,
|
|
projectId,
|
|
parentIssue,
|
|
spacingLeft = 10,
|
|
user,
|
|
editable,
|
|
removeIssueFromSubIssues,
|
|
issuesLoader,
|
|
handleIssuesLoader,
|
|
copyText,
|
|
handleIssueCrudOperation,
|
|
handleUpdateIssue,
|
|
}) => {
|
|
const issueDetail = useIssueDetail();
|
|
issueDetail.subIssues.fetchSubIssues(workspaceSlug, projectId, parentIssue?.id);
|
|
|
|
const subIssues = issueDetail.subIssues.subIssuesByIssueId(parentIssue?.id);
|
|
|
|
const handleIssue = useMemo(
|
|
() => ({
|
|
fetchIssues: async (issueId: string) => issueDetail.subIssues.fetchSubIssues(workspaceSlug, projectId, issueId),
|
|
updateIssue: async (issueId: string, data: Partial<TIssue>) =>
|
|
issueDetail.updateIssue(workspaceSlug, projectId, issueId, data),
|
|
removeIssue: (issueId: string) => issueDetail.removeIssue(workspaceSlug, projectId, issueId),
|
|
}),
|
|
[issueDetail, workspaceSlug, projectId]
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<div className="relative">
|
|
{subIssues &&
|
|
subIssues.length > 0 &&
|
|
subIssues.map((issueId: string) => (
|
|
<SubIssues
|
|
key={`${issueId}`}
|
|
workspaceSlug={workspaceSlug}
|
|
projectId={projectId}
|
|
parentIssue={parentIssue}
|
|
issueId={issueId}
|
|
handleIssue={handleIssue}
|
|
spacingLeft={spacingLeft}
|
|
user={user}
|
|
editable={editable}
|
|
removeIssueFromSubIssues={removeIssueFromSubIssues}
|
|
issuesLoader={issuesLoader}
|
|
handleIssuesLoader={handleIssuesLoader}
|
|
copyText={copyText}
|
|
handleIssueCrudOperation={handleIssueCrudOperation}
|
|
handleUpdateIssue={handleUpdateIssue}
|
|
/>
|
|
))}
|
|
|
|
<div
|
|
className={`absolute bottom-0 top-0 ${spacingLeft > 10 ? `border-l border-custom-border-100` : ``}`}
|
|
style={{ left: `${spacingLeft - 12}px` }}
|
|
/>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|