diff --git a/phone/src/apps/bank/components/alert/Alert.tsx b/phone/src/apps/bank/components/alert/Alert.tsx new file mode 100644 index 0000000..2ba1e67 --- /dev/null +++ b/phone/src/apps/bank/components/alert/Alert.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import MuiAlert from "@material-ui/lab/Alert"; + +export function Alert(props) { + return ; +} + +export default Alert; diff --git a/phone/src/apps/bank/components/alert/BankAlert.tsx b/phone/src/apps/bank/components/alert/BankAlert.tsx new file mode 100644 index 0000000..cda9c51 --- /dev/null +++ b/phone/src/apps/bank/components/alert/BankAlert.tsx @@ -0,0 +1,43 @@ +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]) + + return ( + + + {message} + + + ); +}; \ No newline at end of file