import React, { useCallback } from 'react'; import { approveUsers, deleteUsers } from 'soapbox/actions/admin'; import { AuthorizeRejectButtons } from 'soapbox/components/authorize-reject-buttons'; import { Stack, HStack, Text } from 'soapbox/components/ui'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import { makeGetAccount } from 'soapbox/selectors'; interface IUnapprovedAccount { accountId: string } /** Displays an unapproved account for moderation purposes. */ const UnapprovedAccount: React.FC = ({ accountId }) => { const dispatch = useAppDispatch(); const getAccount = useCallback(makeGetAccount(), []); const account = useAppSelector(state => getAccount(state, accountId)); const adminAccount = useAppSelector(state => state.admin.users.get(accountId)); if (!account) return null; const handleApprove = () => dispatch(approveUsers([account.id])); const handleReject = () => dispatch(deleteUsers([account.id])); return ( @{account.get('acct')} {adminAccount?.invite_request || ''} ); }; export default UnapprovedAccount;