2022-12-06 14:38:28 +00:00
|
|
|
import React, { useEffect, useState } from "react";
|
2022-12-03 13:41:07 +00:00
|
|
|
// react hook form
|
|
|
|
import { Controller, Control } from "react-hook-form";
|
|
|
|
// hooks
|
|
|
|
import useUser from "lib/hooks/useUser";
|
|
|
|
// types
|
2022-12-06 14:38:28 +00:00
|
|
|
import type { IIssue, IssueResponse } from "types";
|
2022-12-03 13:41:07 +00:00
|
|
|
// icons
|
|
|
|
import { UserIcon } from "@heroicons/react/24/outline";
|
|
|
|
// components
|
|
|
|
import IssuesListModal from "components/project/issues/IssuesListModal";
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
control: Control<IIssue, any>;
|
2022-12-06 14:38:28 +00:00
|
|
|
isOpen: boolean;
|
|
|
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
|
|
issues: IssueResponse | undefined;
|
2022-12-03 13:41:07 +00:00
|
|
|
};
|
|
|
|
|
2022-12-06 14:38:28 +00:00
|
|
|
const SelectParent: React.FC<Props> = ({ control, isOpen, setIsOpen, issues }) => {
|
2022-12-03 13:41:07 +00:00
|
|
|
return (
|
|
|
|
<Controller
|
|
|
|
control={control}
|
|
|
|
name="parent"
|
|
|
|
render={({ field: { value, onChange } }) => (
|
2022-12-06 14:38:28 +00:00
|
|
|
<IssuesListModal
|
|
|
|
isOpen={isOpen}
|
|
|
|
handleClose={() => setIsOpen(false)}
|
|
|
|
onChange={onChange}
|
|
|
|
issues={issues}
|
|
|
|
/>
|
2022-12-03 13:41:07 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SelectParent;
|