2023-05-08 15:12:12 +02:00
|
|
|
import React, { useCallback } from 'react';
|
2023-05-10 12:59:29 +02:00
|
|
|
|
|
|
|
import type { InjectedIntl } from 'react-intl';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
2023-05-09 03:11:56 +02:00
|
|
|
import { IconButton } from './icon_button';
|
2023-05-08 15:12:12 +02:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
unblockDomain: {
|
|
|
|
id: 'account.unblock_domain',
|
|
|
|
defaultMessage: 'Unblock domain {domain}',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-05-10 12:59:29 +02:00
|
|
|
interface Props {
|
2023-05-08 15:12:12 +02:00
|
|
|
domain: string;
|
|
|
|
onUnblockDomain: (domain: string) => void;
|
|
|
|
intl: InjectedIntl;
|
2023-05-10 12:59:29 +02:00
|
|
|
}
|
2023-05-08 15:12:12 +02:00
|
|
|
const _Domain: React.FC<Props> = ({ domain, onUnblockDomain, intl }) => {
|
|
|
|
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>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Domain = injectIntl(_Domain);
|