import { useState } from 'react';
import {
Box,
ButtonBase,
Card,
MenuItem,
Popover,
Tooltip,
Typography,
useTheme,
} from '@mui/material';
import NotificationsIcon from '@mui/icons-material/Notifications';
import AccountBalanceWalletIcon from '@mui/icons-material/AccountBalanceWallet';
import { formatDate } from '../utils/time';
import { useHandlePaymentNotification } from '../hooks/useHandlePaymentNotification';
import { executeEvent } from '../utils/events';
export const GeneralNotifications = ({ address }) => {
const [anchorEl, setAnchorEl] = useState(null);
const {
latestTx,
getNameOrAddressOfSenderMiddle,
hasNewPayment,
setLastEnteredTimestampPayment,
nameAddressOfSender,
} = useHandlePaymentNotification(address);
const handlePopupClick = (event) => {
event.stopPropagation(); // Prevent parent onClick from firing
setAnchorEl(event.currentTarget);
};
const theme = useTheme();
return (
<>
{
handlePopupClick(e);
}}
style={{}}
>
PAYMENT NOTIFICATION
}
placement="left"
arrow
sx={{ fontSize: '24' }}
slotProps={{
tooltip: {
sx: {
color: '#ffffff',
backgroundColor: '#444444',
},
},
arrow: {
sx: {
color: '#444444',
},
},
}}
>
{
if (hasNewPayment) {
setLastEnteredTimestampPayment(Date.now());
}
setAnchorEl(null);
}} // Close popover on click outside
>
{!hasNewPayment && (
No new notifications
)}
{hasNewPayment && (
)}
>
);
};