import { FC } from "react"; // next import { useRouter } from "next/router"; // react-hook-form import { useFormContext, useFieldArray, Controller } from "react-hook-form"; // hooks import useWorkspaceMembers from "hooks/use-workspace-members"; // components import { ToggleSwitch, Input, CustomSelect, CustomSearchSelect, Avatar } from "components/ui"; import { IJiraImporterForm } from "types"; export const JiraImportUsers: FC = () => { const { control, watch, register, formState: { errors }, } = useFormContext(); const { fields } = useFieldArray({ control, name: "data.users", }); const router = useRouter(); const { workspaceSlug } = router.query; const { workspaceMembers: members } = useWorkspaceMembers(workspaceSlug?.toString()); const options = members?.map((member) => ({ value: member.member.email, query: (member.member.first_name && member.member.first_name !== "" ? member.member.first_name : member.member.email) + " " + member.member.last_name ?? "", content: (
{member.member.first_name && member.member.first_name !== "" ? member.member.first_name + " (" + member.member.email + ")" : member.member.email}
), })) ?? []; return (

Users

Update, invite or choose not to invite assignee

( )} />
{watch("data.invite_users") && (
Name
Import as
{fields.map((user, index) => (

{user.username}

( {Boolean(value) ? value : ("Ignore" as any)} } > Invite by email Map to existing Do not import )} />
{watch(`data.users.${index}.import`) === "invite" && ( )} {watch(`data.users.${index}.import`) === "map" && ( ( )} /> )}
))}
)}
); };