import { MembershipRole } from "@prisma/client"; import classNames from "@calcom/lib/classNames"; import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Avatar, Button, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuTrigger, } from "@calcom/ui"; import { FiSlash, FiCheck, FiMoreHorizontal, FiX } from "@calcom/ui/components/icon"; interface Props { team: { id?: number; name?: string | null; slug?: string | null; logo?: string | null; bio?: string | null; hideBranding?: boolean | undefined; role: MembershipRole; accepted: boolean; }; key: number; onActionSelect: (text: string) => void; isLoading?: boolean; hideDropdown: boolean; setHideDropdown: (value: boolean) => void; } export default function TeamInviteListItem(props: Props) { const { t } = useLocale(); const utils = trpc.useContext(); const team = props.team; const acceptOrLeaveMutation = trpc.viewer.teams.acceptOrLeave.useMutation({ onSuccess: async () => { await utils.viewer.teams.get.invalidate(); await utils.viewer.teams.list.invalidate(); }, }); function acceptOrLeave(accept: boolean) { acceptOrLeaveMutation.mutate({ teamId: team?.id as number, accept, }); } const acceptInvite = () => acceptOrLeave(true); const declineInvite = () => acceptOrLeave(false); const isInvitee = !props.team.accepted; if (!team) return <>>; const teamInfo = (