mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
feat(bank/nui): bank notification component
This commit is contained in:
1 parent
b8ef73b95f
commit
25d64b486f
1 file changed
+45
@@ -0,0 +1,45 @@
|
|||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import Notification from "../../../../ui/components/Notification";
|
||||||
|
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import useStyles from './notification.style';
|
||||||
|
import { useBankNotification } from "../../hooks/useBankNotification";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { faWonSign } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
export const BankNotification = () => {
|
||||||
|
const { notification } = useBankNotification()
|
||||||
|
const classes = useStyles()
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [visible, setVisible ] = useState(false);
|
||||||
|
const { config } = usePhone()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (notification) {
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
}, [notification?.id])
|
||||||
|
|
||||||
|
if (!config?.bank.showNotifications || !notification) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Notification
|
||||||
|
key={notification.id}
|
||||||
|
open={visible}
|
||||||
|
handleClose={() => setVisible(false)}
|
||||||
|
>
|
||||||
|
<div className={classes.content}>
|
||||||
|
<div className={classes.title}>
|
||||||
|
<div className={classes.titleLeft}>
|
||||||
|
<div className={classes.icon}>
|
||||||
|
<FontAwesomeIcon icon={faWonSign} />
|
||||||
|
</div>
|
||||||
|
<div className={classes.heading}>{notification.type}</div>
|
||||||
|
</div>
|
||||||
|
<div className={classes.justNow}>{t("APPS_BANK_TIME_JUST_NOW")}</div>
|
||||||
|
</div>
|
||||||
|
<div className={classes.message}>{notification.source} sent you ${notification.amount} || {notification.message}</div>
|
||||||
|
</div>
|
||||||
|
</Notification>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user