mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
ec26bf6e68
* fix: handled undefined issue_id in list layout * chore: refactor peek overview and user role validation. * chore: sub issues * fix: sub issues state distribution changed * chore: sub_issues implementation in issue detail page * chore: fixes in cycle/ module layout. * Fix progress chart * Module issues's update/ delete. * Peek Overview for Modules/ Cycle. * Fix Cycle Filters not applying bug. --------- Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import { FC } from "react";
|
|
import { observer } from "mobx-react-lite";
|
|
// hooks
|
|
import { useIssueDetail } from "hooks/store";
|
|
// components
|
|
import { IssueListItem } from "./issue-list-item";
|
|
// types
|
|
import { TIssue } from "@plane/types";
|
|
import { TSubIssueOperations } from "./root";
|
|
import useSWR from "swr";
|
|
|
|
export interface IIssueList {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
parentIssueId: string;
|
|
spacingLeft: number;
|
|
disabled: boolean;
|
|
handleIssueCrudState: (
|
|
key: "create" | "existing" | "update" | "delete",
|
|
issueId: string,
|
|
issue?: TIssue | null
|
|
) => void;
|
|
subIssueOperations: TSubIssueOperations;
|
|
}
|
|
|
|
export const IssueList: FC<IIssueList> = observer((props) => {
|
|
const {
|
|
workspaceSlug,
|
|
projectId,
|
|
parentIssueId,
|
|
spacingLeft = 10,
|
|
disabled,
|
|
handleIssueCrudState,
|
|
subIssueOperations,
|
|
} = props;
|
|
// hooks
|
|
const {
|
|
subIssues: { subIssuesByIssueId, subIssueHelpersByIssueId },
|
|
} = useIssueDetail();
|
|
|
|
useSWR(
|
|
workspaceSlug && projectId && parentIssueId
|
|
? `ISSUE_DETAIL_SUB_ISSUES_${workspaceSlug}_${projectId}_${parentIssueId}`
|
|
: null,
|
|
async () => {
|
|
workspaceSlug &&
|
|
projectId &&
|
|
parentIssueId &&
|
|
(await subIssueOperations.fetchSubIssues(workspaceSlug, projectId, parentIssueId));
|
|
}
|
|
);
|
|
|
|
const subIssueIds = subIssuesByIssueId(parentIssueId);
|
|
const subIssueHelpers = subIssueHelpersByIssueId(parentIssueId);
|
|
|
|
return (
|
|
<>
|
|
{subIssueHelpers.preview_loader.includes(parentIssueId) ? "Loading..." : "Hello"}
|
|
|
|
<div className="relative">
|
|
{subIssueIds &&
|
|
subIssueIds.length > 0 &&
|
|
subIssueIds.map((issueId) => (
|
|
<>
|
|
<IssueListItem
|
|
workspaceSlug={workspaceSlug}
|
|
projectId={projectId}
|
|
parentIssueId={parentIssueId}
|
|
spacingLeft={spacingLeft}
|
|
disabled={disabled}
|
|
handleIssueCrudState={handleIssueCrudState}
|
|
subIssueOperations={subIssueOperations}
|
|
issueId={issueId}
|
|
/>
|
|
</>
|
|
))}
|
|
|
|
<div
|
|
className={`absolute bottom-0 top-0 ${spacingLeft > 10 ? `border-l border-custom-border-100` : ``}`}
|
|
style={{ left: `${spacingLeft - 12}px` }}
|
|
/>
|
|
</div>
|
|
</>
|
|
);
|
|
});
|