+ {/* Header */}
+
+
+
+ Notifications
+
+
+ {unreadCount > 0
+ ? `You have ${unreadCount} unread notification${unreadCount === 1 ? "" : "s"}`
+ : "You're all caught up!"}
+
+
+
+ {unreadCount > 0 && (
+
+ )}
+
+
+
+
+
+
+ {/* Filters */}
+
+ {/* Search */}
+
+
+ {
+ setSearchQuery(e.target.value);
+ setPage(1);
+ }}
+ className="w-full rounded-lg border border-gray-200 bg-white py-2 pl-10 pr-4 text-sm text-gray-900 placeholder-gray-400 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-slate-700 dark:bg-slate-900 dark:text-gray-100 dark:placeholder-gray-500"
+ />
+
+
+ {/* Category filter */}
+
+
+
+
+
+ {/* Read filter */}
+
+ {(["all", "unread", "read"] as ReadFilter[]).map((filter) => (
+
+ ))}
+
+
+
+ {/* Notification list */}
+ {paginated.length === 0 ? (
+
+
+
+ {searchQuery || categoryFilter !== "all" || readFilter !== "all"
+ ? "No notifications match your filters."
+ : "No notifications yet."}
+
+
+ {searchQuery || categoryFilter !== "all" || readFilter !== "all"
+ ? "Try adjusting your search or filters."
+ : "We'll notify you when something important happens."}
+
+
+ ) : (
+
+ {paginated.map((n) => (
+
+ ))}
+
+ )}
+
+ {/* Pagination */}
+ {totalPages > 1 && (
+
+
+ Showing {(safePage - 1) * ITEMS_PER_PAGE + 1}–
+ {Math.min(safePage * ITEMS_PER_PAGE, filtered.length)} of{" "}
+ {filtered.length}
+
+
+
+
+ {safePage} / {totalPages}
+
+
+
+
+ )}
+
+ );
+}
diff --git a/src/dashboard/notifications/NotificationContext.tsx b/src/dashboard/notifications/NotificationContext.tsx
new file mode 100644
index 0000000..fe5d669
--- /dev/null
+++ b/src/dashboard/notifications/NotificationContext.tsx
@@ -0,0 +1,102 @@
+import {
+ useEffect,
+ useState,
+ useCallback,
+ type ReactNode,
+} from "react";
+import { useAuth } from "../../Firebase/useAuth";
+import {
+ subscribeToNotifications,
+ markAsRead as markAsReadService,
+ markAllAsRead as markAllAsReadService,
+ subscribeToPreferences,
+ updatePreferences as updatePreferencesService,
+} from "./notificationService";
+import { NotificationContext } from "./NotificationContextObject";
+import type { Notification, NotificationPreferences } from "./types";
+import { DEFAULT_PREFERENCES } from "./types";
+
+export function NotificationProvider({ children }: { children: ReactNode }) {
+ const { currentUser } = useAuth();
+ const [notifications, setNotifications] = useState