'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'; import { useNotifications } from '@/app/contexts/NotificationsContext'; export default function NotificationsPage() { const router = useRouter(); const { notifications, unreadCount, isLoading } = useNotifications(); const [error, setError] = useState(null); useEffect(() => { if (!AuthService.isAuthenticated()) { router.push('/login'); return; } }, [router]); const markAsRead = (id) => { // This will be handled by context if needed }; const markAllAsRead = () => { // This will be handled by context if needed }; if (isLoading) { return (

جاري التحميل...

); } if (error) { return (

خطأ في التحميل

{error}

); } return (

الإشعارات

{unreadCount > 0 ? `لديك ${unreadCount} إشعار غير مقروء` : 'جميع الإشعارات مقروءة'}

{notifications.length === 0 ? (

لا توجد إشعارات

ستظهر هنا الإشعارات المتعلقة بحجوزاتك ومدفوعاتك

) : (
{notifications.map((notification, index) => (

{notification.title}

{notification.message && (

{notification.message}

)} {notification.date && (

{notification.date}

)}
))}
)}
); }