"use client"; import { Bell, CheckCheck, Loader2, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { ScrollArea } from "@/components/ui/scroll-area"; import { useNotifications } from "@/contexts/NotificationsContext"; import type { NotificationSchema } from "@/lib/types"; import { cn, formatJalali } from "@/lib/utils"; const connectionLabels = { idle: "خاموش", connecting: "در حال اتصال", connected: "متصل", disconnected: "قطع شده", } as const; function NotificationItem({ notification, onOpen, onDelete, }: { notification: NotificationSchema; onOpen: (notification: NotificationSchema) => Promise; onDelete: (notification: NotificationSchema) => Promise; }) { return (
); } export default function NotificationsBell() { const { notifications, unreadCount, totalCount, hasMore, isLoading, isLoadingMore, connectionStatus, loadMore, markAllAsSeen, deleteNotification, openNotification, } = useNotifications(); return (
{connectionLabels[connectionStatus]} {unreadCount > 0 ? ( ) : null}

اعلان‌ها

{totalCount > 0 ? `${totalCount} مورد ثبت شده` : "هنوز اعلانی ندارید."}

{isLoading ? (
در حال بارگذاری اعلان‌ها...
) : notifications.length ? ( notifications.map((notification) => ( )) ) : (
اعلان تازه‌ای برای شما ثبت نشده است.
)}
{hasMore ? (
) : null}
); }