1 import type { PropsWithChildren } from 'react';
3 import { c } from 'ttag';
5 import { Button } from '@proton/atoms';
6 import type { ModalProps } from '@proton/components/components/modalTwo/Modal';
7 import Prompt from '@proton/components/components/prompt/Prompt';
8 import { useLoading } from '@proton/hooks';
10 interface Props extends ModalProps, PropsWithChildren {
11 onDeleteAddress: () => Promise<void>;
16 const DeleteAddressPrompt = ({ title, email, onDeleteAddress, children, type, ...rest }: Props) => {
17 const [loading, withLoading] = useLoading();
20 <strong key="address" className="text-break">
29 ? c('Delete address prompt').t`Delete address permanently?`
30 : c('Delete address prompt').t`Delete address?`
33 onClose={rest.onClose}
37 withLoading(onDeleteAddress().then(rest.onClose));
41 >{c('Delete address prompt').t`Delete address`}</Button>,
42 <Button onClick={rest.onClose} disabled={loading}>{c('Action').t`Cancel`}</Button>,
46 if (type === 'permanent') {
49 {c('Delete address prompt')
50 .jt`Once deleted, this address ${address} can't be used again by anyone else.`}
53 {c('Delete address prompt').t`You can only delete 1 address per year.`}
59 {c('Delete address prompt')
60 .jt`Please note that if you delete this address ${address}, you will no longer be able to send or receive emails using this address.`}
63 {c('Delete address prompt').t`Are you sure you want to delete this address?`}
67 {type === 'permanent'}
73 export default DeleteAddressPrompt;