'use client'; import { useEffect, useState } from 'react'; import { useRouter } from 'next/navigation'; import { Bell, CheckCircle, XCircle, Calendar, MessageCircle } from 'lucide-react'; import AuthService from '@/app/services/AuthService'; const mockNotifications = [ { id: 1, type: 'booking', title: 'تأكيد الحجز', message: 'تم تأكيد حجزك في فيلا المزة للفترة 10-15 مارس', date: '2024-03-01', read: false, icon: CheckCircle, color: 'text-green-600', bgColor: 'bg-green-50' }, { id: 2, type: 'payment', title: 'دفعة مستلمة', message: 'تم استلام دفعة الإيجار بقيمة 500,000 ل.س', date: '2024-02-28', read: false, icon: MessageCircle, color: 'text-blue-600', bgColor: 'bg-blue-50' }, { id: 3, type: 'reminder', title: 'تذكير بالإيجار', message: 'ينتهي عقد الإيجار خلال 3 أيام', date: '2024-02-25', read: true, icon: Calendar, color: 'text-amber-600', bgColor: 'bg-amber-50' } ]; export default function NotificationsPage() { const router = useRouter(); const [notifications, setNotifications] = useState([]); const [isLoading, setIsLoading] = useState(true); useEffect(() => { if (AuthService.isAdmin()) { router.push('/'); return; } setTimeout(() => { setNotifications(mockNotifications); setIsLoading(false); }, 500); }, [router]); const markAsRead = (id) => { setNotifications(prev => prev.map(n => (n.id === id ? { ...n, read: true } : n)) ); }; const markAllAsRead = () => { setNotifications(prev => prev.map(n => ({ ...n, read: true }))); }; const unreadCount = notifications.filter(n => !n.read).length; if (isLoading) { return (
جاري التحميل...
{unreadCount > 0 ? `لديك ${unreadCount} إشعار غير مقروء` : 'جميع الإشعارات مقروءة'}
ستظهر هنا الإشعارات المتعلقة بحجوزاتك ومدفوعاتك
{notification.message}
{notification.date}