2019-09-30 04:46:05 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2024-03-16 02:36:41 +09:00
|
|
|
import { useCallback } from 'react';
|
|
|
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
|
|
|
import AlternateEmailIcon from '@/material-icons/400-24px/alternate_email.svg?react';
|
|
|
|
import BlockIcon from '@/material-icons/400-24px/block.svg?react';
|
|
|
|
import CampaignIcon from '@/material-icons/400-24px/campaign.svg?react';
|
|
|
|
import ReplyIcon from '@/material-icons/400-24px/reply.svg?react';
|
|
|
|
import VisibilityOffIcon from '@/material-icons/400-24px/visibility_off.svg?react';
|
|
|
|
import { blockAccount } from 'mastodon/actions/accounts';
|
|
|
|
import { closeModal } from 'mastodon/actions/modal';
|
|
|
|
import { Button } from 'mastodon/components/button';
|
|
|
|
import { Icon } from 'mastodon/components/icon';
|
|
|
|
|
|
|
|
export const BlockModal = ({ accountId, acct }) => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const handleClick = useCallback(() => {
|
|
|
|
dispatch(closeModal({ modalType: undefined, ignoreFocus: false }));
|
|
|
|
dispatch(blockAccount(accountId));
|
|
|
|
}, [dispatch, accountId]);
|
|
|
|
|
|
|
|
const handleCancel = useCallback(() => {
|
|
|
|
dispatch(closeModal({ modalType: undefined, ignoreFocus: false }));
|
|
|
|
}, [dispatch]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='modal-root__modal safety-action-modal'>
|
|
|
|
<div className='safety-action-modal__top'>
|
|
|
|
<div className='safety-action-modal__header'>
|
|
|
|
<div className='safety-action-modal__header__icon'>
|
|
|
|
<Icon icon={BlockIcon} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<h1><FormattedMessage id='block_modal.title' defaultMessage='Block user?' /></h1>
|
|
|
|
<div>@{acct}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-30 04:46:05 +09:00
|
|
|
|
2024-03-16 02:36:41 +09:00
|
|
|
<div className='safety-action-modal__bullet-points'>
|
|
|
|
<div>
|
|
|
|
<div className='safety-action-modal__bullet-points__icon'><Icon icon={CampaignIcon} /></div>
|
|
|
|
<div><FormattedMessage id='block_modal.they_will_know' defaultMessage="They can see that they're blocked." /></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div className='safety-action-modal__bullet-points__icon'><Icon icon={VisibilityOffIcon} /></div>
|
|
|
|
<div><FormattedMessage id='block_modal.they_cant_see_posts' defaultMessage="They can't see your posts and you won't see theirs." /></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div className='safety-action-modal__bullet-points__icon'><Icon icon={AlternateEmailIcon} /></div>
|
|
|
|
<div><FormattedMessage id='block_modal.you_wont_see_mentions' defaultMessage="You won't see posts that mentions them." /></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div className='safety-action-modal__bullet-points__icon'><Icon icon={ReplyIcon} /></div>
|
|
|
|
<div><FormattedMessage id='block_modal.they_cant_mention' defaultMessage="They can't mention or follow you." /></div>
|
|
|
|
</div>
|
2019-09-30 04:46:05 +09:00
|
|
|
</div>
|
2024-03-16 02:36:41 +09:00
|
|
|
</div>
|
2019-09-30 04:46:05 +09:00
|
|
|
|
2024-03-16 02:36:41 +09:00
|
|
|
<div className='safety-action-modal__bottom'>
|
|
|
|
<div className='safety-action-modal__actions'>
|
|
|
|
<button onClick={handleCancel} className='link-button'>
|
2019-09-30 04:46:05 +09:00
|
|
|
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' />
|
2024-03-16 02:36:41 +09:00
|
|
|
</button>
|
|
|
|
|
|
|
|
<Button onClick={handleClick}>
|
2019-09-30 04:46:05 +09:00
|
|
|
<FormattedMessage id='confirmations.block.confirm' defaultMessage='Block' />
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-16 02:36:41 +09:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2019-09-30 04:46:05 +09:00
|
|
|
|
2024-03-16 02:36:41 +09:00
|
|
|
BlockModal.propTypes = {
|
|
|
|
accountId: PropTypes.string.isRequired,
|
|
|
|
acct: PropTypes.string.isRequired,
|
|
|
|
};
|
2023-03-24 11:17:53 +09:00
|
|
|
|
2024-03-16 02:36:41 +09:00
|
|
|
export default BlockModal;
|