diff --git a/src/components/InvestorNotification.tsx b/src/components/InvestorNotification.tsx
index 8dd14b1..85cccb0 100644
--- a/src/components/InvestorNotification.tsx
+++ b/src/components/InvestorNotification.tsx
@@ -1,55 +1,21 @@
'use client';
-import { useState } from 'react';
-import { Bell, X, ArrowRight, Package, DollarSign, Bike, AlertCircle, CheckCircle } from 'lucide-react';
+import Link from 'next/link';
+import { Bell, Package, DollarSign, Bike, AlertCircle, CheckCircle } from 'lucide-react';
const mockNotifications = [
- {
- id: '1',
- type: 'rental',
- title: 'New Rental Started',
- message: 'Your bike AB-1234 has been rented by rider MR-456',
- time: '5 min ago',
- read: false,
- },
- {
- id: '2',
- type: 'earning',
- title: 'Earning Credited',
- message: 'à§³450 has been added to your wallet from bike CD-5678',
- time: '2 hours ago',
- read: false,
- },
- {
- id: '3',
- type: 'success',
- title: 'Withdrawal Complete',
- message: 'Your withdrawal of à§³5,000 has been processed successfully',
- time: '1 day ago',
- read: true,
- },
- {
- id: '4',
- type: 'alert',
- title: 'Maintenance Alert',
- message: 'Bike XY-9012 requires maintenance attention',
- time: '2 days ago',
- read: true,
- },
+ { id: '1', type: 'rental', title: 'New Rental Started', message: 'Your bike AB-1234 has been rented by rider MR-456', time: '5 min ago', read: false },
+ { id: '2', type: 'earning', title: 'Earning Credited', message: 'à§³450 has been added to your wallet from bike CD-5678', time: '2 hours ago', read: false },
+ { id: '3', type: 'success', title: 'Withdrawal Complete', message: 'Your withdrawal of à§³5,000 has been processed successfully', time: '1 day ago', read: true },
+ { id: '4', type: 'alert', title: 'Maintenance Alert', message: 'Bike XY-9012 requires maintenance attention', time: '2 days ago', read: true },
];
const iconMap: Record = {
- rental: Bike,
- earning: DollarSign,
- success: CheckCircle,
- alert: AlertCircle,
- default: Package,
+ rental: Bike, earning: DollarSign, success: CheckCircle, alert: AlertCircle, default: Package,
};
export default function InvestorNotification({ isMobile = false }: { isMobile?: boolean }) {
- const [isOpen, setIsOpen] = useState(false);
- const [notifications] = useState(mockNotifications);
- const unreadCount = notifications.filter(n => !n.read).length;
+ const unreadCount = mockNotifications.filter(n => !n.read).length;
if (isMobile) {
return (
@@ -58,117 +24,29 @@ export default function InvestorNotification({ isMobile = false }: { isMobile?:
JAIBEN
Investor
-
-
- {isOpen && (
- <>
-
setIsOpen(false)}
- />
-
-
-
-
Notifications
-
-
-
- {notifications.map((notif) => {
- const Icon = iconMap[notif.type] || iconMap.default;
- return (
-
-
-
-
-
-
-
- {notif.title}
-
-
{notif.message}
-
{notif.time}
-
- {!notif.read && (
-
- )}
-
-
- );
- })}
-
-
-
- >
- )}
+
);
}
return (
-
-
-
-
-
- Notifications
-
- {unreadCount > 0 && (
-
- {unreadCount} new
-
- )}
+
+
+
+
+ Notifications
-
- {notifications.map((notif) => {
- const Icon = iconMap[notif.type] || iconMap.default;
- return (
-
-
-
-
-
-
-
- {notif.title}
-
-
{notif.message}
-
{notif.time}
-
- {!notif.read && (
-
- )}
-
-
- );
- })}
-
-
-
-
-
+ {unreadCount > 0 && (
+
{unreadCount}
+ )}
+
);
}
\ No newline at end of file
diff --git a/src/components/LayoutContent.tsx b/src/components/LayoutContent.tsx
index 7a300fc..0aa03fa 100644
--- a/src/components/LayoutContent.tsx
+++ b/src/components/LayoutContent.tsx
@@ -13,7 +13,7 @@ export default function LayoutContent({ children }: LayoutContentProps) {
return (
<>
{showSidebar &&
}
-
+
{children}
>
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index b2268f3..712e74b 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -26,7 +26,6 @@ import {
Target, User, History, Bell
} from 'lucide-react';
import { getUserName, getUserRole, logout } from '@/lib/auth';
-import InvestorNotification from './InvestorNotification';
const ROLE_LABELS: Record = {
super_admin: 'Super Admin',
@@ -72,7 +71,7 @@ const investorNavItems: NavItem[] = [
{ label: 'My Investments', href: '/investor/plans', icon: Target },
{ label: 'Rental History', href: '/investor/rental-history', icon: History },
{ label: 'Withdraw', href: '/investor/withdraw', icon: CreditCard },
- { label: 'Notifications', href: '#', icon: Bell, isNotification: true },
+ { label: 'Notifications', href: '/investor/notifications', icon: Bell },
{ label: 'My Profile', href: '/investor/profile', icon: User },
];
@@ -86,7 +85,6 @@ export default function Sidebar() {
const pathname = usePathname();
const [mobileOpen, setMobileOpen] = useState(false);
const [expandedMenu, setExpandedMenu] = useState(null);
- const [notificationOpen, setNotificationOpen] = useState(false);
const [userName, setUserName] = useState('User');
const [userRole, setUserRole] = useState('admin');
@@ -158,22 +156,7 @@ export default function Sidebar() {
const isChild = item.href !== '/' && pathname.startsWith(item.href + '/');
const isActive = isExact || isChild;
const Icon = item.icon;
-
- if (item.isNotification) {
- return (
-
- );
- }
+ const isNotification = item.label === 'Notifications';
return (
{item.label}
+ {isNotification && (
+ 2
+ )}
);
})}
- {isInvestor && notificationOpen && (
-
-
- Notifications
-
-
-
-
- )}
-