import { FC } from "react"; import { useRouter } from "next/router"; import useSWR from "swr"; import { useFormContext, useFieldArray, Controller } from "react-hook-form"; // fetch keys import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; // services import { WorkspaceService } from "services/workspace.service"; // components import { Avatar } from "components/ui"; import { CustomSelect, CustomSearchSelect, Input, ToggleSwitch } from "@plane/ui"; // types import { IJiraImporterForm } from "types"; const workspaceService = new WorkspaceService(); export const JiraImportUsers: FC = () => { const router = useRouter(); const { workspaceSlug } = router.query; // form info const { control, watch, formState: { errors }, } = useFormContext(); const { fields } = useFieldArray({ control, name: "data.users", }); const { data: members } = useSWR( workspaceSlug ? WORKSPACE_MEMBERS(workspaceSlug?.toString() ?? "") : null, workspaceSlug ? () => workspaceService.fetchWorkspaceMembers(workspaceSlug?.toString() ?? "") : null ); const options = members?.map((member) => ({ value: member.member.email, query: member.member.display_name ?? "", content: (
{member.member.display_name}
), })); 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" && ( ( )} /> )}
))}
)}
); };