import React from "react"; import { useRouter } from "next/router"; import useSWR from "swr"; import { Controller } from "react-hook-form"; import type { Control } from "react-hook-form"; // service import projectServices from "lib/services/project.service"; // ui import { SearchListbox } from "ui"; // icons import { UserIcon } from "@heroicons/react/24/outline"; // types import type { IModule } from "types"; // fetch-keys import { PROJECT_MEMBERS } from "constants/fetch-keys"; type Props = { control: Control; }; const SelectLead: React.FC = ({ control }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { data: people } = useSWR( workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null, workspaceSlug && projectId ? () => projectServices.projectMembers(workspaceSlug as string, projectId as string) : null ); return ( ( { return { value: person.member.id, display: person.member.first_name && person.member.first_name !== "" ? person.member.first_name : person.member.email, }; })} value={value} onChange={onChange} icon={} /> )} /> ); }; export default SelectLead;