mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
6a16a98b03
* 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>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { FC } from "react";
|
|
import useSWR from "swr";
|
|
import { observer } from "mobx-react-lite";
|
|
// components
|
|
import { IssueParentSiblingItem } from "./sibling-item";
|
|
// hooks
|
|
import { useIssueDetail } from "hooks/store";
|
|
// types
|
|
import { TIssue } from "@plane/types";
|
|
|
|
export type TIssueParentSiblings = {
|
|
currentIssue: TIssue;
|
|
parentIssue: TIssue;
|
|
};
|
|
|
|
export const IssueParentSiblings: FC<TIssueParentSiblings> = (props) => {
|
|
const { currentIssue, parentIssue } = props;
|
|
// hooks
|
|
const {
|
|
peekIssue,
|
|
fetchSubIssues,
|
|
subIssues: { subIssuesByIssueId },
|
|
} = useIssueDetail();
|
|
|
|
const { isLoading } = useSWR(
|
|
peekIssue && parentIssue && parentIssue.project_id
|
|
? `ISSUE_PARENT_CHILD_ISSUES_${peekIssue?.workspaceSlug}_${parentIssue.project_id}_${parentIssue.id}`
|
|
: null,
|
|
peekIssue && parentIssue && parentIssue.project_id
|
|
? () => fetchSubIssues(peekIssue?.workspaceSlug, parentIssue.project_id, parentIssue.id)
|
|
: null
|
|
);
|
|
|
|
const subIssueIds = (parentIssue && subIssuesByIssueId(parentIssue.id)) || undefined;
|
|
|
|
return (
|
|
<div>
|
|
{isLoading ? (
|
|
<div className="flex items-center gap-2 whitespace-nowrap px-1 py-1 text-left text-xs text-custom-text-200">
|
|
Loading
|
|
</div>
|
|
) : subIssueIds && subIssueIds.length > 0 ? (
|
|
subIssueIds.map((issueId) => currentIssue.id != issueId && <IssueParentSiblingItem issueId={issueId} />)
|
|
) : (
|
|
<div className="flex items-center gap-2 whitespace-nowrap px-1 py-1 text-left text-xs text-custom-text-200">
|
|
No sibling issues
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|