mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(phone/bank): remove alert component
This commit is contained in:
1 parent
cea0bd653b
commit
1afca13862
3 files changed
-53
No files matched your search
@@ -14,7 +14,6 @@ import { NavigationBar } from './navigation/NavigationBar';
|
||||
import { BankHome } from './home/BankHome';
|
||||
import { BankAccount } from './account/BankAccount';
|
||||
import { TransactionList } from './transactions/TransactionList';
|
||||
import { BankAlert } from './alert/BankAlert';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
|
||||
InjectDebugData([
|
||||
@@ -110,7 +109,6 @@ export const BankApp = () => {
|
||||
<Route path='/bank/account' exact component={BankAccount} />
|
||||
<Route path='/bank/transactions' exact component={TransactionList} />
|
||||
</Switch>
|
||||
<BankAlert />
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react';
|
||||
import MuiAlert from '@material-ui/lab/Alert';
|
||||
|
||||
export function Alert(props) {
|
||||
return <MuiAlert elevation={6} variant='filled' {...props} />;
|
||||
}
|
||||
|
||||
export default Alert;
|
||||
@@ -1,43 +0,0 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useBankAlert } from '../../hooks/useBankAlert';
|
||||
import Snackbar from '@material-ui/core/Snackbar';
|
||||
import Alert from './Alert';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const BankAlert = () => {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const { bankAlert, setBankAlert } = useBankAlert();
|
||||
const [message, setMessage] = useState(null);
|
||||
const [severity, setSeverity] = useState('');
|
||||
|
||||
const _handleClose = () => {
|
||||
setOpen(false);
|
||||
setBankAlert(null);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (bankAlert === true) {
|
||||
setOpen(true);
|
||||
setMessage(t('APPS_BANK_ALERT_TRANSFER_SUCCESS'));
|
||||
setSeverity('success');
|
||||
} else if (bankAlert === false) {
|
||||
setOpen(true);
|
||||
setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE'));
|
||||
setSeverity('error');
|
||||
}
|
||||
}, [bankAlert, t]);
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
style={{ width: '80%' }}
|
||||
open={open}
|
||||
autoHideDuration={6000}
|
||||
onClose={_handleClose}
|
||||
>
|
||||
<Alert onClose={_handleClose} severity={severity}>
|
||||
{message}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user