change financial and pixel perfect
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -4,4 +4,28 @@ export type NotificationItemType = {
|
||||
message: string;
|
||||
createdAt: string;
|
||||
isRead: boolean;
|
||||
type: NotificationTypeEnum;
|
||||
};
|
||||
|
||||
export enum NotificationTypeEnum {
|
||||
USER_LOGIN = "USER_LOGIN",
|
||||
ANNOUNCEMENT = "ANNOUNCEMENT",
|
||||
|
||||
// Finance category
|
||||
WALLET_CHARGE = "WALLET_CHARGE",
|
||||
WALLET_DEDUCTION = "WALLET_DEDUCTION",
|
||||
|
||||
//Invoice
|
||||
BILL_INVOICE_REMINDER = "BILL_INVOICE_REMINDER",
|
||||
BILL_INVOICE = "BILL_INVOICE",
|
||||
CREATE_INVOICE = "CREATE_INVOICE",
|
||||
|
||||
// Service category
|
||||
CREATE_SERVICE = "CREATE_SERVICE",
|
||||
UNBLOCK_SERVICE = "UNBLOCK_SERVICE",
|
||||
BLOCK_SERVICE = "BLOCK_SERVICE",
|
||||
|
||||
// Support category
|
||||
ANSWER_TICKET = "ANSWER_TICKET",
|
||||
CREATE_TICKET = "CREATE_TICKET",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user