import React, { useState } from "react"; import { useRouter } from "next/router"; import useSWR from "swr"; import { Control, Controller, UseFormWatch } from "react-hook-form"; // fetch keys import { PROJECT_ISSUES_LIST } from "constants/fetch-keys"; // services import issuesServices from "lib/services/issues.service"; // components import IssuesListModal from "components/project/issues/issues-list-modal"; // icons import { UserIcon } from "@heroicons/react/24/outline"; // types import { IIssue } from "types"; type Props = { control: Control; submitChanges: (formData: Partial) => void; issuesList: IIssue[]; customDisplay: JSX.Element; watch: UseFormWatch; }; const SelectParent: React.FC = ({ control, submitChanges, issuesList, customDisplay, watch, }) => { const [isParentModalOpen, setIsParentModalOpen] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { data: issues } = useSWR( workspaceSlug && projectId ? PROJECT_ISSUES_LIST(workspaceSlug as string, projectId as string) : null, workspaceSlug && projectId ? () => issuesServices.getIssues(workspaceSlug as string, projectId as string) : null ); return (

Parent

( setIsParentModalOpen(false)} onChange={(val) => { submitChanges({ parent: val }); onChange(val); }} issues={issuesList} title="Select Parent" value={value} customDisplay={customDisplay} /> )} />
); }; export default SelectParent;