import React from "react"; // react hook form import { Controller } from "react-hook-form"; // headless ui import { Listbox, Transition } from "@headlessui/react"; // hooks import useUser from "lib/hooks/useUser"; // icons import { ClipboardDocumentListIcon } from "@heroicons/react/24/outline"; // ui import { Spinner } from "ui"; // types import type { Control } from "react-hook-form"; import type { IIssue } from "types"; type Props = { control: Control; }; const SelectProject: React.FC = ({ control }) => { const { projects, setActiveProject } = useUser(); return ( <> ( { onChange(value); setActiveProject(projects?.find((i) => i.id === value)); }} > {({ open }) => ( <>
{projects?.find((i) => i.id === value)?.identifier ?? "Project"}
{projects ? ( projects.length > 0 ? ( projects.map((project) => ( `${ active ? "text-white bg-theme" : "text-gray-900" } cursor-pointer select-none p-2 rounded-md` } value={project.id} > {({ selected, active }) => ( <> {project.name} )} )) ) : (

No projects found!

) ) : (
)}
)}
)} >
); }; export default SelectProject;