2020-07-28 03:12:28 +05:30
import React , { ComponentType , useCallback , useState } from 'react' ;
2020-07-27 12:58:37 +05:30
import { FormattedMessage as Message } from 'react-intl' ;
import { Helmet } from 'react-helmet-async' ;
import { Button } from 'app/components/ui/form' ;
import styles from './accountDeleted.scss' ;
interface Props {
2020-07-28 03:12:28 +05:30
onRestore ? : ( ) = > Promise < void > ;
2020-07-27 12:58:37 +05:30
}
const AccountDeleted : ComponentType < Props > = ( { onRestore } ) = > {
2020-07-28 03:12:28 +05:30
const [ isSubmitted , setIsSubmitted ] = useState < boolean > ( false ) ;
const onRestoreClick = useCallback ( ( ) = > {
if ( ! onRestore ) {
return ;
}
setIsSubmitted ( true ) ;
onRestore ( ) . finally ( ( ) = > setIsSubmitted ( false ) ) ;
} , [ onRestore ] ) ;
2020-07-27 12:58:37 +05:30
return (
< div className = { styles . wrapper } >
2020-07-27 16:55:51 +05:30
< Message key = "accountDeleted" defaultMessage = "Account is deleted" >
2020-07-27 12:58:37 +05:30
{ ( pageTitle : string ) = > (
< h2 className = { styles . title } >
< Helmet title = { pageTitle } / >
{ pageTitle }
< / h2 >
) }
< / Message >
< div className = { styles . description } >
< Message
key = "accountDeletedDescription"
2020-07-27 16:55:51 +05:30
defaultMessage = "The account has been marked for deletion and will be permanently removed within a week. Until then, all account activities have been suspended."
2020-07-27 12:58:37 +05:30
/ >
< / div >
< div className = { styles . description } >
< Message
key = "ifYouWantToRestoreAccount"
defaultMessage = "If you want to restore your account, click on the button below."
/ >
< / div >
2020-07-28 03:12:28 +05:30
< Button onClick = { onRestoreClick } color = "black" small loading = { isSubmitted } >
2020-07-27 12:58:37 +05:30
< Message key = "restoreAccount" defaultMessage = "Restore account" / >
< / Button >
< / div >
) ;
} ;
export default AccountDeleted ;