2023-05-23 08:52:27 +00:00
|
|
|
import { useCallback } from 'react';
|
2023-05-10 10:59:29 +00:00
|
|
|
|
2023-05-31 21:43:39 +00:00
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
2023-05-10 10:59:29 +00:00
|
|
|
|
2023-05-09 01:11:56 +00:00
|
|
|
import { IconButton } from './icon_button';
|
2023-05-08 13:12:12 +00:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
unblockDomain: {
|
|
|
|
id: 'account.unblock_domain',
|
|
|
|
defaultMessage: 'Unblock domain {domain}',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-05-10 10:59:29 +00:00
|
|
|
interface Props {
|
2023-05-08 13:12:12 +00:00
|
|
|
domain: string;
|
|
|
|
onUnblockDomain: (domain: string) => void;
|
2023-05-10 10:59:29 +00:00
|
|
|
}
|
2023-05-31 21:43:39 +00:00
|
|
|
|
|
|
|
export const Domain: React.FC<Props> = ({ domain, onUnblockDomain }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
2023-05-08 13:12:12 +00: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'
|
|
|
|
title={intl.formatMessage(messages.unblockDomain, { domain })}
|
|
|
|
onClick={handleDomainUnblock}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|