From 9b675f470d5543e6d0868d1baf7f411da6576d4b Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Sat, 12 Apr 2025 18:17:57 +0200 Subject: [PATCH] Set background to notification icon --- src/components/Desktop/DesktopHeader.tsx | 172 ++++++++++--------- src/components/GeneralNotifications.tsx | 209 +++++++++++++---------- 2 files changed, 206 insertions(+), 175 deletions(-) diff --git a/src/components/Desktop/DesktopHeader.tsx b/src/components/Desktop/DesktopHeader.tsx index 4820054..9dbe111 100644 --- a/src/components/Desktop/DesktopHeader.tsx +++ b/src/components/Desktop/DesktopHeader.tsx @@ -1,47 +1,55 @@ -import * as React from "react"; +import * as React from 'react'; import { BottomNavigation, BottomNavigationAction, ButtonBase, Typography, -} from "@mui/material"; -import { Home, Groups, Message, ShowChart } from "@mui/icons-material"; -import Box from "@mui/material/Box"; -import BottomLogo from "../../assets/svgs/BottomLogo5.svg"; -import { CustomSvg } from "../../common/CustomSvg"; -import { WalletIcon } from "../../assets/Icons/WalletIcon"; -import { HubsIcon } from "../../assets/Icons/HubsIcon"; -import { TradingIcon } from "../../assets/Icons/TradingIcon"; -import { MessagingIcon } from "../../assets/Icons/MessagingIcon"; -import { HomeIcon } from "../../assets/Icons/HomeIcon"; -import { NotificationIcon2 } from "../../assets/Icons/NotificationIcon2"; -import { ChatIcon } from "../../assets/Icons/ChatIcon"; -import { ThreadsIcon } from "../../assets/Icons/ThreadsIcon"; -import { MembersIcon } from "../../assets/Icons/MembersIcon"; -import { AdminsIcon } from "../../assets/Icons/AdminsIcon"; +} from '@mui/material'; +import { Home, Groups, Message, ShowChart } from '@mui/icons-material'; +import Box from '@mui/material/Box'; +import BottomLogo from '../../assets/svgs/BottomLogo5.svg'; +import { CustomSvg } from '../../common/CustomSvg'; +import { HubsIcon } from '../../assets/Icons/HubsIcon'; +import { TradingIcon } from '../../assets/Icons/TradingIcon'; +import { MessagingIcon } from '../../assets/Icons/MessagingIcon'; +import { HomeIcon } from '../../assets/Icons/HomeIcon'; +import { NotificationIcon2 } from '../../assets/Icons/NotificationIcon2'; +import { ChatIcon } from '../../assets/Icons/ChatIcon'; +import { ThreadsIcon } from '../../assets/Icons/ThreadsIcon'; +import { MembersIcon } from '../../assets/Icons/MembersIcon'; +import { AdminsIcon } from '../../assets/Icons/AdminsIcon'; import LockIcon from '@mui/icons-material/Lock'; import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred'; -const IconWrapper = ({ children, label, color, selected, selectColor, customHeight }) => { +const IconWrapper = ({ + children, + label, + color, + selected, + selectColor, + customHeight, +}) => { return ( {children} { const [value, setValue] = React.useState(0); return ( - + {isPrivate && ( - + )} {isPrivate === false && ( - + )} - {selectedGroup?.groupId === '0' ? 'General' :selectedGroup?.groupName} + {selectedGroup?.groupId === '0' + ? 'General' + : selectedGroup?.groupName} - { - goToAnnouncements() + goToAnnouncements(); }} > @@ -158,11 +173,11 @@ export const DesktopHeader = ({ { - goToChat() + goToChat(); }} > @@ -184,12 +199,11 @@ export const DesktopHeader = ({ { - setGroupSection("forum"); - + setGroupSection('forum'); }} > { - setOpenManageMembers(true) - + setOpenManageMembers(true); }} > { - setGroupSection("adminSpace"); - + setGroupSection('adminSpace'); }} > diff --git a/src/components/GeneralNotifications.tsx b/src/components/GeneralNotifications.tsx index c7336dc..3235fbb 100644 --- a/src/components/GeneralNotifications.tsx +++ b/src/components/GeneralNotifications.tsx @@ -1,5 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; - +import { useState } from 'react'; import { Box, ButtonBase, @@ -8,58 +7,72 @@ import { Popover, Tooltip, Typography, -} 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"; + 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, + + const { + latestTx, getNameOrAddressOfSenderMiddle, - hasNewPayment, setLastEnteredTimestampPayment, nameAddressOfSender} = useHandlePaymentNotification(address) - + 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", - }, - }, - }} - > - + PAYMENT NOTIFICATION + + } + placement="left" + arrow + sx={{ fontSize: '24' }} + slotProps={{ + tooltip: { + sx: { + color: '#ffffff', + backgroundColor: '#444444', + }, + }, + arrow: { + sx: { + color: '#444444', + }, + }, }} - /> + > + @@ -67,81 +80,91 @@ export const GeneralNotifications = ({ address }) => { open={!!anchorEl} anchorEl={anchorEl} onClose={() => { - if(hasNewPayment){ - setLastEnteredTimestampPayment(Date.now()) + if (hasNewPayment) { + setLastEnteredTimestampPayment(Date.now()); } - setAnchorEl(null) - + setAnchorEl(null); }} // Close popover on click outside > - {!hasNewPayment && No new notifications} + {!hasNewPayment && ( + + No new notifications + + )} {hasNewPayment && ( { - setAnchorEl(null) - executeEvent('openWalletsApp', {}) + onClick={() => { + setAnchorEl(null); + executeEvent('openWalletsApp', {}); }} > - - - {" "} - {formatDate(latestTx?.timestamp)} - - - - {latestTx?.amount} - - {nameAddressOfSender.current[latestTx?.creatorAddress] || getNameOrAddressOfSenderMiddle(latestTx?.creatorAddress)} - + > + {' '} + {formatDate(latestTx?.timestamp)} + + + {latestTx?.amount} + + + {nameAddressOfSender.current[latestTx?.creatorAddress] || + getNameOrAddressOfSenderMiddle(latestTx?.creatorAddress)} + )}