2024-04-26 02:26:05 +09:00
|
|
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
|
|
|
2024-07-18 23:36:09 +09:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2024-04-27 00:33:15 +09:00
|
|
|
import GavelIcon from '@/material-icons/400-24px/gavel.svg?react';
|
2024-04-26 02:26:05 +09:00
|
|
|
import { Icon } from 'mastodon/components/icon';
|
2024-07-18 23:36:09 +09:00
|
|
|
import type { AccountWarningAction } from 'mastodon/models/notification_group';
|
2024-04-26 02:26:05 +09:00
|
|
|
|
|
|
|
// This needs to be kept in sync with app/models/account_warning.rb
|
|
|
|
const messages = defineMessages({
|
|
|
|
none: {
|
|
|
|
id: 'notification.moderation_warning.action_none',
|
|
|
|
defaultMessage: 'Your account has received a moderation warning.',
|
|
|
|
},
|
|
|
|
disable: {
|
|
|
|
id: 'notification.moderation_warning.action_disable',
|
|
|
|
defaultMessage: 'Your account has been disabled.',
|
|
|
|
},
|
|
|
|
mark_statuses_as_sensitive: {
|
|
|
|
id: 'notification.moderation_warning.action_mark_statuses_as_sensitive',
|
|
|
|
defaultMessage: 'Some of your posts have been marked as sensitive.',
|
|
|
|
},
|
|
|
|
delete_statuses: {
|
|
|
|
id: 'notification.moderation_warning.action_delete_statuses',
|
|
|
|
defaultMessage: 'Some of your posts have been removed.',
|
|
|
|
},
|
|
|
|
sensitive: {
|
|
|
|
id: 'notification.moderation_warning.action_sensitive',
|
|
|
|
defaultMessage: 'Your posts will be marked as sensitive from now on.',
|
|
|
|
},
|
|
|
|
silence: {
|
|
|
|
id: 'notification.moderation_warning.action_silence',
|
|
|
|
defaultMessage: 'Your account has been limited.',
|
|
|
|
},
|
|
|
|
suspend: {
|
|
|
|
id: 'notification.moderation_warning.action_suspend',
|
|
|
|
defaultMessage: 'Your account has been suspended.',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
interface Props {
|
2024-07-18 23:36:09 +09:00
|
|
|
action: AccountWarningAction;
|
2024-04-26 02:26:05 +09:00
|
|
|
id: string;
|
2024-07-18 23:36:09 +09:00
|
|
|
hidden?: boolean;
|
|
|
|
unread?: boolean;
|
2024-04-26 02:26:05 +09:00
|
|
|
}
|
|
|
|
|
2024-07-18 23:36:09 +09:00
|
|
|
export const ModerationWarning: React.FC<Props> = ({
|
|
|
|
action,
|
|
|
|
id,
|
|
|
|
hidden,
|
|
|
|
unread,
|
|
|
|
}) => {
|
2024-04-26 02:26:05 +09:00
|
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
if (hidden) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-07-18 23:36:09 +09:00
|
|
|
<div
|
|
|
|
role='button'
|
|
|
|
className={classNames(
|
|
|
|
'notification-group notification-group--link notification-group--moderation-warning focusable',
|
|
|
|
{ 'notification-group--unread': unread },
|
|
|
|
)}
|
|
|
|
tabIndex={0}
|
2024-04-26 02:26:05 +09:00
|
|
|
>
|
2024-07-18 23:36:09 +09:00
|
|
|
<div className='notification-group__icon'>
|
|
|
|
<Icon id='warning' icon={GavelIcon} />
|
|
|
|
</div>
|
2024-04-26 02:26:05 +09:00
|
|
|
|
2024-07-18 23:36:09 +09:00
|
|
|
<div className='notification-group__main'>
|
2024-04-26 02:26:05 +09:00
|
|
|
<p>{intl.formatMessage(messages[action])}</p>
|
2024-07-18 23:36:09 +09:00
|
|
|
<a
|
|
|
|
href={`/disputes/strikes/${id}`}
|
|
|
|
target='_blank'
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
className='link-button'
|
|
|
|
>
|
2024-04-26 02:26:05 +09:00
|
|
|
<FormattedMessage
|
|
|
|
id='notification.moderation-warning.learn_more'
|
|
|
|
defaultMessage='Learn more'
|
|
|
|
/>
|
2024-07-18 23:36:09 +09:00
|
|
|
</a>
|
2024-04-26 02:26:05 +09:00
|
|
|
</div>
|
2024-07-18 23:36:09 +09:00
|
|
|
</div>
|
2024-04-26 02:26:05 +09:00
|
|
|
);
|
|
|
|
};
|