import { useState } from "react"; import { useRouter } from "next/router"; import { mutate } from "swr"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components import { ProjectMemberListItem, SendProjectInvitationModal } from "components/project"; // ui import { Button, Loader } from "@plane/ui"; // icons import { Search } from "lucide-react"; export const ProjectMemberList: React.FC = observer(() => { // router const router = useRouter(); const { workspaceSlug, projectId } = router.query; // store const { projectMember: { projectMembers, fetchProjectMembers }, } = useMobxStore(); // states const [inviteModal, setInviteModal] = useState(false); const [searchQuery, setSearchQuery] = useState(""); const searchedMembers = (projectMembers ?? []).filter((member) => { const fullName = `${member.member.first_name} ${member.member.last_name}`.toLowerCase(); const displayName = member.member.display_name.toLowerCase(); return displayName.includes(searchQuery.toLowerCase()) || fullName.includes(searchQuery.toLowerCase()); }); return ( <> setInviteModal(false)} onSuccess={() => { mutate(`PROJECT_INVITATIONS_${projectId?.toString()}`); fetchProjectMembers(workspaceSlug?.toString()!, projectId?.toString()!); }} />

Members

setSearchQuery(e.target.value)} />
{!projectMembers ? ( ) : (
{projectMembers.length > 0 ? searchedMembers.map((member) => ) : null} {searchedMembers.length === 0 && (

No matching member

)}
)} ); });