fix qmail notification

This commit is contained in:
PhilReact 2025-03-10 18:12:41 +02:00
parent 161ab4e761
commit b48dc0081f

View File

@ -103,16 +103,16 @@ export const QMailMessages = ({userName, userAddress}) => {
}, [getMails, userName, userAddress]); }, [getMails, userName, userAddress]);
const anyUnread = useMemo(()=> { const anyUnread = useMemo(()=> {
let unread = false let unread = false
mails.forEach((mail)=> { mails.forEach((mail)=> {
if(lastEnteredTimestamp && isLessThanOneWeekOld(mail?.created)){ if(!lastEnteredTimestamp && isLessThanOneWeekOld(mail?.created) || (lastEnteredTimestamp && isLessThanOneWeekOld(mail?.created) && lastEnteredTimestamp < mail?.created)){
unread = true unread = true
} }
}) })
return unread return unread
}, [mails, lastEnteredTimestamp]) }, [mails, lastEnteredTimestamp])
return ( return (
<Box <Box
@ -143,13 +143,13 @@ export const QMailMessages = ({userName, userAddress}) => {
Latest Q-Mails Latest Q-Mails
</Typography> </Typography>
<MarkEmailUnreadIcon sx={{ <MarkEmailUnreadIcon sx={{
color: anyUnread ? '--unread' : 'white' color: anyUnread ? 'var(--unread)' : 'white'
}}/> }}/>
{isExpanded ? <ExpandLessIcon sx={{ {isExpanded ? <ExpandLessIcon sx={{
marginLeft: 'auto' marginLeft: 'auto'
}} /> : ( }} /> : (
<ExpandMoreIcon sx={{ <ExpandMoreIcon sx={{
color: anyUnread ? '--unread' : 'white', color: anyUnread ? 'var(--unread)' : 'white',
marginLeft: 'auto' marginLeft: 'auto'
}} /> }} />
)} )}