import React, { useState } from 'react'; import { Tabs, Tab, IconButton, Menu, MenuItem } from '@mui/material'; import { MoreVert, Delete } from '@mui/icons-material'; const NotificationPage = () => { const [activeTab, setActiveTab] = useState(0); const [anchorEl, setAnchorEl] = useState(null); const [selectedNotification, setSelectedNotification] = useState(null); const [notifications, setNotifications] = useState([ { id: 1, type: 'message', user: 'Thangavel', avatar: 'https://i.pravatar.cc/150?img=1', message: 'has sent you a message', time: '1d', action: 'View message', category: 'all' }, { id: 2, type: 'profile', user: 'Thangavel', avatar: 'https://i.pravatar.cc/150?img=2', message: 'and 3 others have viewed your profile', time: '1d', action: 'See who viewed', category: 'interactions' }, { id: 3, type: 'interest', user: 'Parthiban', avatar: 'https://i.pravatar.cc/150?img=3', message: 'has sent you an interest', time: '1d', action: 'View interest', category: 'urgent' }, { id: 4, type: 'message', user: 'Rajesh', avatar: 'https://i.pravatar.cc/150?img=4', message: 'replied to your message', time: '2d', action: 'View message', category: 'all' }, { id: 5, type: 'profile', user: 'Priya', avatar: 'https://i.pravatar.cc/150?img=5', message: 'viewed your profile', time: '2d', action: 'See profile', category: 'interactions' }, { id: 6, type: 'interest', user: 'Kumar', avatar: 'https://i.pravatar.cc/150?img=6', message: 'accepted your interest', time: '3d', action: 'View profile', category: 'urgent' } ]); const handleTabChange = (event, newValue) => { setActiveTab(newValue); }; const handleMenuOpen = (event, notificationId) => { setAnchorEl(event.currentTarget); setSelectedNotification(notificationId); }; const handleMenuClose = () => { setAnchorEl(null); setSelectedNotification(null); }; const handleDelete = () => { setNotifications(notifications.filter(n => n.id !== selectedNotification)); handleMenuClose(); }; const getFilteredNotifications = () => { if (activeTab === 0) return notifications; if (activeTab === 1) return notifications.filter(n => n.category === 'interactions'); if (activeTab === 2) return notifications.filter(n => n.category === 'urgent'); return notifications; }; const filteredNotifications = getFilteredNotifications(); return (
{notification.user}{' '} {notification.message}