import Link from "next/link"; import { useRouter } from "next/router"; import useSWR from "swr"; // services import issuesService from "services/issues.service"; // hooks import useUserAuth from "hooks/use-user-auth"; // contexts import { useProjectMyMembership } from "contexts/project-member.context"; // components import { AddComment, IssueActivitySection, IssueAttachmentUpload, IssueAttachments, IssueDescriptionForm, SubIssuesList, } from "components/issues"; // ui import { CustomMenu } from "components/ui"; // types import { IIssue } from "types"; // fetch-keys import { SUB_ISSUES } from "constants/fetch-keys"; type Props = { issueDetails: IIssue; submitChanges: (formData: Partial) => Promise; }; export const IssueMainContent: React.FC = ({ issueDetails, submitChanges }) => { const router = useRouter(); const { workspaceSlug, projectId, issueId } = router.query; const { user } = useUserAuth(); const { memberRole } = useProjectMyMembership(); const { data: siblingIssues } = useSWR( workspaceSlug && projectId && issueDetails?.parent ? SUB_ISSUES(issueDetails.parent) : null, workspaceSlug && projectId && issueDetails?.parent ? () => issuesService.subIssues( workspaceSlug as string, projectId as string, issueDetails.parent ?? "" ) : null ); return ( <>
{issueDetails?.parent && issueDetails.parent !== "" ? (
{issueDetails.project_detail.identifier}-{issueDetails.parent_detail?.sequence_id} {issueDetails.parent_detail?.name.substring(0, 50)} {siblingIssues && siblingIssues.length > 0 ? ( siblingIssues.map((issue: IIssue) => ( {issueDetails.project_detail.identifier}-{issue.sequence_id} )) ) : ( No other sibling issues )}
) : null}

Attachments

Comments/Activity

); };