pleroma/app/soapbox/features/ui/components/modals/account-moderation-modal.tsx

51 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-09-11 09:25:48 -07:00
import React from 'react';
import { FormattedMessage } from 'react-intl';
2022-09-11 09:25:48 -07:00
import MissingIndicator from 'soapbox/components/missing_indicator';
import { Button, HStack, Modal } from 'soapbox/components/ui';
2022-09-11 09:25:48 -07:00
import { useAppSelector } from 'soapbox/hooks';
import { makeGetAccount } from 'soapbox/selectors';
const getAccount = makeGetAccount();
interface IAccountModerationModal {
/** Action to close the modal. */
onClose: (type: string) => void,
/** ID of the account to moderate. */
accountId: string,
}
/** Moderator actions against accounts. */
const AccountModerationModal: React.FC<IAccountModerationModal> = ({ onClose, accountId }) => {
const account = useAppSelector(state => getAccount(state, accountId));
const handleClose = () => onClose('ACCOUNT_MODERATION');
if (!account) {
return (
<Modal onClose={handleClose}>
<MissingIndicator />
</Modal>
);
}
const handleAdminFE = () => {
window.open(`/pleroma/admin/#/users/${account.id}/`, '_blank');
};
2022-09-11 09:25:48 -07:00
return (
<Modal
title={<FormattedMessage id='account_moderation_modal.title' defaultMessage='Moderate @{acct}' values={{ acct: account.acct }} />}
2022-09-11 09:25:48 -07:00
onClose={handleClose}
>
<HStack justifyContent='center'>
<Button icon={require('@tabler/icons/external-link.svg')} size='sm' theme='secondary' onClick={handleAdminFE}>
<FormattedMessage id='account_moderation_modal.admin_fe' defaultMessage='Open in AdminFE' />
</Button>
</HStack>
2022-09-11 09:25:48 -07:00
</Modal>
);
};
export default AccountModerationModal;