1 import { c } from 'ttag';
3 import type { ModalStateProps } from '@proton/components';
4 import { ModalTwo, useModalTwoStatic, useNotifications } from '@proton/components';
5 import { useLoading } from '@proton/hooks';
7 import { useLockedVolume } from '../../../store';
8 import FilesRecoveryState from './FilesRecoveryState';
10 const FilesRecoveryModal = ({ onClose, ...modalProps }: ModalStateProps) => {
11 const { restoreVolumes } = useLockedVolume();
12 const [recovering, withRecovering] = useLoading();
13 const { createNotification } = useNotifications();
15 const handleRecoveryClick = async () => {
17 restoreVolumes(new AbortController().signal)
20 text: c('Success').t`Recovery has started`,
23 .catch(() => onClose?.())
30 <ModalTwo onClose={onClose} {...modalProps}>
31 <FilesRecoveryState recovering={recovering} onRecovery={handleRecoveryClick} onClose={onClose} />
36 export default FilesRecoveryModal;
38 export const useFilesRecoveryModal = () => {
39 return useModalTwoStatic(FilesRecoveryModal);