2023-05-23 09:52:27 +01:00
|
|
|
import { useCallback } from 'react';
|
2023-05-10 11:59:29 +01:00
|
|
|
|
2023-05-31 22:43:39 +01:00
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
2023-05-10 11:59:29 +01:00
|
|
|
|
2024-01-12 20:16:48 +00:00
|
|
|
import LockOpenIcon from 'mastodon/../material-icons/400-24px/lock_open.svg?react';
|
2023-10-24 18:45:08 +01:00
|
|
|
|
2023-05-09 02:11:56 +01:00
|
|
|
import { IconButton } from './icon_button';
|
2023-05-08 14:12:12 +01:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
unblockDomain: {
|
|
|
|
id: 'account.unblock_domain',
|
|
|
|
defaultMessage: 'Unblock domain {domain}',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-05-10 11:59:29 +01:00
|
|
|
interface Props {
|
2023-05-08 14:12:12 +01:00
|
|
|
domain: string;
|
|
|
|
onUnblockDomain: (domain: string) => void;
|
2023-05-10 11:59:29 +01:00
|
|
|
}
|
2023-05-31 22:43:39 +01:00
|
|
|
|
|
|
|
export const Domain: React.FC<Props> = ({ domain, onUnblockDomain }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
2023-05-08 14:12:12 +01:00
|
|
|
const handleDomainUnblock = useCallback(() => {
|
|
|
|
onUnblockDomain(domain);
|
|
|
|
}, [domain, onUnblockDomain]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='domain'>
|
|
|
|
<div className='domain__wrapper'>
|
|
|
|
<span className='domain__domain-name'>
|
|
|
|
<strong>{domain}</strong>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<div className='domain__buttons'>
|
|
|
|
<IconButton
|
|
|
|
active
|
|
|
|
icon='unlock'
|
2023-10-24 18:45:08 +01:00
|
|
|
iconComponent={LockOpenIcon}
|
2023-05-08 14:12:12 +01:00
|
|
|
title={intl.formatMessage(messages.unblockDomain, { domain })}
|
|
|
|
onClick={handleDomainUnblock}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|