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"; // components import CreateUpdateStateModal from "components/project/issues/BoardView/state/CreateUpdateStateModal"; // icons import { CheckIcon, PlusIcon } from "@heroicons/react/20/solid"; // ui import { Spinner } from "ui"; // types import type { Control } from "react-hook-form"; import type { IIssue } from "types"; import { Squares2X2Icon } from "@heroicons/react/24/outline"; type Props = { control: Control; data?: IIssue; setIsOpen: React.Dispatch>; }; const SelectState: React.FC = ({ control, data, setIsOpen }) => { const { states } = useUser(); return ( <> ( {({ open }) => ( <>
{states?.find((i) => i.id === value)?.name ?? "State"}
{states ? ( states.filter((i) => i.id !== data?.id).length > 0 ? ( states .filter((i) => i.id !== data?.id) .map((state) => ( `${ active ? "text-white bg-theme" : "text-gray-900" } cursor-pointer select-none relative p-2 rounded-md` } value={state.id} > {({ selected, active }) => ( <> {state.name} {selected ? ( ) : null} )} )) ) : (

No states found!

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