change financial and pixel perfect

This commit is contained in:
hamid zarghami
2025-03-02 18:27:57 +03:30
parent 7317fb26cf
commit 632c8f4c4e
21 changed files with 8234 additions and 154 deletions
+47 -2
View File
@@ -6,15 +6,18 @@ import { clx } from '../../helpers/utils';
import StatusCircle from '../../components/StatusCircle';
import { useOutsideClick } from '../../hooks/useOutSideClick';
import { useGetNotification, useReadAll } from './hooks/useNotificationData';
import { NotificationItemType } from './types/NotificationTypes';
import { NotificationItemType, NotificationTypeEnum } from './types/NotificationTypes';
import { timeAgo } from '../../config/func';
import InfiniteScroll from 'react-infinite-scroll-component';
import MoonLoader from "react-spinners/MoonLoader"
import Button from '../../components/Button';
import { toast } from 'react-toastify';
import { useGetDashboardSummary } from '../home/hooks/useHomeData';
import { useNavigate } from 'react-router-dom';
import { Pages } from '../../config/Pages';
const Notifications: FC = () => {
const navigate = useNavigate()
const { t } = useTranslation('global');
const ref = useOutsideClick(() => setShowModal(false));
const [activeTab, setActiveTab] = useState<'all' | 'read' | 'unread'>('all');
@@ -34,6 +37,48 @@ const Notifications: FC = () => {
})
}
const handleRedirect = (type: NotificationTypeEnum) => {
switch (type) {
case NotificationTypeEnum.USER_LOGIN:
break;
case NotificationTypeEnum.ANNOUNCEMENT:
navigate(Pages.announcement.list)
break;
case NotificationTypeEnum.WALLET_CHARGE:
navigate(Pages.transactions)
break;
case NotificationTypeEnum.WALLET_DEDUCTION:
navigate(Pages.transactions)
break;
case NotificationTypeEnum.BILL_INVOICE_REMINDER:
navigate(Pages.receipts.index)
break;
case NotificationTypeEnum.BILL_INVOICE:
navigate(Pages.receipts.index)
break;
case NotificationTypeEnum.CREATE_INVOICE:
navigate(Pages.receipts.index)
break;
case NotificationTypeEnum.CREATE_SERVICE:
navigate(Pages.services.other)
break;
case NotificationTypeEnum.UNBLOCK_SERVICE:
navigate(Pages.services.other)
break;
case NotificationTypeEnum.BLOCK_SERVICE:
navigate(Pages.services.other)
break;
case NotificationTypeEnum.ANSWER_TICKET:
navigate(Pages.ticket.list)
break;
case NotificationTypeEnum.CREATE_TICKET:
navigate(Pages.ticket.list)
break;
default:
break
}
}
return (
<div ref={ref}>
<div onClick={() => setShowModal(!showModal)} className='relative cursor-pointer'>
@@ -106,7 +151,7 @@ const Notifications: FC = () => {
>
{
posts.map((item: NotificationItemType) => (
<div className="bg-white h-fit gap-4 items-start rounded-xl bg-opacity-60 p-3 mb-4 flex" key={item.id}>
<div onClick={() => handleRedirect(item.type)} className="bg-white h-fit gap-4 items-start rounded-xl bg-opacity-60 p-3 mb-4 flex" key={item.id}>
<div className="mt-1">
<StatusCircle color="#00BA4B" />
</div>