import type { IRole, IUser, Serialized } from '@rocket.chat/core-typings'; import { Box, Callout } from '@rocket.chat/fuselage'; import { useStableCallback } from '@rocket.chat/fuselage-hooks'; import { useTranslation } from 'react-i18next'; import AdminUserForm from './AdminUserForm'; import { FormSkeleton } from '../../../components/Skeleton'; import { useUserInfoQuery } from '../../../hooks/useUserInfoQuery'; export type AdminUserFormWithDataProps = { uid: IUser['_id']; onReload: () => void; context: string; roleData: { roles: Serialized[] } | undefined; roleError: Error | null; }; const AdminUserFormWithData = ({ uid, onReload, context, roleData, roleError }: AdminUserFormWithDataProps) => { const { t } = useTranslation(); const { data, isPending, isError, refetch } = useUserInfoQuery({ userId: uid }); const handleReload = useStableCallback(() => { onReload(); refetch(); }); if (isPending) { return ( ); } if (isError) { return ( {t('User_not_found')} ); } if (data?.user && !!data.user.federated) { return ( {t('Edit_Federated_User_Not_Allowed')} ); } return ( ); }; export default AdminUserFormWithData;