1 import { c } from 'ttag';
3 import type { ButtonProps } from '@proton/atoms';
4 import { Button } from '@proton/atoms';
5 import useDownloadRecoveryFile from '@proton/components/hooks/recoveryFile/useDownloadRecoveryFile';
6 import useNotifications from '@proton/components/hooks/useNotifications';
7 import { useLoading } from '@proton/hooks';
9 interface Props extends Omit<ButtonProps, 'onClick'> {}
11 const ExportRecoveryFileButton = ({ children = c('Action').t`Download recovery file`, ...rest }: Props) => {
12 const downloadRecoveryFile = useDownloadRecoveryFile();
13 const [loading, withLoading] = useLoading();
14 const { createNotification } = useNotifications();
16 const handleClick = async () => {
18 await downloadRecoveryFile();
19 createNotification({ text: c('Info').t`Recovery file downloaded` });
22 text: c('Info').t`Unable to verify recovery file signature. Please contact support.`,
29 <Button onClick={() => withLoading(handleClick())} loading={loading} {...rest}>
35 export default ExportRecoveryFileButton;