// react import React from "react"; // swr import useSWR from "swr"; // react-hook-form import { Control, Controller } from "react-hook-form"; // services import workspaceService from "lib/services/workspace.service"; // hooks import useUser from "lib/hooks/useUser"; // headless ui import { Listbox, Transition } from "@headlessui/react"; // ui import { Button } from "ui"; // icons import { CheckIcon, ChevronDownIcon } from "@heroicons/react/24/outline"; // types import { IProject, WorkspaceMember } from "types"; // fetch-keys import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; type Props = { control: Control; isSubmitting: boolean; }; const ControlSettings: React.FC = ({ control, isSubmitting }) => { const { activeWorkspace } = useUser(); const { data: people } = useSWR( activeWorkspace ? WORKSPACE_MEMBERS : null, activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null ); return ( <>

Control

Set the control for the project.

( {({ open }) => ( <>
Project Lead
{people?.find((person) => person.member.id === value)?.member .first_name ?? "Select Lead"} {people?.map((person) => ( `${ active ? "text-white bg-theme" : "text-gray-900" } cursor-default select-none relative py-2 pl-3 pr-9` } value={person.member.id} > {({ selected, active }) => ( <> {person.member.first_name} {selected ? ( ) : null} )} ))}
)}
)} />
( {({ open }) => ( <>
Default Assignee
{people?.find((p) => p.member.id === value)?.member.first_name ?? "Select Default Assignee"} {people?.map((person) => ( `${ active ? "text-white bg-theme" : "text-gray-900" } cursor-default select-none relative py-2 pl-3 pr-9` } value={person.member.id} > {({ selected, active }) => ( <> {person.member.first_name} {selected ? ( ) : null} )} ))}
)}
)} />
); }; export default ControlSettings;