import React from "react"; import { observer } from "mobx-react-lite"; import { Ban } from "lucide-react"; // hooks import { Avatar, CustomSearchSelect } from "@plane/ui"; import { useMember } from "@/hooks/store"; // ui type Props = { value: any; onChange: (val: string) => void; isDisabled?: boolean; }; export const MemberSelect: React.FC = observer((props) => { const { value, onChange, isDisabled = false } = props; // store hooks const { project: { projectMemberIds, getProjectMemberDetails }, } = useMember(); const options = projectMemberIds ?.map((userId) => { const memberDetails = getProjectMemberDetails(userId); if (!memberDetails?.member) return; return { value: `${memberDetails?.member.id}`, query: `${memberDetails?.member.display_name}`, content: (
{memberDetails?.member.display_name}
), }; }) .filter((option) => !!option) as | { value: string; query: string; content: React.JSX.Element; }[] | undefined; const selectedOption = getProjectMemberDetails(value); return ( {selectedOption && } {selectedOption ? ( selectedOption.member?.display_name ) : (
None
)} } buttonClassName="!px-3 !py-2" options={ options && options && [ ...options, { value: "none", query: "none", content: (
None
), }, ] } maxHeight="md" onChange={onChange} disabled={isDisabled} /> ); });