'use client'; import { useEffect, useState } from 'react'; import { Bell, CheckCheck } from 'lucide-react'; import { useAuthStore } from '@/stores/useAuthStore'; import { useNotificationStore } from '@/stores/useNotificationStore'; import { formatDateTime } from '@/lib/format'; const TYPE_LABEL: Record = { assignment: '分配', mention: '提及', risk_alert: '风险', overdue_item: '逾期', }; export function NotificationBell() { const user = useAuthStore((s) => s.user); const { notifications, unreadCount, fetchNotifications, markRead, markAllRead } = useNotificationStore(); const [open, setOpen] = useState(false); useEffect(() => { if (user?.id) void fetchNotifications(user.id).catch(() => {}); }, [fetchNotifications, user?.id]); if (!user?.id) return null; return (
{open && (
通知
{notifications.length === 0 ? (
暂无通知
) : ( notifications.map((item) => ( )) )}
)}
); }