import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { showToast, Switch } from "@calcom/ui"; const DisableTeamImpersonation = ({ teamId, memberId, disabled, }: { teamId: number; memberId: number; disabled: boolean; }) => { const { t } = useLocale(); const utils = trpc.useContext(); const query = trpc.viewer.teams.getMembershipbyUser.useQuery({ teamId, memberId }); const mutation = trpc.viewer.teams.updateMembership.useMutation({ onSuccess: async () => { showToast(t("your_user_profile_updated_successfully"), "success"); await utils.viewer.teams.getMembershipbyUser.invalidate(); }, async onSettled() { await utils.viewer.public.i18n.invalidate(); }, }); if (query.isLoading) return <>; return ( <>

{t("user_impersonation_heading")}

{t("team_impersonation_description")}

{ mutation.mutate({ teamId, memberId, disableImpersonation: !isChecked }); }} />
); }; export default DisableTeamImpersonation;