import React from "react"; // react hook form import { Controller } from "react-hook-form"; // hooks import useUser from "lib/hooks/useUser"; // types import type { IIssue } from "types"; import type { Control } from "react-hook-form"; import { UserIcon } from "@heroicons/react/24/outline"; type Props = { control: Control; }; import { SearchListbox } from "ui"; const SelectParent: React.FC = ({ control }) => { const { issues: projectIssues } = useUser(); const getSelectedIssueKey = (issueId: string | undefined) => { const identifier = projectIssues?.results?.find((i) => i.id.toString() === issueId?.toString()) ?.project_detail?.identifier; const sequenceId = projectIssues?.results?.find( (i) => i.id.toString() === issueId?.toString() )?.sequence_id; if (issueId) return `${identifier}-${sequenceId}`; else return "Parent issue"; }; return ( ( { return { value: issue.id, display: issue.name, element: (
{`${getSelectedIssueKey(issue.id)}`} {issue.name}
), }; })} value={value} width="xs" buttonClassName="max-h-30 overflow-y-scroll" optionsClassName="max-h-30 overflow-y-scroll" onChange={onChange} icon={} /> )} /> ); }; export default SelectParent;